git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: Re: [PATCH 1/2] checkout: do not check out unmerged higher stages randomly
Date: Sat, 30 Aug 2008 11:02:48 -0700	[thread overview]
Message-ID: <7v1w06ido7.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 7vbpzb4i1h.fsf@gitster.siamese.dyndns.org

Junio C Hamano <gitster@pobox.com> writes:

> During a conflicted merge when you have unmerged stages for a path F in
> the index, if you asked:
>
>     $ git checkout F
>
> we rewrote F as many times as we have stages for it, and the last one
> (typically "theirs") was left in the work tree, without resolving the
> conflict.
>
> This patch fixes it by noticing that a specified pathspec pattern matches
> an unmerged path, and by erroring out.

The patch claims that it is a bugfix, but I have a slight worry that
somebody might be depending on this broken behaviour in their workflow.

    $ git pull
    Conflicts in foo.c (modify/modify)
    .. Eeek, conflicts.  My changes are always crap, and I trust my
    .. upstream more than I trust myself, so I'll take advantage of
    .. the bug to check out "their" version.
    $ git checkout foo.c

In modify/modify case, because we will have stage #3 (state after their
change), that will be the version you will get as the final result of this
broken behaviour of "checkout".

This patch alone will make the above to check out "theirs" an error.  In a
later one in the series, you can still say:

    $ git checkout --theirs foo.c ;# or "git checkout -3 foo.c"

to get the feature back, at the same time you will now be able to say

    $ git checkout --ours foo.c ;# or "git checkout -2 foo.c"

for symmetry (admittably, it is the same thing as "git checkout HEAD
foo.c").

So we _could_ choose to stay backward compatible by leaving this "bug"
unattended without loss of ability to checkout either theirs or ours, even
though without fixing this, you cannot sanely add "git checkout -m foo.c"
feature that comes later in the updated series, which allows you to go
back to the original conflicted state after you (or rerere) messed up the
working tree state.

Thoughts?

      parent reply	other threads:[~2008-08-30 18:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-29 21:39 [PATCH 1/2] checkout: do not check out unmerged higher stages randomly Junio C Hamano
2008-08-29 21:42 ` [PATCH 2/2] checkout: allow ignoring unmerged paths when checking out of the index Junio C Hamano
2008-08-29 21:53   ` Junio C Hamano
2008-08-30 18:02 ` Junio C Hamano [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=7v1w06ido7.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    /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).