Failed recursive merging can silently lose date in StGIT stable
authorCatalin Marinas <catalin.marinas@gmail.com>
Tue, 17 Apr 2007 16:29:32 +0000 (17:29 +0100)
committerCatalin Marinas <catalin.marinas@gmail.com>
Tue, 17 Apr 2007 23:58:36 +0000 (00:58 +0100)
commite4394e12db7cccd1b5bf905d364763221d65f534
treea15f30485cc93ddb31724fdf3d7574c81e2cfe45
parent7b4c40e6e5e019c5e079d8331bee4842af21019a
Failed recursive merging can silently lose date in StGIT

The logic in git.merge(recursive = True) is that if
git-merge-recursive fails, deal with the unmerged entries via diff3
and interactive merge (if 'autoimerge' is set to 'yes' in
config). There is a situation, however, when git-merge-recursive fails
because of an untracked file that would be overwritten by the
merge. In this case, git-merge-recursive aborts the operation but
without any unmerged entries in the index. StGIT considers that the
merge lead to an empty patch without reporting any error.

This commit makes it a bit safer by detecting whether there are
unmerged index entries and, if not, further raises an error informing
the user of the problem. The patch is still pushed as empty but the
user is informed of the failure and the possibility of running 'push
--undo'.

A better solution, but which require a bit more work, is to
distinguish between the merge failures and, in this specific case,
abort the push completely and revert the patch to its original state
(and popped from the stack).

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/git.py
stgit/stack.py