Skip to content

Commit 1324fb6

Browse files
peffgitster
authored andcommitted
status: show "-v" diff even for initial commit
Since we can use the same "diff against empty tree" trick as we do for the non-initial case, it is trivial to make this work. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4deca32 commit 1324fb6

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

t/t7507-commit-verbose.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ test_expect_success 'setup' '
2222
git commit -F message
2323
'
2424

25-
test_expect_failure 'initial commit shows verbose diff' '
25+
test_expect_success 'initial commit shows verbose diff' '
2626
git commit --amend -v
2727
'
2828

wt-status.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,8 @@ static void wt_status_print_verbose(struct wt_status *s)
279279
struct rev_info rev;
280280

281281
init_revisions(&rev, NULL);
282-
setup_revisions(0, NULL, &rev, s->reference);
282+
setup_revisions(0, NULL, &rev,
283+
s->is_initial ? EMPTY_TREE_SHA1_HEX : s->reference);
283284
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
284285
rev.diffopt.detect_rename = 1;
285286
rev.diffopt.file = s->fp;
@@ -343,7 +344,7 @@ void wt_status_print(struct wt_status *s)
343344
else if (s->commitable)
344345
fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
345346

346-
if (s->verbose && !s->is_initial)
347+
if (s->verbose)
347348
wt_status_print_verbose(s);
348349
if (!s->commitable) {
349350
if (s->amend)

0 commit comments

Comments
 (0)