git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] upload-pack: Optionally allow fetching reachable sha1

From
Fredrik Medley <fredrik.medley@gmail.com>
Date
May 6, 2015, 20:10 UTC
Message-ID
<CABA5-zm-PxX-WWtoDnLhtJVZFhO2G1pOTApoz4DtmmUQ61iC6w@mail.gmail.com>
In-Reply-To
<xmqqmw1id610.fsf@gitster.dls.corp.google.com>
2015-05-06 0:16 GMT+02:00 Junio C Hamano <gitster@pobox.com>:
Show 21 quoted lines
> Fredrik Medley <fredrik.medley@gmail.com> writes:
>>
>> diff --git a/Documentation/config.txt b/Documentation/config.txt
>> index 2e5ceaf..76cd713 100644
>> --- a/Documentation/config.txt
>> +++ b/Documentation/config.txt
>> @@ -2538,6 +2538,12 @@ uploadpack.allowtipsha1inwant::
>>       of a hidden ref (by default, such a request is rejected).
>>       see also `uploadpack.hideRefs`.
>>
>> +uploadpack.allowreachablesha1inwant::
>
> I know that the existing allowtipsha1inwant is spelled that way, and
> it may be better done as a separate clean-up patch (either before or
> after this step), but the documentation and the first line of the
> log message would be easier to read with
>
>         uploadpack.allowReachableSHA1InWant
>
> I'd think.
>

I would prefer using allowReachableSha1InWant. Please tell me if I should use SHA1InWant instead of Sha1InWant. (I cannot find anything similar in the repository.)

Show 32 quoted lines
>
>> diff --git a/fetch-pack.c b/fetch-pack.c
>> index 48526aa..fb01b6c 100644
>> --- a/fetch-pack.c
>> +++ b/fetch-pack.c
>> @@ -43,7 +43,7 @@ static int marked;
>>  #define MAX_IN_VAIN 256
>>
>>  static struct prio_queue rev_list = { compare_commits_by_commit_date };
>> -static int non_common_revs, multi_ack, use_sideband, allow_tip_sha1_in_want;
>> +static int non_common_revs, multi_ack, use_sideband, allow_tip_sha1_in_want, allow_reachable_sha1_in_want;
>
> Do we anticipate need for other variations of "allowing bare SHA-1
> that they did not advertise" in the future?
>
> That is a trick question.  We didn't anticipate it, and that is why
> the existing feature squats on a whole integer variable.  And we are
> paying the price of that lack of foresight by having to enhance with
> this patch.  So the only sensible answer to that question is "we
> might need to keep this extensible".
>
> How about renaming the existing allow_tip_sha1_in_want to something
> more generic to cover all such needs, e.g.
>
>     #define ALLOW_TIP          01
>     #define ALLOW_REACHABLE    02
>     static int allow_request_with_bare_object_name;
>
> Then you do not have to write (tip || reachable), and more
> importantly, you do not have to force the next person to update that
> to (tip || reachable || his_new_kind), I would think.
>

I think the reasoning is sensible and I can see a possibility to allow non-reachable SHA1 in the future, even I would very much recommend against the use of such option for security reasons.

What I can understand, the capability protocol will still need both options as separate variables. (I forgot to update the technical documentation before will do that as well.)

Thank you all for quick replies.
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 34 in “upload-pack: Optionally allow fetching reachable sha1”
  1. upload-pack: Optionally allow fetching reachable sha1Fredrik Medley, May 2, 2015
  2. Junio C HamanoMay 3, 2015
  3. Fredrik MedleyMay 3, 2015
  4. Eric SunshineMay 3, 2015
  5. upload-pack: Optionally allow fetching reachable sha1Fredrik Medley, May 5, 2015
  6. Junio C HamanoMay 5, 2015
  7. Fredrik MedleyMay 6, 2015
  8. Junio C HamanoMay 6, 2015
  9. 1/3 config.txt: Clarify allowTipSHA1InWant with camelCaseFredrik Medley, May 12, 2015
  10. 2/3 upload-pack: Prepare to extend allow-tip-sha1-in-wantFredrik Medley, May 12, 2015
  11. Eric SunshineMay 12, 2015
  12. Junio C HamanoMay 12, 2015
  13. Fredrik MedleyMay 19, 2015
  14. 3/3 upload-pack: Optionally allow fetching reachable sha1Fredrik Medley, May 12, 2015
  15. Eric SunshineMay 12, 2015
  16. 1/3 config.txt: clarify allowTipSHA1InWant with camelCaseFredrik Medley, May 19, 2015
  17. 2/3 upload-pack: prepare to extend allow-tip-sha1-in-wantFredrik Medley, May 19, 2015
  18. Junio C HamanoMay 19, 2015
  19. Fredrik MedleyMay 20, 2015
  20. 3/3 upload-pack: optionally allow fetching reachable sha1Fredrik Medley, May 19, 2015
  21. Junio C HamanoMay 19, 2015
  22. 1/3 config.txt: clarify allowTipSHA1InWant with camelCaseFredrik Medley, May 21, 2015
  23. 2/3 upload-pack: prepare to extend allow-tip-sha1-in-wantFredrik Medley, May 21, 2015
  24. Junio C HamanoMay 21, 2015
  25. Fredrik MedleyMay 22, 2015
  26. Junio C HamanoMay 23, 2015
  27. 3/3 upload-pack: optionally allow fetching reachable sha1Fredrik Medley, May 21, 2015
  28. Junio C HamanoMay 21, 2015
  29. Fredrik MedleyMay 22, 2015
  30. Junio C HamanoMay 23, 2015
  31. Eric SunshineMay 12, 2015
  32. Junio C HamanoMay 12, 2015
  33. Junio C HamanoMay 12, 2015
  34. Eric SunshineMay 5, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.