From: Junio C Hamano <gitster@pobox.com>
To: Phil Hord <phil.hord@gmail.com>
Cc: David Aguilar <davvid@gmail.com>,
git@vger.kernel.org, martin.von.zweigbergk@gmail.com,
tytso@mit.edu
Subject: Re: [RFC/PATCH] stash: Delete MERGE_RR before stash apply
Date: Fri, 06 Jul 2012 13:01:54 -0700 [thread overview]
Message-ID: <7v7gugodzh.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <CABURp0rOfr=c-TcF7O6Ms=2iRA3SC9ckt_ukeozBS5vGqaKZaQ@mail.gmail.com> (Phil Hord's message of "Fri, 6 Jul 2012 11:53:23 -0400")
Phil Hord <phil.hord@gmail.com> writes:
>> Would an obvious alternative of running "git rerere" ourselves after
>> running "git merge-recursive" in this script work?
>>
>> git-stash.sh | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/git-stash.sh b/git-stash.sh
>> index 4e2c7f8..bbefdf6 100755
>> --- a/git-stash.sh
>> +++ b/git-stash.sh
>> @@ -469,6 +469,7 @@ apply_stash () {
>> else
>> # Merge conflict; keep the exit status from merge-recursive
>> status=$?
>> + git rerere
>> if test -n "$INDEX_OPTION"
>> then
>> gettextln "Index was not unstashed." >&2
>
> Yes, except it needs "git rerere clear". "git rerere" is not enough
> to cause the clean-up to occur.
Intuitively, it feels wrong to run "rerere clear" after an operation
that potentially can create conflicts in the index and in the
working tree.
The point in the codepath where the above "git rerere" appears is
immediately after we run merge-recursive backend. Because the
backend does not invoke rerere itself (which by the way probably is
the correct thing not to; I haven't thought things through, though),
we invoke it ourselves there, so that the user can ask rerere to
replay an earlier conflict resolution. Why can it be a good thing
to discard potentially useful information with "git rerere clear"?
I just tried this sequence (manually without any patch).
$ git init empty && cd empty
$ for i in a b c d e; do echo $i; done >file
$ git add file && git commit -m initial
$ for i in a b C d e; do echo $i; done >file ;# c to C
$ git stash
$ for i in a B c d e; do echo $i; done >file ;# b to B
$ git commit -a -m second
$ mkdir .git/rr-cache ;# enable rerere
$ git stash apply ;# conflicts
$ git rerere ;# records preimage
$ for i in a B C d e; do echo $i; done >file ;# c to C
$ git commit -a -m third ;# records resolution
$ git reset --hard HEAD^
$ git stash apply ;# conflicts
$ git rerere ;# replays
I think the above "how about this" patch is equivalent to the two
"git rerere" invocations I made manually with my experiment, and it
seems to improve the end user experience (please try it yourself).
What am I missing???
next prev parent reply other threads:[~2012-07-06 20:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-05 13:48 [RFC/PATCH] stash: Delete MERGE_RR before stash apply Phil Hord
2012-07-05 17:15 ` Junio C Hamano
2012-07-06 15:53 ` Phil Hord
2012-07-06 20:01 ` Junio C Hamano [this message]
2012-07-06 23:18 ` Phil Hord
2012-07-07 20:46 ` [PATCH v2 0/2] stash: invoke rerere in case of conflict Phil Hord
2012-07-07 20:46 ` [PATCH v2 1/2] test: git-stash conflict sets up rerere Phil Hord
2012-07-09 2:37 ` Junio C Hamano
2012-07-09 14:41 ` Phil Hord
2012-08-16 22:00 ` Junio C Hamano
2012-08-17 17:52 ` Phil Hord
2012-08-17 18:02 ` Junio C Hamano
2012-07-07 20:46 ` [PATCH v2 2/2] stash: invoke rerere in case of conflict Phil Hord
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v7gugodzh.fsf@alter.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=davvid@gmail.com \
--cc=git@vger.kernel.org \
--cc=martin.von.zweigbergk@gmail.com \
--cc=phil.hord@gmail.com \
--cc=tytso@mit.edu \
/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.
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 NNTP newsgroup(s).