Oddity in git commit summary
I just noticed that I got a strange summary from git commit -a --amend with the current master. It said:
Created commit f16cb29: Build in checkout
5 files changed, 482 insertions(+), 299 deletions(-) create mode 100644 builtin-checkout.c delete mode 100755 git-checkout.sh
But git show --stat says:
7 files changed, 780 insertions(+), 306 deletions(-)
And git show --stat -C says:
6 files changed, 482 insertions(+), 8 deletions(-)
The commit that I noticed this on is available from:
git://iabervon.org/~barkalow/git.git builtin-checkout
I've never particularly paid attention to this message before, so I don't know if it's saying something accurate I'm not understanding, or if it's actually inaccurate about what it's trying to show.
-Daniel
*This .sig left intentionally blank*
Quoted 8 lines · Daniel Barkalow
I just noticed that I got a strange summary from git commit -a --amend with the current master. It said:
Created commit f16cb29: Build in checkout
5 files changed, 482 insertions(+), 299 deletions(-) create mode 100644 builtin-checkout.c delete mode 100755 git-checkout.sh
Quoted 5 lines
But git show --stat says:
7 files changed, 780 insertions(+), 306 deletions(-)And git show --stat -C says:
6 files changed, 482 insertions(+), 8 deletions(-)
Because "git status" has -B -M and your second one does not pass any, I would not worry about the first two differences. But 5 vs 6 seems funny.
print_summary() is broken.
builtin-commit.c +2 -0
@@ -663,6 +665,8 @@ static void print_summary(const char *prefix, const unsigned char *sha1) rev.commit_format =get_commit_format ("format:%h: %s" ); rev.always_show_header =0 ; +diff_setup_done (&rev.diffopt); +printf ("Created %scommit " , initial_commit ?"initial " :"" );if (!log_tree_commit (&rev, commit)) {
PATCH 1/2 builtin-commit: fix summary output.
In reply to Daniel BarkalowBecause print_summary() forgot to call diff_setup_done() after futzing with diff output options, it failed to activate recursive diff, which resulted in an incorrect summary.
---
* This fixes the "5 files" problem you saw with your commit, which was totally bogus (it looked at "git diff-tree HEAD" output that was non-recursive, discarding the change of tree t/ itself). Now it will show "7 files" in line with your "git show".
builtin-commit.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
builtin-commit.c +1 -0
@@ -662,6 +662,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1) rev.show_root_diff =1 ; rev.commit_format =get_commit_format ("format:%h: %s" ); rev.always_show_header =0 ; +diff_setup_done (&rev.diffopt);printf ("Created %scommit " , initial_commit ?"initial " :"" );
Signature · 1 line
1.5.4.rc0.52.gb90ce
PATCH 2/2 builtin-commit: make summary output consistent with status
In reply to Daniel BarkalowThis enables -B -M to the summary output after a commit is made so that it is in line with what is shown in git-status and commit log template.
---
* And this fixes the "7 files" because print_summary() does not pass -B -M which makes it inconsistent with the status output. After this you should see "6 files".
builtin-commit.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
builtin-commit.c +3 -0
@@ -662,6 +662,9 @@ static void print_summary(const char *prefix, const unsigned char *sha1) rev.show_root_diff =1 ; rev.commit_format =get_commit_format ("format:%h: %s" ); rev.always_show_header =0 ; + rev.diffopt.detect_rename =1 ; + rev.diffopt.rename_limit =100 ; + rev.diffopt.break_opt =0 ;diff_setup_done (&rev.diffopt);printf ("Created %scommit " , initial_commit ?"initial " :"" );
Signature · 1 line
1.5.4.rc0.52.gb90ce
Re: [PATCH 2/2] builtin-commit: make summary output consistent with status
Quoted 3 lines · Junio C Hamano
* And this fixes the "7 files" because
print_summary()does not pass -B -M which makes it inconsistent with the status output. After this you should see "6 files".
Yup, it now looks like what I thought that commit consisted of.
-Daniel
*This .sig left intentionally blank*