Skip to content

Commit

Permalink
WSL: force-push was inserted incorrectly (#9760)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerhardol committed Dec 11, 2021
1 parent 361b6bb commit 3f2b09a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions GitUI/CommandsDialogs/FormPush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,10 @@ private bool HandlePushOnExit(ref bool isError, FormProcess form)
if (!form.ProcessArguments.Contains(" -f ") && !form.ProcessArguments.Contains(" --force"))
{
// Note that WSL may add other arguments prior to the actual command so "push" may not be first.
Debug.Assert(form.ProcessArguments.Contains("push "), "Arguments should start with 'push' command");
int pos = form.ProcessArguments.IndexOf("push ");
Debug.Assert(pos >= 0, "Arguments should start with 'push' command");

form.ProcessArguments = form.ProcessArguments.Insert("push".Length, " --force-with-lease");
form.ProcessArguments = form.ProcessArguments.Insert(pos + "push ".Length, "--force-with-lease ");
}

form.Retry();
Expand Down

0 comments on commit 3f2b09a

Please sign in to comment.