diff options
author | Jacob Keller <jacob.keller@gmail.com> | 2023-04-24 21:35:08 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-04-25 00:16:31 +0200 |
commit | 603d0fdce2ca84d4dc7b26e46430778fe9c4cb72 (patch) | |
tree | 2e9694d9986637e357ad3191f21659cabee73077 /t | |
parent | The twelfth batch (diff) | |
download | git-603d0fdce2ca84d4dc7b26e46430778fe9c4cb72.tar.xz git-603d0fdce2ca84d4dc7b26e46430778fe9c4cb72.zip |
blame: use different author name for fake commit generated by --contents
When the --contents option is used with git blame, and the contents of
the file have lines which can't be annotated by the history being
blamed, the user will see an author of "Not Committed Yet". This is
similar to the way blame handles working tree contents when blaming
without a revision.
This is slightly confusing since this data isn't the working copy and
while it is technically "not committed yet", its also coming from an
external file. Replace this author name with "External file
(--contents)" to better differentiate such lines from actual working
copy lines.
Suggested-by: Junio C Hamano <gitster@pobox.com>
Suggested-by: Glen Choo <chooglen@google.com>
Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rw-r--r-- | t/annotate-tests.sh | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/t/annotate-tests.sh b/t/annotate-tests.sh index b35be20cf3..2ef70235b1 100644 --- a/t/annotate-tests.sh +++ b/t/annotate-tests.sh @@ -72,6 +72,13 @@ test_expect_success 'blame 1 author' ' check_count A 2 ' +test_expect_success 'blame working copy' ' + test_when_finished "git restore file" && + echo "1A quick brown fox jumps over the" >file && + echo "another lazy dog" >>file && + check_count A 1 "Not Committed Yet" 1 +' + test_expect_success 'blame with --contents' ' check_count --contents=file A 2 ' @@ -79,7 +86,7 @@ test_expect_success 'blame with --contents' ' test_expect_success 'blame with --contents changed' ' echo "1A quick brown fox jumps over the" >contents && echo "another lazy dog" >>contents && - check_count --contents=contents A 1 "Not Committed Yet" 1 + check_count --contents=contents A 1 "External file (--contents)" 1 ' test_expect_success 'blame in a bare repo without starting commit' ' @@ -109,7 +116,7 @@ test_expect_success 'blame 2 authors' ' ' test_expect_success 'blame with --contents and revision' ' - check_count -h testTag --contents=file A 2 "Not Committed Yet" 2 + check_count -h testTag --contents=file A 2 "External file (--contents)" 2 ' test_expect_success 'setup B1 lines (branch1)' ' |