diff options
author | Jacob Keller <jacob.keller@gmail.com> | 2023-04-24 22:35:08 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-04-25 01:16:31 +0300 |
commit | 603d0fdce2ca84d4dc7b26e46430778fe9c4cb72 (patch) | |
tree | 2e9694d9986637e357ad3191f21659cabee73077 /blame.c | |
parent | 7580f92ffa970b9484ac214f7b53cec5e26ca4bc (diff) |
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 'blame.c')
-rw-r--r-- | blame.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -206,8 +206,12 @@ static struct commit *fake_working_tree_commit(struct repository *r, origin = make_origin(commit, path); - ident = fmt_ident("Not Committed Yet", "not.committed.yet", - WANT_BLANK_IDENT, NULL, 0); + if (contents_from) + ident = fmt_ident("External file (--contents)", "external.file", + WANT_BLANK_IDENT, NULL, 0); + else + ident = fmt_ident("Not Committed Yet", "not.committed.yet", + WANT_BLANK_IDENT, NULL, 0); strbuf_addstr(&msg, "tree 0000000000000000000000000000000000000000\n"); for (parent = commit->parents; parent; parent = parent->next) strbuf_addf(&msg, "parent %s\n", |