git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: John Tapsell <johnflux@gmail.com>,
	Bryan Donlan <bdonlan@gmail.com>,
	Jay Soffian <jaysoffian@gmail.com>,
	Git Mailing List <git@vger.kernel.org>,
	Nanako Shiraishi <nanako3@lavabit.com>
Subject: Re: git merge --abort
Date: Tue, 24 Feb 2009 10:51:41 +0100	[thread overview]
Message-ID: <200902241051.42800.jnareb@gmail.com> (raw)
In-Reply-To: <7vk57goanf.fsf@gitster.siamese.dyndns.org>

Junio C Hamano wrote::
> Jakub Narebski <jnareb@gmail.com> writes:
>> Junio C Hamano wrote:

>>> I personally did not think "--keep" would need to be be part of a
>>> reasonable "merge --abort" implementation, but I may have missed some
>>> description of a viable design discussed on the list.

First, a description of state: here we assume that you have changes to
tracked files in working area that are neither in HEAD, nor in index,
and that you can have changes in index which are neither in HEAD nor
in working area.

If HEAD == index == working area then stashing is not necessary.

>> My idea was that merge would do the following:
>>
>>   $ <save stash into MERGE_STASH or similar, no reset>
>>   $ <do a merge>
>>
>> Then we have two possibilities:
>>
>>   # merge failed with conflicts
>>   $ git merge --abort (would unstash MERGE_STASH and delete it)
> 
> Here "would unstash" needs to follow something else, namely, make your
> work tree free of local changes.  How?  "reset --hard"?

Yes. "git merge --abort" would be equivalent to

  $ git reset --hard ORIG_HEAD
  $ git stash pop --ref=MERGE_STASH
  $ rm $GIT_DIR/MERGE_STASH

> 
>>   # we created merge conflict
>>   $ <MERGE_STASH is removed together with MERGE_HEAD>
> 
> You mean "created a merge without conflict", right?  That part is easy to
> guess and understand.

Yes. I meant here: "created merge _commit_" (not "conflict").

> 
> In fact, when you run more than one strategies, something similar to this
> already happens internally.  The C version may be harder to follow, but
> you can check the last scripted version contrib/examples/git-merge.sh and
> find two functions, savestate/restorestate pair, that does exactly that.
> 
> It way predates --keep patch, by the way.

Well, we have "git reset --merge ORIG_HEAD" which from what I understand
does at least part of "git merge --abort", but I am not sure if it
covers all cases (like dirty index in addition to dirty tree).

-- 
Jakub Narebski
Poland

      reply	other threads:[~2009-02-24  9:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-19 10:05 git merge --abort John Tapsell
2009-02-19 10:58 ` Junio C Hamano
2009-02-19 13:34   ` John Tapsell
2009-02-19 20:26     ` Jay Soffian
2009-02-20  4:47       ` John Tapsell
2009-02-20  5:24         ` Junio C Hamano
2009-02-20  8:13           ` John Tapsell
2009-02-20  8:33             ` Junio C Hamano
2009-02-20  8:42               ` John Tapsell
2009-02-21  7:28           ` Bryan Donlan
2009-02-21  8:34             ` Jakub Narebski
2009-02-21  9:18               ` Junio C Hamano
2009-02-21 10:18                 ` Jakub Narebski
2009-02-23 12:41                   ` John Tapsell
2009-02-24  1:36                     ` Junio C Hamano
2009-02-24  1:53                       ` Jakub Narebski
2009-02-24  2:01                         ` Junio C Hamano
2009-02-24  9:51                           ` Jakub Narebski [this message]

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=200902241051.42800.jnareb@gmail.com \
    --to=jnareb@gmail.com \
    --cc=bdonlan@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jaysoffian@gmail.com \
    --cc=johnflux@gmail.com \
    --cc=nanako3@lavabit.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.
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).