Re: [PATCH] t/t3903-stash: improve testing of git-stash show

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Brian Gernhardt
Date: Friday, September 24, 2010 - 2:49 pm

On Sep 24, 2010, at 4:50 PM, Brandon Casey wrote:


Actually, I think the solution you offered exposed what could be considered a bug in git-rev-parse.  The fact that it worked before was just an happy accident, I think...

$ ARGS="-q --index stash@{0}"
$ # Get only the revision arguments
$ git rev-parse --no-flags --symbolic $ARGS
stash@{0}
$ # What git-stash currently uses to get flags
$ git rev-parse --no-revs -- $ARGS
--
-q
--index
stash@{0}
$ # That was a lot more than just the flags
$ # What git-stash "should" use to get flags
$ git rev-parse --no-revs --flags $ARGS
--index
$ # Huh, it ate -q, let's try --
$ git rev-parse --no-revs --flags -- $ARGS
$ # No, that's not right either...

git-stash's current code "FLAGS=$(git rev-parse --no-revs -- "$@")" simply returns all of the arguments including a starting --.  The issue is that git-rev-parse eats a -q parameter.  There's no way to distinguish between arguments for rev-parse and arguments it's supposed to parse.  Generally this isn't an issue.

The simple way to deal with this is to check for -q before using rev-parse.  The better way is to either get rev-parse to stop eating the -q somehow or to switch git-stash to parseopts.

Simple patch coming soon.

~~ Brian

--
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:
[PATCH] t/t3903-stash: improve testing of git-stash show, Brandon Casey, (Fri Sep 24, 1:40 pm)
Re: [PATCH] t/t3903-stash: improve testing of git-stash show, Brian Gernhardt, (Fri Sep 24, 1:43 pm)
Re: [PATCH] t/t3903-stash: improve testing of git-stash show, Brian Gernhardt, (Fri Sep 24, 2:49 pm)
[PATCH] git-stash: fix flag parsing, Brian Gernhardt, (Fri Sep 24, 3:15 pm)
[PATCH] stash show: fix breakage in 1.7.3, Jon Seymour, (Fri Sep 24, 7:54 pm)
Re: [PATCH] git-stash: fix flag parsing, Jon Seymour, (Fri Sep 24, 7:58 pm)
[PATCH v1] stash show: fix breakage in 1.7.3, Jon Seymour, (Fri Sep 24, 8:32 pm)
Re: [PATCH v1] stash show: fix breakage in 1.7.3, Brian Gernhardt, (Fri Sep 24, 9:45 pm)
Re: [PATCH v1] stash show: fix breakage in 1.7.3, Jon Seymour, (Fri Sep 24, 11:19 pm)
Re: [PATCH v1] stash show: fix breakage in 1.7.3, Jon Seymour, (Sat Sep 25, 12:15 am)
Re: [PATCH] git-stash: fix flag parsing, Junio C Hamano, (Sun Sep 26, 9:36 pm)
[PATCH] stash: simplify parsing fixes, Jon Seymour, (Mon Sep 27, 8:32 am)
Re: [PATCH v1] stash show: fix breakage in 1.7.3, Jon Seymour, (Mon Sep 27, 8:38 am)