mirror of
https://github.com/git/git.git
synced 2024-11-25 02:44:48 +08:00
t4150: am fails if index is dirty
Since d1c5f2a
(Add git-am, applymbox replacement., 2005-10-07), git-am
will ensure that the index is clean before applying the patch. This is
to prevent changes unrelated to the patch from being committed.
Add a test for this check.
Reviewed-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
8528bf4b89
commit
ab156128fa
@ -154,6 +154,18 @@ test_expect_success 'am applies patch correctly' '
|
||||
test "$(git rev-parse second^)" = "$(git rev-parse HEAD^)"
|
||||
'
|
||||
|
||||
test_expect_success 'am fails if index is dirty' '
|
||||
test_when_finished "rm -f dirtyfile" &&
|
||||
rm -fr .git/rebase-apply &&
|
||||
git reset --hard &&
|
||||
git checkout first &&
|
||||
echo dirtyfile >dirtyfile &&
|
||||
git add dirtyfile &&
|
||||
test_must_fail git am patch1 &&
|
||||
test_path_is_dir .git/rebase-apply &&
|
||||
test_cmp_rev first HEAD
|
||||
'
|
||||
|
||||
test_expect_success 'am applies patch e-mail not in a mbox' '
|
||||
rm -fr .git/rebase-apply &&
|
||||
git reset --hard &&
|
||||
|
Loading…
Reference in New Issue
Block a user