summaryrefslogtreecommitdiff
path: root/t/annotate-tests.sh
diff options
context:
space:
mode:
authorEdmundo Carmona Antoranz <eantoranz@gmail.com>2015-11-17 19:20:09 -0600
committerJeff King <peff@peff.net>2015-11-20 08:02:06 -0500
commite0460ae8660f3205c4237d5c64e995d4081fdbf7 (patch)
treef9d8af32d5ce8f1cab5311f32935f54fbe46cf0b /t/annotate-tests.sh
parent0c83680e9c047170614fb08ef222ea4f460e514d (diff)
downloadgit-ec/annotate-deleted.tar.gz
annotate: skip checking working tree if a revision is providedec/annotate-deleted
If a file has been deleted/renamed, annotate refuses to work because the file does not exist on the working tree anymore (even if the path provided does match a blob on said revision). Signed-off-by: Edmundo Carmona Antoranz <eantoranz@gmail.com> Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 't/annotate-tests.sh')
-rw-r--r--t/annotate-tests.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh
index b1673b3e8f..c99ec416c5 100644
--- a/t/annotate-tests.sh
+++ b/t/annotate-tests.sh
@@ -567,3 +567,23 @@ test_expect_success 'blame -L X,-N (non-numeric N)' '
test_expect_success 'blame -L ,^/RE/' '
test_must_fail $PROG -L1,^/99/ file
'
+
+test_expect_success 'annotate deleted file' '
+ echo hello world > hello_world.txt &&
+ git add hello_world.txt &&
+ git commit -m "step 1" &&
+ git rm hello_world.txt &&
+ git commit -m "step 2" &&
+ git annotate hello_world.txt HEAD~1 &&
+ test_must_fail git annotate hello_world.txt
+'
+
+test_expect_success 'annotate moved file' '
+ echo hello world > hello_world.txt &&
+ git add hello_world.txt &&
+ git commit -m "step 1" &&
+ git mv hello_world.txt not_there_anymore.txt &&
+ git commit -m "step 2" &&
+ git annotate hello_world.txt HEAD~1 &&
+ test_must_fail git annotate hello_world.txt
+'