git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Fredrik Medley <fredrik.medley@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org,
	Christian Halstrick <christian.halstrick@gmail.com>,
	Dan Johnson <computerdruid@gmail.com>, Jeff King <peff@peff.net>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Duy Nguyen <pclouds@gmail.com>
Subject: Re: [PATCH v5 3/3] upload-pack: optionally allow fetching reachable sha1
Date: Sat, 23 May 2015 01:55:12 +0200	[thread overview]
Message-ID: <CABA5-zm3LqA+BAHj0EegoXmTuaNobhEHyD0v2kg=VfCzzqx-+A@mail.gmail.com> (raw)
In-Reply-To: <xmqqioblh91w.fsf@gitster.dls.corp.google.com>

2015-05-22 0:15 GMT+02:00 Junio C Hamano <gitster@pobox.com>:
> Fredrik Medley <fredrik.medley@gmail.com> writes:
>
>> --- a/Documentation/technical/protocol-capabilities.txt
>> +++ b/Documentation/technical/protocol-capabilities.txt
>> @@ -260,6 +260,13 @@ If the upload-pack server advertises this capability, fetch-pack may
>>  send "want" lines with SHA-1s that exist at the server but are not
>>  advertised by upload-pack.
>>
>> +allow-reachable-sha1-in-want
>> +----------------------
>
> This is an underline applied to one line prior, and their length
> must match.  I'll amend while applying (attached at end), so there
> is no need to resend with correction unless you have other reasons
> to do so.
>
>> diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
>> index 8a5f236..fdcc114 100755
>> --- a/t/t5516-fetch-push.sh
>> +++ b/t/t5516-fetch-push.sh
>> @@ -1120,6 +1120,61 @@ test_expect_success 'fetch exact SHA1' '
>>       )
>>  '
>
> It looks like this new set of tests are well thought out; good job.
>
> I spotted a few minor nits, though.  All I'll amend while applying
> so there is no need to resend only to correct them.

I agree on all your comments and your proposed amendment further down
looks good.
Should the test code contain the explanations you've written in this email?

