reset $pathspec: exit with code 0 if successful
"git reset $pathspec" currently exits with a non-zero exit code if the worktree is dirty after resetting, which is inconsistent with reset without pathspec, and it makes it harder to know whether the command really failed. Change it to exit with code 0 regardless of whether the worktree is dirty so that non-zero indicates an error. This makes the 4 "disambiguation" test cases in t7102 clearer since they all used to "fail", 3 of which "failed" due to changes in the work tree. Now only the ambiguous one fails. Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
10746a3616
commit
d94c5e2fa2
@ -23,7 +23,7 @@ test_expect_success '"reset <submodule>" updates the index' '
|
||||
git update-index --refresh &&
|
||||
git diff-files --quiet &&
|
||||
git diff-index --quiet --cached HEAD &&
|
||||
test_must_fail git reset HEAD^ submodule &&
|
||||
git reset HEAD^ submodule &&
|
||||
test_must_fail git diff-files --quiet &&
|
||||
git reset submodule &&
|
||||
git diff-files --quiet
|
||||
|
Reference in New Issue
Block a user