Skip to contentSkip to conversation

request-pull: avoid mentioning that the start point is a single commit

PATCH In review Miklos Vajna 3 participants 4 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 request-pull: avoid mentioning that the start point is a single commit

Previously we ran shortlog on the start commit which always printed "(1)" after the start commit, which gives no information, but makes the output less easy to read. Avoid doing so.

---

So for example the 'git request-pull master~2 . master' output diff is the following here:

The following changes since commit 68186857a9bb0a71e9456155623e02d398a5b817:
- Junio C Hamano (1):
- Merge branch 'il/maint-colon-address'
+ Junio C Hamano: Merge branch 'il/maint-colon-address'

are available in the git repository at:

 git-request-pull.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-request-pull.sh +1 -1
index 630cedd..8475919 100755
@@ -66,7 +66,7 @@ if [ -z "$branch" ]; then
 fi
 
 echo "The following changes since commit $baserev:"
-git shortlog --max-count=1 $baserev | sed -e 's/^\(.\)/  \1/'
+git log --max-count=1 --pretty=format:"  %an: %s%n%n" $baserev
 
 echo "are available in the git repository at:"
 echo
Signature · 1 line
1.6.6.1
Acked-by on v1 1/1
#1 lore raw
Quoted 6 lines · Miklos Vajna

Previously we ran shortlog on the start commit which always printed "(1)" after the start commit, which gives no information, but makes the output less easy to read. Avoid doing so.

---

Nice fix, that was annoying me too, but I didn't care enough to write a patch. :-)

Quoted 2 lines
git-request-pull.sh +1 -1
-git shortlog --max-count=1 $baserev | sed -e 's/^\(.\)/  \1/'
+git log --max-count=1 --pretty=format:"  %an: %s%n%n" $baserev
Signature · 1 line
Shawn.
#2 lore raw
In reply to Miklos Vajna
Quoted 25 lines · Miklos Vajna

Previously we ran shortlog on the start commit which always printed "(1)" after the start commit, which gives no information, but makes the output less easy to read. Avoid doing so.

---

So for example the 'git request-pull master~2 . master' output diff is the following here:

The following changes since commit 68186857a9bb0a71e9456155623e02d398a5b817:
- Junio C Hamano (1):
- Merge branch 'il/maint-colon-address'
+ Junio C Hamano: Merge branch 'il/maint-colon-address'

are available in the git repository at:

 git-request-pull.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
git-request-pull.sh +0 -0
index 630cedd..8475919 100755

git-request-pull.sh if [ -z "$branch" ]; then · line 69

Quoted 5 lines
git-request-pull.sh +1 -1
@@ -66,7 +66,7 @@ if [ -z "$branch" ]; then
 fi
 
 echo "The following changes since commit $baserev:"
-git shortlog --max-count=1 $baserev | sed -e 's/^\(.\)/  \1/'
+git log --max-count=1 --pretty=format:"  %an: %s%n%n" $baserev

A few comments:

- Modernising implementation by using tools different from what the original used (i.e. shortlog -> log) is fine, but I'd recommend doing so even more thoroughly. Use "show -s" instead of "log -1" and "--format=" instead of "--pretty=format:", for example.

- If the stated goal of the change is to remove " (1)" which is distracting with no useful information, remove that and only that, without changing anything else in the output.

- On the other hand, if you find that "AuthorName: " part is less useful in identifying the commit than its title to help the requestee, change the whole thing to make it even more useful.

So I'd suggest either:

	git show -s --format="  %an:%n        %s" $baserev

to be conservative, or

	git show -s --format="  %s (%an)" $baserev

or even to this:

	git show -s --format="  %s (%ci)" $baserev

I suspect that the last one would be the easiest for the requestee to judge the freshness of the branch.

Why isn't the "The following changes..." line not part of the --format thing, by the way? From the POV of readability of the code (not necessarily the output), doing it this way might be the cleanest:

-- >8 --
git show -s --format='The following changes since %H

    %s (%ci)

are available in the git repository at:' $baserev
echo " $url $branch"
-- 8< --

#3 lore raw

PATCH v2 1/1 request-pull: avoid mentioning that the start point is a single commit

Previously we ran shortlog on the start commit which always printed "(1)" after the start commit, which gives no information, but makes the output less easy to read. Avoid doing so.

---

Quoted 5 lines · Junio C Hamano

I suspect that the last one would be the easiest for the requestee to judge the freshness of the branch.

Why isn't the "The following changes..." line not part of the --format thing, by the way?

OK, I changed it accordingly, though I did not the change the output of the "commit <hash>" line. So the output diff is:

The following changes since commit 103209c6782586d92b04ee1fc71c0fd6f6385f5f:
- Junio C Hamano (1):
- Merge branch 'jc/maint-reflog-bad-timestamp'
+
+ Merge branch 'jc/maint-reflog-bad-timestamp' (2010-01-27 14:57:37 -0800)

are available in the git repository at:

 git-request-pull.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
git-request-pull.sh +4 -4
index 630cedd..8fd15f6 100755
@@ -65,11 +65,11 @@ if [ -z "$branch" ]; then
 	status=1
 fi
 
-echo "The following changes since commit $baserev:"
-git shortlog --max-count=1 $baserev | sed -e 's/^\(.\)/  \1/'
+git show -s --format='The following changes since commit %H:
 
-echo "are available in the git repository at:"
-echo
+  %s (%ci)
+
+are available in the git repository at:' $baserev
 echo "  $url $branch"
 echo
 
Signature · 1 line
1.6.6.1