git: Add support for git pull with rebase (#41117)
- Adds a new action `git::PullRebase` which adds `--rebase` in the final command invoked by existing Git-Pull implementation. - Includes the new action in "Fetch/Push" button in the Git Panel (screenshot below) - Adds key-binding for `git::PullRebase` in all three platforms, following the existing key-binding patterns (`ctrl-g shift-down`) - Update git docs to include the new action. Sidenote: This is my first ever OSS contribution Screenshot: <img width="234" height="215" alt="image" src="https://github.com/user-attachments/assets/713d068f-5ea5-444f-8d66-444ca65affc8" /> --- Release Notes: - Git: Added `git: pull rebase` for running `git pull --rebase`.
This commit is contained in:
@@ -72,6 +72,8 @@ actions!(
|
||||
ForcePush,
|
||||
/// Pulls changes from the remote repository.
|
||||
Pull,
|
||||
/// Pulls changes from the remote repository with rebase.
|
||||
PullRebase,
|
||||
/// Fetches changes from the remote repository.
|
||||
Fetch,
|
||||
/// Fetches changes from a specific remote.
|
||||
|
||||
@@ -533,6 +533,7 @@ pub trait GitRepository: Send + Sync {
|
||||
&self,
|
||||
branch_name: String,
|
||||
upstream_name: String,
|
||||
rebase: bool,
|
||||
askpass: AskPassDelegate,
|
||||
env: Arc<HashMap<String, String>>,
|
||||
// This method takes an AsyncApp to ensure it's invoked on the main thread,
|
||||
@@ -1690,6 +1691,7 @@ impl GitRepository for RealGitRepository {
|
||||
&self,
|
||||
branch_name: String,
|
||||
remote_name: String,
|
||||
rebase: bool,
|
||||
ask_pass: AskPassDelegate,
|
||||
env: Arc<HashMap<String, String>>,
|
||||
cx: AsyncApp,
|
||||
@@ -1703,7 +1705,13 @@ impl GitRepository for RealGitRepository {
|
||||
command
|
||||
.envs(env.iter())
|
||||
.current_dir(&working_directory?)
|
||||
.args(["pull"])
|
||||
.arg("pull");
|
||||
|
||||
if rebase {
|
||||
command.arg("--rebase");
|
||||
}
|
||||
|
||||
command
|
||||
.arg(remote_name)
|
||||
.arg(branch_name)
|
||||
.stdout(smol::process::Stdio::piped())
|
||||
|
||||
Reference in New Issue
Block a user