Re: [PATCH] bash-completion: fix getting strategy list
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Aug 19, 2008, 14:50 UTC
- Message-ID
- <48AADDBB.1080203@viscovery.net>
- In-Reply-To
- <20080819132803.GA26201@laptop>
Nguyen Thai Ngoc Duy schrieb:
> +--show-strategies:: > + Show all available strategies. For internal use only. > +
IMO, you don't need to declare this option as internal; offering it for the public is fine...
> + /* needed for git bash completion and similar tools */
... which would make this comment slightly odd.
> + if (argc == 2 && !strcmp(argv[1], "--show-strategies")) {
> + for (i = 0; i < ARRAY_SIZE(all_strategy); i++)
> + printf("%s\n", all_strategy[i].name);
> + return 0;Improved error checking, but quick and dirty:
+ if (!strcmp(argv[1], "--show-strategies")) { + for (i = 0; i < ARRAY_SIZE(all_strategy); i++) + printf("%s\n", all_strategy[i].name); + return argc == 2 ? 0 : + error("--show-strategies does not take " + "any arguments");
> + $(git --exec-path)/git-merge --show-strategies
+ git merge --show-strategies
-- Hannes