Re: git fetch documentation
- From
Ramkumar Ramachandra <artagnon@gmail.com>
- Date
- Jun 1, 2013, 11:25 UTC
- Message-ID
- <CALkWK0mqkOZ__Gk-5VUpzLCaUHx1kA1JTrFunF3tUSeX6tDkgA@mail.gmail.com>
- In-Reply-To
- <87sj12rt13.fsf@yahoo.fr>
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.