summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2008-11-12 08:23:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-11-12 21:55:17 (GMT)
commit1324fb6f161ee516eb4c597880847003a42c0c5d (patch)
tree1fcaa3fc04ae1b898eefeb78075e6b1aefdcc6c0
parent4deca329f5da1552c8d087975dd5107519cabef7 (diff)
downloadgit-1324fb6f161ee516eb4c597880847003a42c0c5d.zip
git-1324fb6f161ee516eb4c597880847003a42c0c5d.tar.gz
git-1324fb6f161ee516eb4c597880847003a42c0c5d.tar.bz2
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>
-rwxr-xr-xt/t7507-commit-verbose.sh2
-rw-r--r--wt-status.c5
2 files changed, 4 insertions, 3 deletions
diff --git a/t/t7507-commit-verbose.sh b/t/t7507-commit-verbose.sh
index 519adba..da5bd3b 100755
--- a/t/t7507-commit-verbose.sh
+++ b/t/t7507-commit-verbose.sh
@@ -22,7 +22,7 @@ test_expect_success 'setup' '
git commit -F message
'
-test_expect_failure 'initial commit shows verbose diff' '
+test_expect_success 'initial commit shows verbose diff' '
git commit --amend -v
'
diff --git a/wt-status.c b/wt-status.c
index cb1fc48..ec91fba 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -279,7 +279,8 @@ static void wt_status_print_verbose(struct wt_status *s)
struct rev_info rev;
init_revisions(&rev, NULL);
- setup_revisions(0, NULL, &rev, s->reference);
+ setup_revisions(0, NULL, &rev,
+ s->is_initial ? EMPTY_TREE_SHA1_HEX : s->reference);
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
rev.diffopt.detect_rename = 1;
rev.diffopt.file = s->fp;
@@ -343,7 +344,7 @@ void wt_status_print(struct wt_status *s)
else if (s->commitable)
fprintf(s->fp, "# Untracked files not listed (use -u option to show untracked files)\n");
- if (s->verbose && !s->is_initial)
+ if (s->verbose)
wt_status_print_verbose(s);
if (!s->commitable) {
if (s->amend)