mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-23 20:47:25 -08:00
optimize<Pull>: use custom stash instead of --autostash to avoid data missing when file is locked by other applications
This commit is contained in:
parent
020577e240
commit
0dc73cbc0d
1 changed files with 2 additions and 7 deletions
|
@ -13,6 +13,7 @@ namespace SourceGit.Commands {
|
||||||
Cwd = repo;
|
Cwd = repo;
|
||||||
TraitErrorAsOutput = true;
|
TraitErrorAsOutput = true;
|
||||||
handler = onProgress;
|
handler = onProgress;
|
||||||
|
needStash = autoStash;
|
||||||
|
|
||||||
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
|
var sshKey = new Config(repo).Get($"remote.{remote}.sshkey");
|
||||||
if (!string.IsNullOrEmpty(sshKey)) {
|
if (!string.IsNullOrEmpty(sshKey)) {
|
||||||
|
@ -23,13 +24,7 @@ namespace SourceGit.Commands {
|
||||||
}
|
}
|
||||||
|
|
||||||
Args += "pull --verbose --progress --tags ";
|
Args += "pull --verbose --progress --tags ";
|
||||||
|
|
||||||
if (useRebase) Args += "--rebase ";
|
if (useRebase) Args += "--rebase ";
|
||||||
if (autoStash) {
|
|
||||||
if (useRebase) Args += "--autostash ";
|
|
||||||
else needStash = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Args += $"{remote} {branch}";
|
Args += $"{remote} {branch}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +41,7 @@ namespace SourceGit.Commands {
|
||||||
}
|
}
|
||||||
|
|
||||||
var succ = Exec();
|
var succ = Exec();
|
||||||
if (needStash) new Stash(Cwd).Pop("stash@{0}");
|
if (succ && needStash) new Stash(Cwd).Pop("stash@{0}");
|
||||||
return succ;
|
return succ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue