request-pull: state what commit to expect
The message gives a detailed explanation of the commit the requester based the changes on, but lacks information that is necessary for the person who performs a fetch & merge in order to verify that the correct branch was fetched when responding to the pull request. Add a few more lines to describe the commit at the tip expected to be fetched to the same level of detail as the base commit. Also update the warning message slightly when the script notices that the commit may not have been pushed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano committed
Sep 16, 2011 at 11:37 UTC
cf7316663e2ae459591bc52f0a1c91c3a684e48b
2 files changed
+25
-15
git-request-pull.sh
+19
-15
@@ -35,7 +35,7 @@ do
35
shift
36
done
37
38
-base=$1 url=$2 head=${3-HEAD}
38
+base=$1 url=$2 head=${3-HEAD} status=0
39
40
test -n "$base" && test -n "$url" || usage
41
baserev=$(git rev-parse --verify "$base"^0) &&
@@ -51,25 +51,29 @@ find_matching_branch="/^$headrev "'refs\/heads\//{
51
}'
52
branch=$(git ls-remote "$url" | sed -n -e "$find_matching_branch")
53
url=$(git ls-remote --get-url "$url")
54
-if test -z "$branch"
55
-then
56
- echo "warn: No branch of $url is at:" >&2
57
- git log --max-count=1 --pretty='tformat:warn: %h: %s' $headrev >&2
58
- echo "warn: Are you sure you pushed $head there?" >&2
59
- echo >&2
60
- echo >&2
61
- branch=..BRANCH.NOT.VERIFIED..
62
- status=1
63
-fi
54
55
git show -s --format='The following changes since commit %H:
56
57
%s (%ci)
58
69
-are available in the git repository at:' $baserev &&
70
-echo " $url $branch" &&
71
-echo &&
59
+are available in the git repository at:
60
+' $baserev &&
61
+echo " $url${branch+ $branch}" &&
62
+git show -s --format='
63
+for you to fetch changes up to %H:
64
+
65
+ %s (%ci)
66
+
67
+----------------------------------------------------------------' $headrev &&
68
69
git shortlog ^$baserev $headrev &&
74
-git diff -M --stat --summary $patch $merge_base..$headrev || exit
70
+git diff -M --stat --summary $patch $merge_base..$headrev || status=1
71
+
72
+if test -z "$branch"
73
+then
74
+ echo "warn: No branch of $url is at:" >&2
75
+ git show -s --format='warn: %h: %s' $headrev >&2
76
+ echo "warn: Are you sure you pushed '$head' there?" >&2
77
+ status=1
78
+fi
79
exit $status
t/t5150-request-pull.sh
+6
@@ -193,8 +193,14 @@ test_expect_success 'pull request format' '
193
SUBJECT (DATE)
194
195
are available in the git repository at:
196
+
197
URL BRANCH
198
199
+ for you to fetch changes up to OBJECT_NAME:
200
+
201
+ SUBJECT (DATE)
202
+
203
+ ----------------------------------------------------------------
204
SHORTLOG
205
206
DIFFSTAT