Skip to content

Commit 53a66ec

Browse files
kimgitster
authored andcommitted
docs: clarify the interaction of transfer.hideRefs and namespaces
Expand the section about namespaces in the documentation of `transfer.hideRefs` to point out the subtle differences between `upload-pack` and `receive-pack`. ffcfb68 (upload-pack.c: treat want-ref relative to namespace, 2021-07-30) taught `upload-pack` to reject `want-ref`s for hidden refs, which is now mentioned. It is clarified that at no point the name of a hidden ref is revealed, but the object id it points to may. Signed-off-by: Kim Altintop <[email protected]> Reviewed-by: Jonathan Tan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3955140 commit 53a66ec

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

Documentation/config/transfer.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,17 @@ If you have multiple hideRefs values, later entries override earlier ones
5252
(and entries in more-specific config files override less-specific ones).
5353
+
5454
If a namespace is in use, the namespace prefix is stripped from each
55-
reference before it is matched against `transfer.hiderefs` patterns.
55+
reference before it is matched against `transfer.hiderefs` patterns. In
56+
order to match refs before stripping, add a `^` in front of the ref name. If
57+
you combine `!` and `^`, `!` must be specified first.
58+
+
5659
For example, if `refs/heads/master` is specified in `transfer.hideRefs` and
5760
the current namespace is `foo`, then `refs/namespaces/foo/refs/heads/master`
58-
is omitted from the advertisements but `refs/heads/master` and
59-
`refs/namespaces/bar/refs/heads/master` are still advertised as so-called
60-
"have" lines. In order to match refs before stripping, add a `^` in front of
61-
the ref name. If you combine `!` and `^`, `!` must be specified first.
61+
is omitted from the advertisements. If `uploadpack.allowRefInWant` is set,
62+
`upload-pack` will treat `want-ref refs/heads/master` in a protocol v2
63+
`fetch` command as if `refs/namespaces/foo/refs/heads/master` did not exist.
64+
`receive-pack`, on the other hand, will still advertise the object id the
65+
ref is pointing to without mentioning its name (a so-called ".have" line).
6266
+
6367
Even if you hide refs, a client may still be able to steal the target
6468
objects via the techniques described in the "SECURITY" section of the

0 commit comments

Comments
 (0)