Re: Git global usage and tests
- From
Jeff King <peff@peff.net>
- Date
- May 30, 2011, 15:36 UTC
- Message-ID
- <20110530153620.GA24431@sigill.intra.peff.net>
- In-Reply-To
- <754E784F-51C6-4B8D-B15D-3FF8B7AF1321@gmail.com>
On Mon, May 30, 2011 at 04:58:14PM +0200, Romain Geissler wrote:
Show 9 quoted lines
> Indeed the test t2050-git-dir-relative.sh run :
>
> echo changed >top &&
> git --git-dir subdir/.git add top &&
> git --git-dir subdir/.git commit -m topcommit &&
> test -r "${COMMIT_FILE}"
>
> But according to the git help, it should have specified a git-dir with --git-dir=value ie
> git --git-dir=subdir/.git add topThe test is OK. Long options that have a required argument can be expressed as either:
--long-option=value
or
--long-option value
Long options with an optional argument must use the first form, as the second one is ambiguous (is "value" the value, or the next option?).
Your option parser needs to follow these rules to be compatible with git. Have you considered pulling the parse-options parser from git into libgit2? It's one of the more modularized and lib-ified bits of code in git already.
-Peff