>
>> +for configallowtipsha1inwant in true false
>> +do
>> +     test_expect_success "shallow fetch reachable SHA1 (but not a ref), allowtipsha1inwant=$configallowtipsha1inwant" '
>> +             mk_empty testrepo &&
>> +             (
>> +                     cd testrepo &&
>> +                     git config uploadpack.allowtipsha1inwant $configallowtipsha1inwant &&
>> +                     git commit --allow-empty -m foo &&
>> +                     git commit --allow-empty -m bar
>> +             ) &&
>> +             SHA1=$(git --git-dir=testrepo/.git rev-parse HEAD^) &&
>> +             mk_empty shallow &&
>> +             (
>> +                     cd shallow &&
>> +                     test_must_fail git fetch --depth=1 ../testrepo/.git $SHA1 &&
>
> This tries to fetch one before the tip with "allowTipSHA1InWant" set
> to true or false; either should fail.  Good.
>
>> +                     git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true &&
>> +                     git fetch --depth=1 ../testrepo/.git $SHA1 &&
>
> And regardless of allowTip setting, with allowReachable set to true,
> fetching the reachable HEAD^ would succeed.  Good.
>
>> +                     git cat-file commit $SHA1 >/dev/null
>
> Minor nit; drop ">/dev/null", as test framework will squelch the
> output by default, and when the test is run with "-v" option, the
> output would help debugging the script.
>
>> +             )
>> +     '
>> +
>> +     test_expect_success "deny fetch unreachable SHA1, allowtipsha1inwant=$configallowtipsha1inwant" '
>> +             mk_empty testrepo &&
>> +             (
>> +                     cd testrepo &&
>> +                     git config uploadpack.allowtipsha1inwant $configallowtipsha1inwant &&
>> +                     git commit --allow-empty -m foo &&
>> +                     git commit --allow-empty -m bar &&
>> +                     git commit --allow-empty -m xyz
>> +             )
>
> Broken && chain
>
>> +             SHA1_1=$(git --git-dir=testrepo/.git rev-parse HEAD^^) &&
>> +             SHA1_2=$(git --git-dir=testrepo/.git rev-parse HEAD^) &&
>> +             SHA1_3=$(git --git-dir=testrepo/.git rev-parse HEAD) &&
>> +             (
>> +                     cd testrepo &&
>> +                     git reset --hard $SHA1_2 &&
>
> We have one before the tip (SHA1_1), one after the tip and no longer
> reachable (SHA1_3); SHA1_2 is sitting at the tip of a ref.
>
>> +                     git cat-file commit $SHA1_3 >/dev/null &&
>> +                     git cat-file commit $SHA1_3 >/dev/null
>
> I think one of the latter two is $SHA1_1, i.e. you make sure SHA1_{1,2,3}
> are there in testrepo.

Yes, that was intended.

>
>> +             ) &&
>> +             mk_empty shallow &&
>> +             (
>> +                     cd shallow &&
>> +                     test_must_fail git fetch ../testrepo/.git $SHA1_3 &&
>> +                     test_must_fail git fetch ../testrepo/.git $SHA1_1 &&
>
> With allowTip only, whether it is set to true or false, fetching _1
> or _3 that are not at tip will fail.  Good.
>
>> +                     git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true &&
>> +                     git fetch ../testrepo/.git $SHA1_1 &&
>> +                     git cat-file commit $SHA1_1 >/dev/null &&
>
> With allowReachable, _1 which is reachable from tip is possible,
> regardless of the setting of allowTip.  Good.
>
>> +                     test_must_fail git cat-file commit $SHA1_2 >/dev/null &&
>
> And fetching _1 will not pull in _2, which is _1's child, that we
> did not ask for.  Good (but it is probably not very relevant for the
> purpose of these tests).
>
>> +                     git fetch ../testrepo/.git $SHA1_2 &&
>> +                     git cat-file commit $SHA1_2 >/dev/null &&
>
> And of course, _2 can be fetched.
>
>> +                     test_must_fail git fetch ../testrepo/.git $SHA1_3
>
> And _3 that is not reachable cannot.
>
>> +             )
>> +     '
>> +done
>
> Again, very carefully covering combinations.  Good.
>
>
>
>
>  Documentation/technical/protocol-capabilities.txt |  2 +-
>  t/t5516-fetch-push.sh                             | 14 +++++++-------
>  2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/Documentation/technical/protocol-capabilities.txt b/Documentation/technical/protocol-capabilities.txt
> index 265fcab..eaab6b4 100644
> --- a/Documentation/technical/protocol-capabilities.txt
> +++ b/Documentation/technical/protocol-capabilities.txt
> @@ -261,7 +261,7 @@ send "want" lines with SHA-1s that exist at the server but are not
>  advertised by upload-pack.
>
>  allow-reachable-sha1-in-want
> -----------------------
> +----------------------------
>
>  If the upload-pack server advertises this capability, fetch-pack may
>  send "want" lines with SHA-1s that exist at the server but are not
> diff --git a/t/t5516-fetch-push.sh b/t/t5516-fetch-push.sh
> index fdcc114..ec22c98 100755
> --- a/t/t5516-fetch-push.sh
> +++ b/t/t5516-fetch-push.sh
> @@ -1137,7 +1137,7 @@ do
>                         test_must_fail git fetch --depth=1 ../testrepo/.git $SHA1 &&
>                         git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true &&
>                         git fetch --depth=1 ../testrepo/.git $SHA1 &&
> -                       git cat-file commit $SHA1 >/dev/null
> +                       git cat-file commit $SHA1
>                 )
>         '
>
> @@ -1149,15 +1149,15 @@ do
>                         git commit --allow-empty -m foo &&
>                         git commit --allow-empty -m bar &&
>                         git commit --allow-empty -m xyz
> -               )
> +               ) &&
>                 SHA1_1=$(git --git-dir=testrepo/.git rev-parse HEAD^^) &&
>                 SHA1_2=$(git --git-dir=testrepo/.git rev-parse HEAD^) &&
>                 SHA1_3=$(git --git-dir=testrepo/.git rev-parse HEAD) &&
>                 (
>                         cd testrepo &&
>                         git reset --hard $SHA1_2 &&
> -                       git cat-file commit $SHA1_3 >/dev/null &&
> -                       git cat-file commit $SHA1_3 >/dev/null
> +                       git cat-file commit $SHA1_1 &&
> +                       git cat-file commit $SHA1_3
>                 ) &&
>                 mk_empty shallow &&
>                 (
> @@ -1166,10 +1166,10 @@ do
>                         test_must_fail git fetch ../testrepo/.git $SHA1_1 &&
>                         git --git-dir=../testrepo/.git config uploadpack.allowreachablesha1inwant true &&
>                         git fetch ../testrepo/.git $SHA1_1 &&
> -                       git cat-file commit $SHA1_1 >/dev/null &&
> -                       test_must_fail git cat-file commit $SHA1_2 >/dev/null &&
> +                       git cat-file commit $SHA1_1 &&
> +                       test_must_fail git cat-file commit $SHA1_2 &&
>                         git fetch ../testrepo/.git $SHA1_2 &&
> -                       git cat-file commit $SHA1_2 >/dev/null &&
> +                       git cat-file commit $SHA1_2 &&
>                         test_must_fail git fetch ../testrepo/.git $SHA1_3
>                 )
>         '
> --
> 2.4.1-439-gcfa393f
>

  reply	other threads:[~2015-05-22 23:55 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-02 22:01 [PATCH] upload-pack: Optionally allow fetching reachable sha1 Fredrik Medley
2015-05-03 17:40 ` Junio C Hamano
2015-05-03 20:13   ` Fredrik Medley
2015-05-03 21:35     ` Eric Sunshine
2015-05-05 21:21 ` [PATCH v2] " Fredrik Medley
2015-05-05 22:16   ` Junio C Hamano
2015-05-06 20:10     ` Fredrik Medley
2015-05-06 20:19       ` Junio C Hamano
2015-05-12 21:14         ` [PATCH 1/3] config.txt: Clarify allowTipSHA1InWant with camelCase Fredrik Medley
2015-05-12 21:14           ` [PATCH 2/3] upload-pack: Prepare to extend allow-tip-sha1-in-want Fredrik Medley
2015-05-12 21:37             ` Eric Sunshine
2015-05-12 21:39             ` Junio C Hamano
2015-05-19 20:19               ` Fredrik Medley
2015-05-12 21:14           ` [PATCH 3/3] upload-pack: Optionally allow fetching reachable sha1 Fredrik Medley
2015-05-12 22:01             ` Eric Sunshine
2015-05-19 20:44               ` [PATCH 1/3] config.txt: clarify allowTipSHA1InWant with camelCase Fredrik Medley
2015-05-19 20:44                 ` [PATCH 2/3] upload-pack: prepare to extend allow-tip-sha1-in-want Fredrik Medley
2015-05-19 22:00                   ` Junio C Hamano
2015-05-20 19:31                     ` Fredrik Medley
2015-05-19 20:44                 ` [PATCH 3/3] upload-pack: optionally allow fetching reachable sha1 Fredrik Medley
2015-05-19 22:06                   ` Junio C Hamano
2015-05-21 20:23                 ` [PATCH v5 1/3] config.txt: clarify allowTipSHA1InWant with camelCase Fredrik Medley
2015-05-21 20:23                   ` [PATCH v5 2/3] upload-pack: prepare to extend allow-tip-sha1-in-want Fredrik Medley
2015-05-21 22:07                     ` Junio C Hamano
2015-05-22 23:47                       ` Fredrik Medley
2015-05-23  0:53                         ` Junio C Hamano
2015-05-21 20:23                   ` [PATCH v5 3/3] upload-pack: optionally allow fetching reachable sha1 Fredrik Medley
2015-05-21 22:15                     ` Junio C Hamano
2015-05-22 23:55                       ` Fredrik Medley [this message]
2015-05-23  1:01                         ` Junio C Hamano
2015-05-12 21:24           ` [PATCH 1/3] config.txt: Clarify allowTipSHA1InWant with camelCase Eric Sunshine
2015-05-12 21:33             ` Junio C Hamano
2015-05-12 21:35           ` Junio C Hamano
2015-05-05 22:29   ` [PATCH v2] upload-pack: Optionally allow fetching reachable sha1 Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABA5-zm3LqA+BAHj0EegoXmTuaNobhEHyD0v2kg=VfCzzqx-+A@mail.gmail.com' \
    --to=fredrik.medley@gmail.com \
    --cc=christian.halstrick@gmail.com \
    --cc=computerdruid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).