]> git.ipfire.org Git - thirdparty/git.git/commit - merge-recursive.c
merge-recursive: give less scary messages when merge did not start
authorJunio C Hamano <gitster@pobox.com>
Tue, 8 Sep 2009 05:43:11 +0000 (22:43 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 8 Sep 2009 21:46:36 +0000 (14:46 -0700)
commitfadd069d036c9d376769692e2726c5a1600d281c
treeb72aa42b2a29224fbac342dfd48aaa8c3ea6485d
parent5ad9dce7e691106fecde413de8cc321b937367a6
merge-recursive: give less scary messages when merge did not start

When unpack_trees() three-way merge logic is called from merge-recursive
and finds that local changes are going to be clobbered, its plumbing level
messages were given as errors first, and then the merge driver added even
more scary message "fatal: merging of trees <a long object name> and
<another long object name> failed".

This is most often encountered by new CVS/SVN migrants who are used to
start a merge from a dirty work tree.  The saddest part is that the merge
refused to run to prevent _any_ damage from being done to your work tree
when these messages are given, but the messages look a lot more scarier
than the conflicted case where the user needs to resolve them.

Replace the plumbing level messages so that they talk about what it is
protecting the user from, and end the messages with "Aborting." so that it
becomes clear that the command did not do any harm.

The final "merging of trees failed" message is superfluous, unless you are
interested in debugging the merge-recursive itself.  Squelch the current
die() message by default, but allow it to help people who debug git with
verbosity level 4 or greater.

Unless there is some bug, an inner merge that does not touch working tree
should not trigger any such error, so emit the current die() message when
we see an error return from it while running the inner merge, too.  It
would also help people who debug git.

We could later add instructions on how to recover (i.e. "stash changes
away or commit on a side branch and retry") instead of the silent
exit(128) I have in this patch, and then use Peff's advice.* mechanism to
squelch it (e.g. "advice.mergeindirtytree"), but they are separate topics.

Tested-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
merge-recursive.c