git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Oddity in git commit summary
@ 2007-12-15 20:29 Daniel Barkalow
  2007-12-16 23:01 ` Junio C Hamano
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Daniel Barkalow @ 2007-12-15 20:29 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

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*

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Oddity in git commit summary
  2007-12-15 20:29 Oddity in git commit summary Daniel Barkalow
@ 2007-12-16 23:01 ` Junio C Hamano
  2007-12-16 23:11 ` [PATCH 1/2] builtin-commit: fix summary output Junio C Hamano
  2007-12-16 23:12 ` [PATCH 2/2] builtin-commit: make summary output consistent with status Junio C Hamano
  2 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2007-12-16 23:01 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: git

Daniel Barkalow <barkalow@iabervon.org> writes:

> 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(-)

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.

diff --git a/builtin-commit.c b/builtin-commit.c
index 518ebe0..8435702 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -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)) {

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/2] builtin-commit: fix summary output.
  2007-12-15 20:29 Oddity in git commit summary Daniel Barkalow
  2007-12-16 23:01 ` Junio C Hamano
@ 2007-12-16 23:11 ` Junio C Hamano
  2007-12-16 23:12 ` [PATCH 2/2] builtin-commit: make summary output consistent with status Junio C Hamano
  2 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2007-12-16 23:11 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: git

Because 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.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * 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(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index 518ebe0..61770ef 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -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 " : "");
 
-- 
1.5.4.rc0.52.gb90ce

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] builtin-commit: make summary output consistent with status
  2007-12-15 20:29 Oddity in git commit summary Daniel Barkalow
  2007-12-16 23:01 ` Junio C Hamano
  2007-12-16 23:11 ` [PATCH 1/2] builtin-commit: fix summary output Junio C Hamano
@ 2007-12-16 23:12 ` Junio C Hamano
  2007-12-17  3:42   ` Daniel Barkalow
  2 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2007-12-16 23:12 UTC (permalink / raw)
  To: Daniel Barkalow; +Cc: git

This 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.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * 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(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index 61770ef..0a91013 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -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 " : "");
-- 
1.5.4.rc0.52.gb90ce

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] builtin-commit: make summary output consistent with status
  2007-12-16 23:12 ` [PATCH 2/2] builtin-commit: make summary output consistent with status Junio C Hamano
@ 2007-12-17  3:42   ` Daniel Barkalow
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Barkalow @ 2007-12-17  3:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Sun, 16 Dec 2007, Junio C Hamano wrote:

>  * 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*

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-12-17  3:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-15 20:29 Oddity in git commit summary Daniel Barkalow
2007-12-16 23:01 ` Junio C Hamano
2007-12-16 23:11 ` [PATCH 1/2] builtin-commit: fix summary output Junio C Hamano
2007-12-16 23:12 ` [PATCH 2/2] builtin-commit: make summary output consistent with status Junio C Hamano
2007-12-17  3:42   ` Daniel Barkalow

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).