Re: [PATCH 1/6] gitopt: a new command-line option parser for git

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Junio C Hamano <junkio@...>
Cc: Timo Hirvonen <tihirvon@...>, <git@...>
Date: Tuesday, May 9, 2006 - 3:39 pm

Junio C Hamano <junkio@cox.net> wrote:

I think numeric parameters are unambiguous when bundled.
I'm used to things like `diff -ru10p` working, *shrug*

Non-numeric parameters can only be used if the option is at the end of the
bundled string:

git commit -sam'this is my commit message'  would work

git commit -m'say hello' would also work

but git commit -mas'this is my commit message' would not work as intended
(where user wanted -a -s, too)


There are (currently) two types of abbreviations, one is the prefix one used
commonly in shell scripts:  -e|--e|--ed|--edi|--edit.  I think this should
always be supported as most of our shell scripts already do.

The other one tokenizes on '-' first and looks for a prefix match after
each '-'.  I'd like to make that at least optional:

diff --git a/gitopt.c b/gitopt.c
index 056e163..9ca6025 100644
--- a/gitopt.c
+++ b/gitopt.c
gitopt.c
@@ -427,7 +427,7 @@ static void fallback_long(const struct o
        }
 
        /* ok, try harder, based on tokenization on '-' */
-       if (found < 0) {
+       if (found < 0 && getenv("GIT_ABBREV_HARDER")) {
                for (i = 0; ost[i].l || ost[i].s; i++) {
                        s = &(ost[i]);
                        if (s->l && opt_token_match(s,cur)) {

-- 
Eric Wong
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: [PATCH 1/6] gitopt: a new command-line option parser for..., Eric Wong, (Tue May 9, 3:39 pm)
[PATCH 2/6] update-index: convert to using gitopt, Eric Wong, (Tue May 9, 1:06 am)
[PATCH 3/6] ls-tree: convert to gitopt, Eric Wong, (Tue May 9, 1:06 am)
[PATCH 4/6] ls-files: convert to using gitopt, Eric Wong, (Tue May 9, 1:06 am)