On Sat, May 30, 2009 at 9:53 AM, Jeff Epler <jepler@xxxxxxxxxxxxxx> wrote:> @@ -1142,9 +1142,23 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)> const char *head = "HEAD";> const char *limit = NULL;> int verbose = 0;> + int abbrev = 40;> +> + while(argc > 1 && argv[1][0] == '-') {> + if (!strcmp(argv[1], "-v")) {> + verbose = 1;> + } else if(!strcmp(argv[1], "--abbrev")) {> + abbrev = DEFAULT_ABBREV;> + } else if(!prefixcmp(argv[1], "--abbrev=")) {> + abbrev = strtol(argv[1] + 9, NULL, 10);> + if(abbrev < MINIMUM_ABBREV)> + abbrev = MINIMUM_ABBREV;> + else if(abbrev > 40)> + abbrev = 40;> + } else {> + die("unrecognized argument: %s", argv[1]);> + }> You might want to look at using the parse options API. It has optionsfor verbose and abbrev builtin, so you don't have to do any extrawork. Plus you get a nice usage message for free. SeeDocumentation/technical/api-parse-options.txt for more info. > diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash> index c84d765..536a769 100755> --- a/contrib/completion/git-completion.bash> +++ b/contrib/completion/git-completion.bash> @@ -804,7 +804,15 @@ _git_checkout ()>> _git_cherry ()> {> - __gitcomp "$(__git_refs)"> + local cur="${COMP_WORDS[COMP_CWORD]}"> + case "$cur" in> + -*)> + __gitcomp "-v --abbrev --abbrev="> + ;;> + *)> + __gitcomp "$(__git_refs)"> + ;;> + esac Completion doesn't include short options (-v). This also means that--* is used instead of -* Finally, you'll want to Cc Shawn (Shawn O. Pearce<spearce@xxxxxxxxxxx>) on bash completion.��.n��������+%������w��{.n��������n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�m