From: Junio C Hamano Date: Tue, 01 Oct 2024 18:36:52 GMT Subject: Re: [PATCH] documentation: add missing word "ref" Message-ID: In-Reply-To: "Monika KairaitytÄ— via GitGitGadget" writes: > When explaining about "the destination ref ", word > "ref" is included. Logically, it should be the same in the explanation > of "the source ". "Logically", if and followed the same rules, but otherwise, it is not a logical conclusion. What makes me hesitate with this change is the following. - In "+refs/heads/*:refs/remotes/origin/*", is "refs/heads/*" and is "refs/tags/*". Neither is a ref. So it could be argued that saying "ref" before is what is wrong in the current text, and adding "ref" before makes it doubly wrong. - In addition, can be a fully spelled object name, to fetch just a single object. In such a case, it does not even remotely resemble a ref. How about this text instead? Would it solve the problem, i.e. > In the git-fetch documentation, description of syntax is not > entirely clear. Thanks. ------- >8 ------- Subject: doc: clarify in refspec syntax We explicitly avoid saying "ref " when introducing the source side of a refspec, because it can be a fully-spelled hexadecimal object name, and it also can be a pattern that is not quite a "ref". But we are loose when we introduce and say "ref ", even though it can also be a pattern. Let's omit "ref" also from the destination side. Clarify that can be a ref, a (limited glob) pattern, or an object name. Even though the very original design of refspec expected that '*' was used only at the end (e.g., "refs/heads/*" was expected, but not "refs/heads/*-wip"), the code and its use evolved to handle a single '*' anywhere in the pattern. Update the text to remove the mention of "the same prefix". Anything that matches the pattern are named by such a (limited glob) pattern in . Also put a bit more stress on the fact that we accept only one '*' in the pattern by saying "one and only one `*`". Helped-by: Monika KairaitytÄ— Signed-off-by: Junio C Hamano --- Documentation/pull-fetch-param.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git c/Documentation/pull-fetch-param.txt w/Documentation/pull-fetch-param.txt index c718f7946f..d79d2f6065 100644 --- c/Documentation/pull-fetch-param.txt +++ w/Documentation/pull-fetch-param.txt @@ -25,14 +25,15 @@ endif::git-pull[] + The format of a parameter is an optional plus `+`, followed by the source , followed -by a colon `:`, followed by the destination ref . +by a colon `:`, followed by the destination . The colon can be omitted when is empty. is -typically a ref, but it can also be a fully spelled hex object +typically a ref, or a glob pattern with a single `*` that is used +to match a set of refs, but it can also be a fully spelled hex object name. + A may contain a `*` in its to indicate a simple pattern match. Such a refspec functions like a glob that matches any ref with the -same prefix. A pattern must have a `*` in both the and +pattern. A pattern must have one and only one `*` in both the and . It will map refs to the destination by replacing the `*` with the contents matched from the source. +