Suggesting "'reset HEAD <path>' to unstage" is dead wrong if we are about
to record a merge commit. For either an unmerged path (i.e. with
unresolved conflicts), or an updated path, it would result in discarding
what the other branch did.
Note that we do not do anything special in a case where we are amending a
merge. The user is making an evil merge starting from an already
committed merge, and running "reset HEAD <path>" is the right way to get
rid of the local edit that has been added to the index.
Once "reset --unresolve <path>" becomes available, we might want to
suggest it for a merged path that has unresolve information, but until
then, just remove the incorrect advice.
We might also want to suggest "checkout --conflict <path>" to revert the
file in the work tree to the state of failed automerge for an unmerged
path, but we never did that, and this commit does not change that.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When the desired resolution is to remove the path, "git rm <path>" is the
command the user needs to use. Just like in "Changed but not updated"
section, suggest to use "git add/rm" as appropriate.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This removes tentative "git stat" and make it take over "git status".
There are some tests that expect "git status" to exit with non-zero status
when there is something staged. Some tests expect "git status path..." to
show the status for a partial commit.
For these, replace "git status" with "git commit --dry-run". For the
ones that do not attempt a dry-run of a partial commit that check the
output from the command, check the output from "git status" as well, as
they should be identical.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
When a path is unmerged in the index, we used to always say "unmerged" in
the "Changed but not updated" section, even when the path was deleted in
the work tree.
Remove unmerged entries from the "Updated" section, and create a new
section "Unmerged paths". Describe how the different stages conflict
in more detail in this new section.
Note that with the current 3-way merge policy (with or without recursive),
certain combinations of index stages should never happen. For example,
having only stage #2 means that a path that did not exist in the common
ancestor was added by us while the other branch did not do anything to it,
which would have autoresolved to take our addition. The code nevertheless
prepares for the possibility that future merge policies may leave a path
in such a state.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Since an earlier change to diff-index by d1f2d7e (Make run_diff_index()
use unpack_trees(), not read_tree(), 2008-01-19), we stopped reporting an
unmerged path that does not exist in the tree, but we should.
Signed-off-by: Junio C Hamano <gitster@pobox.com>