git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Philippe Blain <levraiphilippeblain@gmail.com>
To: Felipe Contreras <felipe.contreras@gmail.com>
Cc: Git mailing list <git@vger.kernel.org>,
	Denton Liu <liu.denton@gmail.com>
Subject: Re: Regression in 'git pull --rebase --autostash' since v2.32.0
Date: Sat, 17 Jul 2021 13:03:44 -0400	[thread overview]
Message-ID: <109545c7-7245-6146-d39a-2a44ac450db3@gmail.com> (raw)
In-Reply-To: <a0071549-73f6-9636-9279-3f01143a05de@gmail.com>

Le 2021-07-17 à 11:29, Philippe Blain a écrit :
> Hi Felipe,
> 
> Your recent clean-up of 'git pull --autostash' seems to unfortunately have made things
> worse if the pull brings new files that conflict with existing untracked files,
> which makes the pull abort,
> and there are tracked files with modifications (so --autostash comes into play).
> 
> Before your change, 'git pull --no-rebase --autostash' did *not* apply the autostash
> after the pull failed, thus loosing modifications to tracked files (and it did not save the
> stash entry !). 'git pull --rebase --autostash' correctly applied the autostash, but ended with
> a strange "error: could not detach HEAD".
> 
> After your change, both 'git pull --no-rebase --autostash' and 'git pull --rebase --autostash'
> have the same buggy behaviour: they do not apply the autostash and do not save it in the stash list.

The change below seem to fix both cases:

diff --git a/builtin/merge.c b/builtin/merge.c
index a8a843b1f5..b2ad70c50a 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1560,6 +1560,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
  					  &head_commit->object.oid,
  					  &commit->object.oid,
  					  overwrite_ignore)) {
+			apply_autostash(git_path_merge_autostash(the_repository));
  			ret = 1;
  			goto done;
  		}


*But* from a quick audit of 'cmd_merge', there are still two code paths that
call 'create_autostash' but then fail to apply it before calling 'goto done':

1. the branch 'if (automerge_was_ok)' (line 1693)
2. the branch 'if (!best_strategy)' (line 1704)


Cheers,
Philippe.

  reply	other threads:[~2021-07-17 17:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-17 15:29 Regression in 'git pull --rebase --autostash' since v2.32.0 Philippe Blain
2021-07-17 17:03 ` Philippe Blain [this message]
2021-07-17 19:34 ` Felipe Contreras
2021-07-17 23:02   ` Philippe Blain
2021-07-18  3:05     ` Felipe Contreras
2021-07-23 12:17       ` Philippe Blain
2021-07-23 16:11         ` Felipe Contreras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=109545c7-7245-6146-d39a-2a44ac450db3@gmail.com \
    --to=levraiphilippeblain@gmail.com \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=liu.denton@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).