From: Eli Barzilay <eli@barzilay.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: Problem with git merge/rebase with conflicts
Date: Thu, 6 May 2010 16:45:44 -0400 [thread overview]
Message-ID: <19427.10872.708654.433450@winooski.ccs.neu.edu> (raw)
In-Reply-To: <7v8w7wj134.fsf@alter.siamese.dyndns.org>
On May 6, Junio C Hamano wrote:
> Eli Barzilay <eli@barzilay.org> writes:
>
> > 1. I get this:
> > 3. Again, starting from the same setup:
>
> I don't have time to look at the second one,
(FWIW, I can't recreate it now -- very weird since when I sent that
message it was definitely repeatable.)
> but these are quite obvious and natural. "status" in these cases
> notices that you haven't made any change relative to HEAD (in either
> the index nor in the working tree) after all, and that is what is
> being reported.
Yes, I agree that they're doing "obviously" doing the right thing, but
I don't think that they're natural enough... I'm not saying that it's
doing something broken, just that some of the interface (=> printouts)
could eliminate surprises. Here are some problems that I've seen,
IMO, some of them are indications that this is not natural. I'll
prefix each one with the false belief that I had (and that I didn't
see any text that would correct it...).
1. False belief: After you edit and `git add' a file, you will need to
commit it to make the change part of your history.
Obvious counter example: edit a file and `git add' it; undo the
edit in the file and `git add' again -- you now have nothing to
commit.
A way that I think will solve this: make `git add' notify you that
the changes that you just added canceled earlier changes and you're
back to a clean state.
2. False belief: If you have a completely clear working directory and
index, then there's nothing for you to commit. (At least without
forcing an empty commit.)
Counter example: run this (simplified example)
rm -rf /tmp/test; mkdir /tmp/test; cd /tmp/test; git init
echo foo > file; git add file; git commit -m first
git branch a-branch; echo abc > file; git commit -m abc file
git checkout a-branch; echo xyz > file; git commit -m xyz file
git merge master; echo xyz > file; git add file
git status
That last `status' will happily tell you that "nothing to commit
(working directory clean)" -- but `git commit' *will* commit the
merge.
A way that I think will solve this: clearly there is somewhere
something that makes the commit possible (probably .git/MERGE*
files) -- so make `git status' inspect these and say something
about it instead of saying that there's nothing to commit. (The
other option would be to make `git add' clear out the merge state
too, but this is probably very broken.)
2a. A related problem: usually when I try to checkout a different
branch when I have changes, git barfs at me. But after that script
is run, I can `git checkout master' with no errors or warnings, and
the merge commit is gone. It looks like checkout is even careful
enough to remove the .git/MERGE* files, so making it barf (or at
least spit out some warning) is probably easy...
3. False belief: if your working directory and your index are dirty,
then there *is* something for you to commit.
Obvious counter example: edit a file and `git add' it; undo the
edit in the file but *don't* `git add' again -- `git status -s'
will now say:
MM file
And now:
$ git commit .
# On branch master
nothing to commit (working directory clean)
but the status is still not cleared. Trying to checkout a
different branch gives me the barf.
A way that I think will solve this: make `git commit <path>' add
the paths before committing -- and if `add' says something, it will
say that here and clarify what happened. But this is probably too
much of a change, so alternatively `git commit' would notice that
there was nothing to commit because of this state, and `add' the
right files to clear out the status (after saying something about
it).
4. `git rebase' issues -- I've sent a separate message about that, and
IMO adding those notes to what rebase says would clear up most of
the confusion, and probably if the above are done then it will also
help rebase to be more robust.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
next prev parent reply other threads:[~2010-05-06 20:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-06 10:06 Problem with git merge/rebase with conflicts Eli Barzilay
2010-05-06 19:13 ` Junio C Hamano
2010-05-06 20:45 ` Eli Barzilay [this message]
2010-05-08 5:20 ` Jeff King
2010-05-08 5:52 ` Eli Barzilay
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=19427.10872.708654.433450@winooski.ccs.neu.edu \
--to=eli@barzilay.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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).