@@ -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.)
Keep in mind what was discussed recently:
http://thread.gmane.org/gmane.comp.version-control.git/265225/focus=265322
I would think SHA1 should be upcased (so should SSL, SMTP, etc.)
even in the existing ones when we do the "clean-up" pass. Even
though this patch is not about cleaning up existing mess, there
is no point adding more cruft that we need to clean up later ;-)
From: Fredrik Medley <hidden> Date: 2016-06-15 23:04:44
Most of the options in config.txt are camelCase. Improve the readability
for allowtipsha1inwant by changing to allowTipSHA1InWant.
---
Documentation/config.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -2530,9 +2530,9 @@ uploadpack.hideRefs:: are under the hierarchies listed on the value of this variable is excluded, and is hidden from `git ls-remote`, `git fetch`, etc. An attempt to fetch a hidden ref by `git- fetch` will fail. See also `uploadpack.allowtipsha1inwant`.+ fetch` will fail. See also `uploadpack.allowTipSHA1InWant`.-uploadpack.allowtipsha1inwant::+uploadpack.allowTipSHA1InWant:: When `uploadpack.hideRefs` is in effect, allow `upload-pack` to accept a fetch request that asks for an object at the tip of a hidden ref (by default, such a request is rejected).
@@ -43,7 +43,10 @@ static int marked;#define MAX_IN_VAIN 256staticstructprio_queuerev_list={compare_commits_by_commit_date};-staticintnon_common_revs,multi_ack,use_sideband,allow_tip_sha1_in_want;+staticintnon_common_revs,multi_ack,use_sideband;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP 01+staticintallow_request_with_bare_object_name;staticvoidrev_list_push(structcommit*commit,intmark){
@@ -542,7 +545,7 @@ static void filter_refs(struct fetch_pack_args *args,}/* Append unmatched requests to the list */-if(allow_tip_sha1_in_want){+if(allow_request_with_bare_object_name&ALLOW_TIP){for(i=0;i<nr_sought;i++){unsignedcharsha1[20];
@@ -35,7 +35,9 @@ static int multi_ack;staticintno_done;staticintuse_thin_pack,use_ofs_delta,use_include_tag;staticintno_progress,daemon_mode;-staticintallow_tip_sha1_in_want;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP 01+staticintallow_request_with_bare_object_name;staticintshallow_nr;staticstructobject_arrayhave_obj;staticstructobject_arraywant_obj;
@@ -442,8 +444,8 @@ static int get_common_commits(void)staticintis_our_ref(structobject*o){-returno->flags&-((allow_tip_sha1_in_want?HIDDEN_REF:0)|OUR_REF);+intallow_hidden_ref=(allow_request_with_bare_object_name&ALLOW_TIP);+returno->flags&((allow_hidden_ref?HIDDEN_REF:0)|OUR_REF);}staticvoidcheck_non_tip(void)
From: Fredrik Medley <hidden> Date: 2016-06-15 23:04:44
With uploadpack.allowReachableSHA1InWant configuration option set on the
server side, "git fetch" can make a request with a "want" line that names
an object that has not been advertised (likely to have been obtained out
of band or from a submodule pointer). Only objects reachable from the
branch tips, i.e. the union of advertised branches and branches hidden by
transfer.hideRefs, will be processed. Note that there is an associated
cost of having to walk back the hstory to check the reachability.
This feature can be used when obtaining the content of a certain commit,
for which the sha1 is known, without the need of cloning the whole
repository, especially if a shallow fetch is used. Useful cases are e.g.
repositories containing large files in the history, fetching only the
needed data for a submodule checkout, when sharing a sha1 without telling
which exact branch it belongs to and in Gerrit, if you think in terms of
commits instead of change numbers. (The Gerrit case has already been
solved through allowTipSHA1InWant as every Gerrit change has a ref.)
Signed-off-by: Fredrik Medley <redacted>
---
Documentation/config.txt | 6 +++
Documentation/technical/http-protocol.txt | 3 +-
Documentation/technical/protocol-capabilities.txt | 7 +++
fetch-pack.c | 9 +++-
t/t5516-fetch-push.sh | 55 +++++++++++++++++++++++
upload-pack.c | 20 +++++++--
6 files changed, 94 insertions(+), 6 deletions(-)
@@ -2538,6 +2538,12 @@ uploadpack.allowTipSHA1InWant:: of a hidden ref (by default, such a request is rejected). see also `uploadpack.hideRefs`.+uploadpack.allowReachableSHA1InWant::+ Allow `upload-pack` to accept a fetch request that asks for an+ object that is reachable from any ref tip. However, note that+ calculating object reachability is computationally expensive.+ Defaults to `false`.+ uploadpack.keepAlive:: When `upload-pack` has started `pack-objects`, there may be a quiet period while `pack-objects` prepares the pack. Normally
@@ -319,7 +319,8 @@ Servers SHOULD support all capabilities defined here. Clients MUST send at least one "want" command in the request body. Clients MUST NOT reference an id in a "want" command which did not appear in the response obtained through ref discovery unless the-server advertises capability `allow-tip-sha1-in-want`.+server advertises capability `allow-tip-sha1-in-want` or+`allow-reachable-sha1-in-want`. compute_request = want_list have_list
@@ -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+----------------------++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.+ push-cert=<nonce> -----------------
@@ -46,6 +46,8 @@ static struct prio_queue rev_list = { compare_commits_by_commit_date };staticintnon_common_revs,multi_ack,use_sideband;/* Allow specifying sha1 if it is a ref tip. */#define ALLOW_TIP 01+/* Allow request of a sha1 if it is reachable from a ref (possibly hidden ref). */+#define ALLOW_REACHABLE 02staticintallow_request_with_bare_object_name;staticvoidrev_list_push(structcommit*commit,intmark)
@@ -545,7 +547,7 @@ static void filter_refs(struct fetch_pack_args *args,}/* Append unmatched requests to the list */-if(allow_request_with_bare_object_name&ALLOW_TIP){+if(allow_request_with_bare_object_name&(ALLOW_TIP|ALLOW_REACHABLE)){for(i=0;i<nr_sought;i++){unsignedcharsha1[20];
@@ -37,6 +37,8 @@ static int use_thin_pack, use_ofs_delta, use_include_tag;staticintno_progress,daemon_mode;/* Allow specifying sha1 if it is a ref tip. */#define ALLOW_TIP 01+/* Allow request of a sha1 if it is reachable from a ref (possibly hidden ref). */+#define ALLOW_REACHABLE 02staticintallow_request_with_bare_object_name;staticintshallow_nr;staticstructobject_arrayhave_obj;
@@ -444,7 +446,8 @@ static int get_common_commits(void)staticintis_our_ref(structobject*o){-intallow_hidden_ref=(allow_request_with_bare_object_name&ALLOW_TIP);+intallow_hidden_ref=(allow_request_with_bare_object_name&+(ALLOW_TIP|ALLOW_REACHABLE));returno->flags&((allow_hidden_ref?HIDDEN_REF:0)|OUR_REF);}
@@ -458,8 +461,12 @@ static void check_non_tip(void)charnamebuf[42];/* ^ + SHA-1 + LF */inti;-/* In the normal in-process case non-tip request can never happen */-if(!stateless_rpc)+/*+*Inthenormalin-processcasewithout+*uploadpack.allowReachableSHA1InWant,+*non-tiprequestscanneverhappen.+*/+if(!stateless_rpc&&!(allow_request_with_bare_object_name&ALLOW_REACHABLE))gotoerror;cmd.argv=argv;
@@ -2530,9 +2530,9 @@ uploadpack.hideRefs:: are under the hierarchies listed on the value of this variable is excluded, and is hidden from `git ls-remote`, `git fetch`, etc. An attempt to fetch a hidden ref by `git- fetch` will fail. See also `uploadpack.allowtipsha1inwant`.+ fetch` will fail. See also `uploadpack.allowTipSHA1InWant`.-uploadpack.allowtipsha1inwant::+uploadpack.allowTipSHA1InWant::
When `uploadpack.hideRefs` is in effect, allow `upload-pack`
to accept a fetch request that asks for an object at the tip
of a hidden ref (by default, such a request is rejected).
--
1.9.1
From: Eric Sunshine <hidden> Date: 2016-06-15 23:04:44
On Tue, May 12, 2015 at 5:14 PM, Fredrik Medley
[off-list ref] wrote:
Rename the allow_tip_sha1_in_want variable to
allow_request_with_bare_object_name to allow for future extensions, e.g.
allowing non-tip sha1.
'allow_request_with_bare_object_name' is quite a mouthful. Does it
need to be this long?
Regarding the commit message: Isn't this preparatory step really about
changing the variable from a simple boolean to a "flag"-style so that
it can hold bits for multiple options? Perhaps the commit message
should mention something about that?
Missing sign-off.
More below.
@@ -43,7 +43,10 @@ static int marked;#define MAX_IN_VAIN 256staticstructprio_queuerev_list={compare_commits_by_commit_date};-staticintnon_common_revs,multi_ack,use_sideband,allow_tip_sha1_in_want;+staticintnon_common_revs,multi_ack,use_sideband;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP 01+staticintallow_request_with_bare_object_name;staticvoidrev_list_push(structcommit*commit,intmark){
@@ -542,7 +545,7 @@ static void filter_refs(struct fetch_pack_args *args,}/* Append unmatched requests to the list */-if(allow_tip_sha1_in_want){+if(allow_request_with_bare_object_name&ALLOW_TIP){
Some compilers are going to warn about this (warning: did you mean
"&&" rather than "&"?). Wrap it in an extra set of parentheses to
avoid the warning.
quoted hunk
for (i = 0; i < nr_sought; i++) {
unsigned char sha1[20];
@@ -35,7 +35,9 @@ static int multi_ack;staticintno_done;staticintuse_thin_pack,use_ofs_delta,use_include_tag;staticintno_progress,daemon_mode;-staticintallow_tip_sha1_in_want;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP 01+staticintallow_request_with_bare_object_name;staticintshallow_nr;staticstructobject_arrayhave_obj;staticstructobject_arraywant_obj;
@@ -442,8 +444,8 @@ static int get_common_commits(void)staticintis_our_ref(structobject*o){-returno->flags&-((allow_tip_sha1_in_want?HIDDEN_REF:0)|OUR_REF);+intallow_hidden_ref=(allow_request_with_bare_object_name&ALLOW_TIP);+returno->flags&((allow_hidden_ref?HIDDEN_REF:0)|OUR_REF);}staticvoidcheck_non_tip(void)
From: Eric Sunshine <hidden> Date: 2016-06-15 23:04:44
On Tue, May 12, 2015 at 5:14 PM, Fredrik Medley
[off-list ref] wrote:
With uploadpack.allowReachableSHA1InWant configuration option set on the
server side, "git fetch" can make a request with a "want" line that names
an object that has not been advertised (likely to have been obtained out
of band or from a submodule pointer). Only objects reachable from the
branch tips, i.e. the union of advertised branches and branches hidden by
transfer.hideRefs, will be processed. Note that there is an associated
cost of having to walk back the hstory to check the reachability.
Mentioned previously[1]: s/hstory/history/
quoted hunk
This feature can be used when obtaining the content of a certain commit,
for which the sha1 is known, without the need of cloning the whole
repository, especially if a shallow fetch is used. Useful cases are e.g.
repositories containing large files in the history, fetching only the
needed data for a submodule checkout, when sharing a sha1 without telling
which exact branch it belongs to and in Gerrit, if you think in terms of
commits instead of change numbers. (The Gerrit case has already been
solved through allowTipSHA1InWant as every Gerrit change has a ref.)
Signed-off-by: Fredrik Medley <redacted>
---
@@ -2538,6 +2538,12 @@ uploadpack.allowTipSHA1InWant:: of a hidden ref (by default, such a request is rejected). see also `uploadpack.hideRefs`.+uploadpack.allowReachableSHA1InWant::+ Allow `upload-pack` to accept a fetch request that asks for an+ object that is reachable from any ref tip. However, note that+ calculating object reachability is computationally expensive.
From: Fredrik Medley <hidden> Date: 2016-06-15 23:04:50
Most of the options in config.txt are camelCase. Improve the readability
for allowtipsha1inwant by changing to allowTipSHA1InWant.
Signed-off-by: Fredrik Medley <redacted>
---
This patch is optional. There has been work on fixing the whole
Documentation/config.txt which has not been merged yet. When adding
allowReachableSHA1InWant later, it would be good to already have changed
to allowTipSHA1InWant.
Documentation/config.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -2530,9 +2530,9 @@ uploadpack.hideRefs:: are under the hierarchies listed on the value of this variable is excluded, and is hidden from `git ls-remote`, `git fetch`, etc. An attempt to fetch a hidden ref by `git- fetch` will fail. See also `uploadpack.allowtipsha1inwant`.+ fetch` will fail. See also `uploadpack.allowTipSHA1InWant`.-uploadpack.allowtipsha1inwant::+uploadpack.allowTipSHA1InWant:: When `uploadpack.hideRefs` is in effect, allow `upload-pack` to accept a fetch request that asks for an object at the tip of a hidden ref (by default, such a request is rejected).
@@ -43,7 +43,10 @@ static int marked;#define MAX_IN_VAIN 256staticstructprio_queuerev_list={compare_commits_by_commit_date};-staticintnon_common_revs,multi_ack,use_sideband,allow_tip_sha1_in_want;+staticintnon_common_revs,multi_ack,use_sideband;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP_SHA1 01+staticintallow_unadvertised_object_request;staticvoidrev_list_push(structcommit*commit,intmark){
@@ -542,7 +545,7 @@ static void filter_refs(struct fetch_pack_args *args,}/* Append unmatched requests to the list */-if(allow_tip_sha1_in_want){+if((allow_unadvertised_object_request&ALLOW_TIP_SHA1)){for(i=0;i<nr_sought;i++){unsignedcharsha1[20];
@@ -35,7 +35,9 @@ static int multi_ack;staticintno_done;staticintuse_thin_pack,use_ofs_delta,use_include_tag;staticintno_progress,daemon_mode;-staticintallow_tip_sha1_in_want;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP_SHA1 01+staticintallow_unadvertised_object_request;staticintshallow_nr;staticstructobject_arrayhave_obj;staticstructobject_arraywant_obj;
@@ -442,8 +444,8 @@ static int get_common_commits(void)staticintis_our_ref(structobject*o){-returno->flags&-((allow_tip_sha1_in_want?HIDDEN_REF:0)|OUR_REF);+intallow_hidden_ref=(allow_unadvertised_object_request&ALLOW_TIP_SHA1);+returno->flags&((allow_hidden_ref?HIDDEN_REF:0)|OUR_REF);}staticvoidcheck_non_tip(void)
From: Fredrik Medley <hidden> Date: 2016-06-15 23:04:50
With uploadpack.allowReachableSHA1InWant configuration option set on the
server side, "git fetch" can make a request with a "want" line that names
an object that has not been advertised (likely to have been obtained out
of band or from a submodule pointer). Only objects reachable from the
branch tips, i.e. the union of advertised branches and branches hidden by
transfer.hideRefs, will be processed. Note that there is an associated
cost of having to walk back the history to check the reachability.
This feature can be used when obtaining the content of a certain commit,
for which the sha1 is known, without the need of cloning the whole
repository, especially if a shallow fetch is used. Useful cases are e.g.
repositories containing large files in the history, fetching only the
needed data for a submodule checkout, when sharing a sha1 without telling
which exact branch it belongs to and in Gerrit, if you think in terms of
commits instead of change numbers. (The Gerrit case has already been
solved through allowTipSHA1InWant as every Gerrit change has a ref.)
Signed-off-by: Fredrik Medley <redacted>
---
Documentation/config.txt | 6 +++
Documentation/technical/http-protocol.txt | 3 +-
Documentation/technical/protocol-capabilities.txt | 7 +++
fetch-pack.c | 11 ++++-
t/t5516-fetch-push.sh | 55 +++++++++++++++++++++++
upload-pack.c | 22 ++++++---
6 files changed, 96 insertions(+), 8 deletions(-)
@@ -2538,6 +2538,12 @@ uploadpack.allowTipSHA1InWant:: of a hidden ref (by default, such a request is rejected). see also `uploadpack.hideRefs`.+uploadpack.allowReachableSHA1InWant::+ Allow `upload-pack` to accept a fetch request that asks for an+ object that is reachable from any ref tip. However, note that+ calculating object reachability is computationally expensive.+ Defaults to `false`.+ uploadpack.keepAlive:: When `upload-pack` has started `pack-objects`, there may be a quiet period while `pack-objects` prepares the pack. Normally
@@ -319,7 +319,8 @@ Servers SHOULD support all capabilities defined here. Clients MUST send at least one "want" command in the request body. Clients MUST NOT reference an id in a "want" command which did not appear in the response obtained through ref discovery unless the-server advertises capability `allow-tip-sha1-in-want`.+server advertises capability `allow-tip-sha1-in-want` or+`allow-reachable-sha1-in-want`. compute_request = want_list have_list
@@ -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+----------------------++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.+ push-cert=<nonce> -----------------
@@ -45,7 +45,9 @@ static int marked;staticstructprio_queuerev_list={compare_commits_by_commit_date};staticintnon_common_revs,multi_ack,use_sideband;/* Allow specifying sha1 if it is a ref tip. */-#define ALLOW_TIP_SHA1 01+#define ALLOW_TIP_SHA1 01+/* Allow request of a sha1 if it is reachable from a ref (possibly hidden ref). */+#define ALLOW_REACHABLE_SHA1 02staticintallow_unadvertised_object_request;staticvoidrev_list_push(structcommit*commit,intmark)
@@ -545,7 +547,7 @@ static void filter_refs(struct fetch_pack_args *args,}/* Append unmatched requests to the list */-if((allow_unadvertised_object_request&ALLOW_TIP_SHA1)){+if((allow_unadvertised_object_request&(ALLOW_TIP_SHA1|ALLOW_REACHABLE_SHA1))){for(i=0;i<nr_sought;i++){unsignedcharsha1[20];
@@ -36,7 +36,9 @@ static int no_done;staticintuse_thin_pack,use_ofs_delta,use_include_tag;staticintno_progress,daemon_mode;/* Allow specifying sha1 if it is a ref tip. */-#define ALLOW_TIP_SHA1 01+#define ALLOW_TIP_SHA1 01+/* Allow request of a sha1 if it is reachable from a ref (possibly hidden ref). */+#define ALLOW_REACHABLE_SHA1 02staticintallow_unadvertised_object_request;staticintshallow_nr;staticstructobject_arrayhave_obj;
@@ -444,7 +446,8 @@ static int get_common_commits(void)staticintis_our_ref(structobject*o){-intallow_hidden_ref=(allow_unadvertised_object_request&ALLOW_TIP_SHA1);+intallow_hidden_ref=(allow_unadvertised_object_request&+(ALLOW_TIP_SHA1|ALLOW_REACHABLE_SHA1));returno->flags&((allow_hidden_ref?HIDDEN_REF:0)|OUR_REF);}
@@ -458,8 +461,12 @@ static void check_non_tip(void)charnamebuf[42];/* ^ + SHA-1 + LF */inti;-/* In the normal in-process case non-tip request can never happen */-if(!stateless_rpc)+/*+*Inthenormalin-processcasewithout+*uploadpack.allowReachableSHA1InWant,+*non-tiprequestscanneverhappen.+*/+if(!stateless_rpc&&!(allow_unadvertised_object_request&ALLOW_REACHABLE_SHA1))gotoerror;cmd.argv=argv;
@@ -43,7 +43,10 @@ static int marked;#define MAX_IN_VAIN 256staticstructprio_queuerev_list={compare_commits_by_commit_date};-staticintnon_common_revs,multi_ack,use_sideband,allow_tip_sha1_in_want;+staticintnon_common_revs,multi_ack,use_sideband;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP_SHA1 01+staticintallow_unadvertised_object_request;staticvoidrev_list_push(structcommit*commit,intmark){
@@ -542,7 +545,7 @@ static void filter_refs(struct fetch_pack_args *args,}/* Append unmatched requests to the list */-if(allow_tip_sha1_in_want){+if((allow_unadvertised_object_request&ALLOW_TIP_SHA1)){for(i=0;i<nr_sought;i++){unsignedcharsha1[20];
@@ -35,7 +35,9 @@ static int multi_ack;staticintno_done;staticintuse_thin_pack,use_ofs_delta,use_include_tag;staticintno_progress,daemon_mode;-staticintallow_tip_sha1_in_want;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP_SHA1 01+staticintallow_unadvertised_object_request;staticintshallow_nr;staticstructobject_arrayhave_obj;staticstructobject_arraywant_obj;
@@ -442,8 +444,8 @@ static int get_common_commits(void)staticintis_our_ref(structobject*o){-returno->flags&-((allow_tip_sha1_in_want?HIDDEN_REF:0)|OUR_REF);+intallow_hidden_ref=(allow_unadvertised_object_request&ALLOW_TIP_SHA1);+returno->flags&((allow_hidden_ref?HIDDEN_REF:0)|OUR_REF);}staticvoidcheck_non_tip(void)
From: Fredrik Medley <hidden> Date: 2016-06-15 23:04:52
With uploadpack.allowReachableSHA1InWant configuration option set on the
server side, "git fetch" can make a request with a "want" line that names
an object that has not been advertised (likely to have been obtained out
of band or from a submodule pointer). Only objects reachable from the
branch tips, i.e. the union of advertised branches and branches hidden by
transfer.hideRefs, will be processed. Note that there is an associated
cost of having to walk back the history to check the reachability.
This feature can be used when obtaining the content of a certain commit,
for which the sha1 is known, without the need of cloning the whole
repository, especially if a shallow fetch is used. Useful cases are e.g.
repositories containing large files in the history, fetching only the
needed data for a submodule checkout, when sharing a sha1 without telling
which exact branch it belongs to and in Gerrit, if you think in terms of
commits instead of change numbers. (The Gerrit case has already been
solved through allowTipSHA1InWant as every Gerrit change has a ref.)
Signed-off-by: Fredrik Medley <redacted>
---
Documentation/config.txt | 6 +++
Documentation/technical/http-protocol.txt | 3 +-
Documentation/technical/protocol-capabilities.txt | 7 +++
fetch-pack.c | 10 ++++-
t/t5516-fetch-push.sh | 55 +++++++++++++++++++++++
upload-pack.c | 22 +++++++--
6 files changed, 97 insertions(+), 6 deletions(-)
@@ -2547,6 +2547,12 @@ uploadpack.allowTipSHA1InWant:: of a hidden ref (by default, such a request is rejected). see also `uploadpack.hideRefs`.+uploadpack.allowReachableSHA1InWant::+ Allow `upload-pack` to accept a fetch request that asks for an+ object that is reachable from any ref tip. However, note that+ calculating object reachability is computationally expensive.+ Defaults to `false`.+ uploadpack.keepAlive:: When `upload-pack` has started `pack-objects`, there may be a quiet period while `pack-objects` prepares the pack. Normally
@@ -319,7 +319,8 @@ Servers SHOULD support all capabilities defined here. Clients MUST send at least one "want" command in the request body. Clients MUST NOT reference an id in a "want" command which did not appear in the response obtained through ref discovery unless the-server advertises capability `allow-tip-sha1-in-want`.+server advertises capability `allow-tip-sha1-in-want` or+`allow-reachable-sha1-in-want`. compute_request = want_list have_list
@@ -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+----------------------++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.+ push-cert=<nonce> -----------------
@@ -46,6 +46,8 @@ static struct prio_queue rev_list = { compare_commits_by_commit_date };staticintnon_common_revs,multi_ack,use_sideband;/* Allow specifying sha1 if it is a ref tip. */#define ALLOW_TIP_SHA1 01+/* Allow request of a sha1 if it is reachable from a ref (possibly hidden ref). */+#define ALLOW_REACHABLE_SHA1 02staticintallow_unadvertised_object_request;staticvoidrev_list_push(structcommit*commit,intmark)
@@ -545,7 +547,8 @@ static void filter_refs(struct fetch_pack_args *args,}/* Append unmatched requests to the list */-if((allow_unadvertised_object_request&ALLOW_TIP_SHA1)){+if((allow_unadvertised_object_request&+(ALLOW_TIP_SHA1|ALLOW_REACHABLE_SHA1))){for(i=0;i<nr_sought;i++){unsignedcharsha1[20];
@@ -37,6 +37,8 @@ static int use_thin_pack, use_ofs_delta, use_include_tag;staticintno_progress,daemon_mode;/* Allow specifying sha1 if it is a ref tip. */#define ALLOW_TIP_SHA1 01+/* Allow request of a sha1 if it is reachable from a ref (possibly hidden ref). */+#define ALLOW_REACHABLE_SHA1 02staticintallow_unadvertised_object_request;staticintshallow_nr;staticstructobject_arrayhave_obj;
@@ -444,7 +446,8 @@ static int get_common_commits(void)staticintis_our_ref(structobject*o){-intallow_hidden_ref=(allow_unadvertised_object_request&ALLOW_TIP_SHA1);+intallow_hidden_ref=(allow_unadvertised_object_request&+(ALLOW_TIP_SHA1|ALLOW_REACHABLE_SHA1));returno->flags&((allow_hidden_ref?HIDDEN_REF:0)|OUR_REF);}
@@ -458,8 +461,12 @@ static void check_non_tip(void)charnamebuf[42];/* ^ + SHA-1 + LF */inti;-/* In the normal in-process case non-tip request can never happen */-if(!stateless_rpc)+/*+*Inthenormalin-processcasewithout+*uploadpack.allowReachableSHA1InWant,+*non-tiprequestscanneverhappen.+*/+if(!stateless_rpc&&!(allow_unadvertised_object_request&ALLOW_REACHABLE_SHA1))gotoerror;cmd.argv=argv;
From: Fredrik Medley <hidden> Date: 2016-06-15 23:04:52
Most of the options in config.txt are camelCase. Improve the readability
for allowtipsha1inwant by changing to allowTipSHA1InWant.
Signed-off-by: Fredrik Medley <redacted>
---
This patch is optional. There has been work on fixing the whole
Documentation/config.txt which has not been merged yet. When adding
allowReachableSHA1InWant later, it would be good to already have changed
to allowTipSHA1InWant.
Documentation/config.txt | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -2539,9 +2539,9 @@ uploadpack.hideRefs:: are under the hierarchies listed on the value of this variable is excluded, and is hidden from `git ls-remote`, `git fetch`, etc. An attempt to fetch a hidden ref by `git- fetch` will fail. See also `uploadpack.allowtipsha1inwant`.+ fetch` will fail. See also `uploadpack.allowTipSHA1InWant`.-uploadpack.allowtipsha1inwant::+uploadpack.allowTipSHA1InWant:: When `uploadpack.hideRefs` is in effect, allow `upload-pack` to accept a fetch request that asks for an object at the tip of a hidden ref (by default, such a request is rejected).
@@ -43,7 +43,10 @@ static int marked;#define MAX_IN_VAIN 256staticstructprio_queuerev_list={compare_commits_by_commit_date};-staticintnon_common_revs,multi_ack,use_sideband,allow_tip_sha1_in_want;+staticintnon_common_revs,multi_ack,use_sideband;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP_SHA1 01+staticintallow_unadvertised_object_request;
It is better to use "unsigned int" for these bit masks, as we are
not interested in the top-most bit getting special-cased by using a
signed type. I'll amend this (and the one in upload-pack.c) while
applying, so no need to resend only to correct these two, unless you
have other reasons to reroll.
Thanks.
@@ -35,7 +35,9 @@ static int multi_ack;staticintno_done;staticintuse_thin_pack,use_ofs_delta,use_include_tag;staticintno_progress,daemon_mode;-staticintallow_tip_sha1_in_want;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP_SHA1 01+staticintallow_unadvertised_object_request;
@@ -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.
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.
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.
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).
@@ -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
@@ -43,7 +43,10 @@ static int marked;#define MAX_IN_VAIN 256staticstructprio_queuerev_list={compare_commits_by_commit_date};-staticintnon_common_revs,multi_ack,use_sideband,allow_tip_sha1_in_want;+staticintnon_common_revs,multi_ack,use_sideband;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP_SHA1 01+staticintallow_unadvertised_object_request;
It is better to use "unsigned int" for these bit masks, as we are
not interested in the top-most bit getting special-cased by using a
signed type. I'll amend this (and the one in upload-pack.c) while
applying, so no need to resend only to correct these two, unless you
have other reasons to reroll.
Sounds like a good idea to change. Please amend it while applying.
@@ -35,7 +35,9 @@ static int multi_ack;staticintno_done;staticintuse_thin_pack,use_ofs_delta,use_include_tag;staticintno_progress,daemon_mode;-staticintallow_tip_sha1_in_want;+/* Allow specifying sha1 if it is a ref tip. */+#define ALLOW_TIP_SHA1 01+staticintallow_unadvertised_object_request;
@@ -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.
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?
And regardless of allowTip setting, with allowReachable set to true,
fetching the reachable HEAD^ would succeed. Good.
quoted
+ 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.
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).
@@ -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