threads / discuss / 34007

git fetch documentation

Subject: git fetch documentation

## tl;dr

2 messages between Jun 1, 2013 and Jun 1, 2013.

replies: 1people: 2as markdown or json

Nicolas Richard· Jun 1, 2013, 11:04 UTC · lore
Hello,

Regarding the git-fetch man page (IIUC, in pull-fetch-param.txt), in particular the <refspec> explanation, I feel that two facts are missing:

- A '*' can be used both in src and dest, and it matches any name,
  including subdirectories, but not partial names (i.e. refs/heads/foo*
  is invalid).
- multiple fetch lines can be given in .git/config, each of them will be
  obeyed

These are probably obvious for most users, but I think documenting them would be good for newcomers. (I tried to come up with a patch but I can't find a precise yet concise way to explain the role of '*' in english.)

-- 
Nico.
Ramkumar Ramachandra· Jun 1, 2013, 11:25 UTC · re: Nicolas Richard · lore

Re: git fetch documentation

Nicolas Richard wrote:
Show 10 quoted lines
> - A '*' can be used both in src and dest, and it matches any name,
>   including subdirectories, but not partial names (i.e. refs/heads/foo*
>   is invalid).
> - multiple fetch lines can be given in .git/config, each of them will be
>   obeyed
>
> These are probably obvious for most users, but I think documenting them
> would be good for newcomers. (I tried to come up with a patch but I
> can't find a precise yet concise way to explain the role of '*' in
> english.)

Good. Yes, we don't even have examples showing that a rewrite like refs/heads/nr/*:refs/heads/* can be done. The documentation is definitely lacking. However, I'd urge you to get started by submitting an initial draft: we will review it and help you learn and contribute. Some pointers:

- What you are attempting to document is called a refspec.  Look at
'struct refspec' in remote.h, and attempt to understand what its
fields mean by looking at how it is used in remote.c.
- Notice that there is a push refspec corresponding to the fetch
refspec.  This feature is even more obscure and undocumented.
- See remote.c:get_ref_match(); specifically,
match_name_with_pattern() is doing the pattern matching.  As you can
see, match_name_with_pattern() hard-codes a '*' and tries to match
just that: there is no support for anything else.  Try to skim through
the code once.
- Read Documentation/SubmittingPatches and submit a first version
quickly.  It doesn't have to be perfect at all.

← back to recent threads