threads / patch / 28317

patchState what commit to expect in request-pull

Subject: [PATCH] State what commit to expect in request-pull

## tl;dr

2 messages between Sep 6, 2011 and Sep 6, 2011. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Junio C Hamano· Sep 6, 2011, 21:24 UTC · lore

Interestingly, we did say what commit the requesters based their changes on, but did not give the person who performs a fetch & merge to make sure he fetched the right branch.

This fixes it.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-request-pull.sh     |    1 +
 t/t5150-request-pull.sh |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
Show changes to 2 files +2 −0

git-request-pull.sh, t/t5150-request-pull.sh

diff --git a/git-request-pull.sh b/git-request-pull.sh
index fc080cc..9b06a87 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -71,6 +71,7 @@ git show -s --format='The following changes since commit %H:
 
 are available in the git repository at:' $baserev &&
 echo "  $url $branch" &&
+echo "for you to fetch changes up to $headrev"
 echo &&
 
 git shortlog ^$baserev $headrev &&
diff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh
index 9cc0a42..9d27c43 100755
--- a/t/t5150-request-pull.sh
+++ b/t/t5150-request-pull.sh
@@ -194,6 +194,7 @@ test_expect_success 'pull request format' '
 
 	are available in the git repository at:
 	  URL BRANCH
+	for you to fetch changes up to OBJECT_NAME
 
 	SHORTLOG
 
Shawn Pearce· Sep 6, 2011, 21:58 UTC · re: Junio C Hamano · lore

Re: [PATCH] State what commit to expect in request-pull

On Tue, Sep 6, 2011 at 14:24, Junio C Hamano <gitster@pobox.com> wrote:
> Interestingly, we did say what commit the requesters based their changes
> on, but did not give the person who performs a fetch & merge to make sure
> he fetched the right branch.
...
Show 7 quoted lines
> diff --git a/git-request-pull.sh b/git-request-pull.sh
> @@ -71,6 +71,7 @@ git show -s --format='The following changes since commit %H:
>
>  are available in the git repository at:' $baserev &&
>  echo "  $url $branch" &&
> +echo "for you to fetch changes up to $headrev"
>  echo &&

Better than what we had before. I was sort of hoping for changing the pull line slightly to include the SHA-1. E.g. suppose instead the line was:

  echo "  $url $headrev"

and git pull passed the $headrev down to git fetch, which then found any reference that points exactly at $headrev and fetches that. The branch name is now lost for the merge summary, but could be guessed from the advertisement similar to how HEAD is guessed. Git pull could also then validate that the commit its merging in FETCH_HEAD is what was passed on the command line.

Then verification of the SHA-1 is automatic by Git, and doesn't require a human. If the pull request was sent by GPG signed email, and the MUA checked the signature, the puller has pretty reasonable assurance over the content they are bringing into their repository.

-- 
Shawn.

← back to recent threads