@matheusbsbs / matheus-bagliano / commits / 1324fb6f16
Fork 0

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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Nov 12, 2008 at 03:23 UTC 1324fb6f161ee516eb4c597880847003a42c0c5d
2 files changed +4 -3
t/t7507-commit-verbose.sh
+1 -1
@@ -22,7 +22,7 @@ test_expect_success 'setup' '
22 git commit -F message
23 '
24
25 -test_expect_failure 'initial commit shows verbose diff' '
25 +test_expect_success 'initial commit shows verbose diff' '
26 git commit --amend -v
27 '
28
wt-status.c
+3 -2
@@ -279,7 +279,8 @@ static void wt_status_print_verbose(struct wt_status *s)
279 struct rev_info rev;
280
281 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);
284 rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
285 rev.diffopt.detect_rename = 1;
286 rev.diffopt.file = s->fp;
@@ -343,7 +344,7 @@ void wt_status_print(struct wt_status *s)
344 else if (s->commitable)
345 fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
346
346 - if (s->verbose && !s->is_initial)
347 + if (s->verbose)
348 wt_status_print_verbose(s);
349 if (!s->commitable) {
350 if (s->amend)