Re: [PATCH] display shortlog after git-commit

6 messages, 2 authors, 2016-06-15 · open the first message on its own page

Re: [PATCH] display shortlog after git-commit

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:04

"Michael S. Tsirkin" [off-list ref] writes:
Display the subject of the commit just made.
WHY?  You just made the commit.
quoted
Quoting Junio C Hamano [off-list ref]:
Subject: Re: [PATCH] display shortlog after git-commit

Too noisy for a default.
So maybe the following isn't too bad?
This results in:
$ ./git-commit.sh --amend
Created commit 5633ddde0e35210f607bde063bcbf709e4d20a8d
Display the subject of the commit just made.
 1 files changed, 1 insertions(+), 1 deletions(-)
I think this is still one line too many.  It _might_ be an
improvement if it were

    $ ./git-commit.sh --amend
    Created commit 5633ddde: Display the subject of the commit just made.
     1 files changed, 1 insertions(+), 1 deletions(-)

though...

[PATCH] display the subject of the commit just made

From: Michael S. Tsirkin <hidden>
Date: 2016-06-15 22:43:04

Useful e.g. to figure out what I did from screen history,
or to make sure subject line is short enough and makes sense
on its own.

Signed-off-by: Michael S. Tsirkin <redacted>

---
WHY?  You just made the commit.
Hopefully answered above.
This also gets rid of the only user of --no-commit-id, so we
should be able to deprecate this in the future in favor of
--pretty=format:
quoted
quoted
Quoting Junio C Hamano [off-list ref]:
Subject: Re: [PATCH] display shortlog after git-commit

Too noisy for a default.
So maybe the following isn't too bad?
This results in:
$ ./git-commit.sh --amend
Created commit 5633ddde0e35210f607bde063bcbf709e4d20a8d
Display the subject of the commit just made.
 1 files changed, 1 insertions(+), 1 deletions(-)
I think this is still one line too many.  It _might_ be an
improvement if it were

    $ ./git-commit.sh --amend
    Created commit 5633ddde: Display the subject of the commit just made.
     1 files changed, 1 insertions(+), 1 deletions(-)

though...
Better?
diff --git a/git-commit.sh b/git-commit.sh
index 9e0959a..32257b0 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -649,8 +649,9 @@ then
 	fi
 	if test -z "$quiet"
 	then
+		commit=`git-diff-tree --shortstat --pretty="format:%h: %s"\
+		       --summary --root HEAD --`
 		echo "Created${initial_commit:+ initial} commit $commit"
-		git-diff-tree --shortstat --summary --root --no-commit-id HEAD --
 	fi
 fi
 
 
-- 
MST

Re: [PATCH] display the subject of the commit just made

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:04

"Michael S. Tsirkin" [off-list ref] writes:
quoted hunk
Better?
diff --git a/git-commit.sh b/git-commit.sh
index 9e0959a..32257b0 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -649,8 +649,9 @@ then
 	fi
 	if test -z "$quiet"
 	then
+		commit=`git-diff-tree --shortstat --pretty="format:%h: %s"\
+		       --summary --root HEAD --`
 		echo "Created${initial_commit:+ initial} commit $commit"
-		git-diff-tree --shortstat --summary --root --no-commit-id HEAD --
 	fi
 fi
Close but no cigar.  You broke it for a merge commit, I think.

Perhaps

	pretty="format:Created${initial_commit:+ initial} commit %h: %s%n"
	git-diff-tree --always --shortstart --summary --root --pretty="$pretty" HEAD

Re: [PATCH] display shortlog after git-commit

From: Michael S. Tsirkin <hidden>
Date: 2016-06-15 22:43:04

Quoting Junio C Hamano [off-list ref]:
Subject: Re: [PATCH] display shortlog after git-commit

"Michael S. Tsirkin" [off-list ref] writes:
quoted
Display the subject of the commit just made.
WHY?  You just made the commit.
BTW, Junio, why does git-commit need to display the diffstat?
You just made the commit ...

-- 
MST

Re: [PATCH] display the subject of the commit just made

From: Michael S. Tsirkin <hidden>
Date: 2016-06-15 22:43:04

Quoting Junio C Hamano [off-list ref]:
Subject: Re: [PATCH] display the subject of the commit just made

"Michael S. Tsirkin" [off-list ref] writes:
quoted
Better?
diff --git a/git-commit.sh b/git-commit.sh
index 9e0959a..32257b0 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -649,8 +649,9 @@ then
 	fi
 	if test -z "$quiet"
 	then
+		commit=`git-diff-tree --shortstat --pretty="format:%h: %s"\
+		       --summary --root HEAD --`
 		echo "Created${initial_commit:+ initial} commit $commit"
-		git-diff-tree --shortstat --summary --root --no-commit-id HEAD --
 	fi
 fi
Close but no cigar.  You broke it for a merge commit, I think.
Yes, you are right.
Perhaps

	pretty="format:Created${initial_commit:+ initial} commit %h: %s%n"
	git-diff-tree --always --shortstart --summary --root --pretty="$pretty" HEAD
Aha, --always should do the trick. I'll check this.
BTW, a couple of questions:
1. do we really need the shortstat info?
2. why is there "--" at the end do in the original version?

-- 
MST

Re: [PATCH] display the subject of the commit just made

From: Michael S. Tsirkin <hidden>
Date: 2016-06-15 22:43:04

Display the subject of the commit just made.

Useful e.g. to figure out what I did from screen history,
or to make sure subject line is short enough and makes sense
on its own.

Signed-off-by: Michael S. Tsirkin <redacted>

---
Quoting Junio C Hamano [off-list ref]:
Close but no cigar.  You broke it for a merge commit, I think.

Perhaps

	pretty="format:Created${initial_commit:+ initial} commit %h: %s%n"
	git-diff-tree --always --shortstart --summary --root --pretty="$pretty" HEAD
OK, thanks fo rpointing this out.
But why the extra %n at the end? The following seems to work well for me:
diff --git a/git-commit.sh b/git-commit.sh
index 9e0959a..f28fc24 100755
--- a/git-commit.sh
+++ b/git-commit.sh
@@ -649,8 +649,9 @@ then
 	fi
 	if test -z "$quiet"
 	then
+		commit=`git-diff-tree --always --shortstat --pretty="format:%h: %s"\
+		       --summary --root HEAD --`
 		echo "Created${initial_commit:+ initial} commit $commit"
-		git-diff-tree --shortstat --summary --root --no-commit-id HEAD --
 	fi
 fi
 
-- 
MST
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help