{"thread":{"id":"19755","subject":"notice: pu broken tonight","startedAt":"2009-06-09T08:36:20Z","lastAt":"2009-06-13T23:58:43Z","messageCount":10,"participants":["Junio C Hamano","René Scharfe","Uwe Kleine-König","Johannes Sixt"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"115888","messageId":"7vy6s1pzwb.fsf@alter.siamese.dyndns.org","threadId":"19755","inReplyTo":null,"subject":"notice: pu broken tonight","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-06-09T08:36:20Z","receivedAt":"2009-06-09T08:36:20Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I've queued a handful of patches from yesterday on maint and master,\nadvanced sp/msysgit topic to next, and queued the remaining new patches\nalong with the old topics on pu.\n\nI added \"just in case output from strerror() had % in it\" patch to\ntr/die_errno topic when I queued it, but I didn't look at the conversion\nfrom die() to die_errno().\n\nAlso I didn't queue the show-branch default_arg patch.  Other than that I\ndo not think I forgot to queue any patch I saw on the list.\n\nI usually make sure all four branches pass the tests before pushing them\nout, but in tonight's integration, the tip of 'pu' does not pass test for\nme, hence this notice.\n"},{"id":"115922","messageId":"4A2E97A9.7040906@lsrfire.ath.cx","threadId":"19755","inReplyTo":"7vy6s1pzwb.fsf@alter.siamese.dyndns.org","subject":"Re: notice: pu broken tonight","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2009-06-09T17:11:05Z","receivedAt":"2009-06-09T17:11:05Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Junio C Hamano schrieb:\n> I usually make sure all four branches pass the tests before pushing them\n> out, but in tonight's integration, the tip of 'pu' does not pass test for\n> me, hence this notice.\n\nThe following patch makes the tests pass again for me.  Feel free to squash\nit into 10c29915.\n\n\n Makefile |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 2d36f78..25029a9 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -921,7 +921,7 @@ SANE_TOOL_PATH_SQ = $(subst ','\\'',$(SANE_TOOL_PATH))\n BROKEN_PATH_FIX = 's|^\\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'\n PATH := $(SANE_TOOL_PATH):${PATH}\n else\n-BROKEN_PATH_FIX = d\n+BROKEN_PATH_FIX = '/^\\# @@BROKEN_PATH_FIX@@$$/d'\n endif\n \n ifeq ($(uname_S),Darwin)\n"},{"id":"115993","messageId":"20090610074400.GA26020@pengutronix.de","threadId":"19755","inReplyTo":"7vy6s1pzwb.fsf@alter.siamese.dyndns.org","subject":"Re: notice: pu broken tonight","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-06-10T07:44:00Z","receivedAt":"2009-06-10T07:44:00Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello Junio,\n\nOn Tue, Jun 09, 2009 at 01:36:20AM -0700, Junio C Hamano wrote:\n>                                                         Other than that I\n> do not think I forgot to queue any patch I saw on the list.\nWhat about\n\n\thttp://news.gmane.org/find-root.php?group=gmane.comp.version-control.git&article=120990\n\n?  I think it's save, but I didn't get any feed-back by you yet.  (And I\nwon't believe you when you say you didn't see it, because you took\n\n\thttp://news.gmane.org/find-root.php?group=gmane.comp.version-control.git&article=117807\n\nfrom the same thread. :-))\n\nBest regards\nUwe\n\n-- \nPengutronix e.K.                              | Uwe Kleine-König            |\nIndustrial Linux Solutions                    | http://www.pengutronix.de/  |\n"},{"id":"115994","messageId":"7vzlcgr088.fsf@alter.siamese.dyndns.org","threadId":"19755","inReplyTo":"20090610074400.GA26020@pengutronix.de","subject":"Re: notice: pu broken tonight","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-06-10T07:56:07Z","receivedAt":"2009-06-10T07:56:07Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Uwe Kleine-König  <u.kleine-koenig@pengutronix.de> writes:\n\n> Hello Junio,\n>\n> On Tue, Jun 09, 2009 at 01:36:20AM -0700, Junio C Hamano wrote:\n>>                                                         Other than that I\n>> do not think I forgot to queue any patch I saw on the list.\n> What about\n>\n> \thttp://news.gmane.org/find-root.php?group=gmane.comp.version-control.git&article=120990\n\n> ?  I think it's save, but I didn't get any feed-back by you yet.\n\nNor anybody else for that matter ;-).\n\nA patch that adds a new feature to a low-level building block without any\nin-tree users, especially if there is no test for it, ranks very low in\nthe priority scale when I am short of time.\n"},{"id":"115998","messageId":"1244626926-19841-1-git-send-email-u.kleine-koenig@pengutronix.de","threadId":"19755","inReplyTo":"7vzlcgr088.fsf@alter.siamese.dyndns.org","subject":"[PATCH 1/2] more tests for git rev-parse --parse-opt","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-06-10T09:42:05Z","receivedAt":"2009-06-10T09:42:05Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n---\nHello,\n\nI'm not completely sure that it's portable to use input redirection and\n&& together---at least it looks a bit ugly.  Probably you know better.\n\nBest regards\nUwe\n\n t/t1502-rev-parse-parseopt.sh |   48 +++++++++++++++++++++++++++++++++++++++-\n 1 files changed, 46 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh\nindex 997002d..081812b 100755\n--- a/t/t1502-rev-parse-parseopt.sh\n+++ b/t/t1502-rev-parse-parseopt.sh\n@@ -20,8 +20,7 @@ Extras\n \n EOF\n \n-test_expect_success 'test --parseopt help output' '\n-\tgit rev-parse --parseopt -- -h 2> output.err <<EOF\n+OPTION_SPEC=\"\\\n some-command [options] <args>...\n \n some-command does foo and bar!\n@@ -36,8 +35,53 @@ C?        option C with an optional argument\n \n Extras\n extra1    line above used to cause a segfault but no longer does\n+\"\n+\n+test_expect_success 'test --parseopt help output' '\n+\tgit rev-parse --parseopt -- -h 2> output.err <<EOF\n+$OPTION_SPEC\n EOF\n \ttest_cmp expect.err output.err\n '\n \n+cat > expect <<EOF\n+set -- --foo --bar 'ham' -- 'arg'\n+EOF\n+\n+test_expect_success 'test --parseopt' '\n+\tgit rev-parse --parseopt -- --foo --bar=ham arg << EOF > output &&\n+$OPTION_SPEC\n+EOF\n+\ttest_cmp expect output\n+'\n+\n+test_expect_success 'test --parseopt with mixed options and arguments' '\n+\tgit rev-parse --parseopt -- --foo arg --bar=ham << EOF > output &&\n+$OPTION_SPEC\n+EOF\n+\ttest_cmp expect output\n+'\n+\n+cat > expect <<EOF\n+set -- --foo -- 'arg' '--bar=ham'\n+EOF\n+\n+test_expect_success 'test --parseopt with --' '\n+\tgit rev-parse --parseopt -- --foo -- arg --bar=ham << EOF > output &&\n+$OPTION_SPEC\n+EOF\n+\ttest_cmp expect output\n+'\n+\n+cat > expect <<EOF\n+set -- --foo -- '--' 'arg' '--bar=ham'\n+EOF\n+\n+test_expect_success 'test --parseopt --keep-dashdash' '\n+\tgit rev-parse --parseopt --keep-dashdash -- --foo -- arg --bar=ham << EOF > output &&\n+$OPTION_SPEC\n+EOF\n+\ttest_cmp expect output\n+'\n+\n test_done\n-- \n1.6.3.1\n"},{"id":"115999","messageId":"1244626926-19841-2-git-send-email-u.kleine-koenig@pengutronix.de","threadId":"19755","inReplyTo":"1244626926-19841-1-git-send-email-u.kleine-koenig@pengutronix.de","subject":"[PATCH 2/2] parse-opt: make PARSE_OPT_STOP_AT_NON_OPTION available to git rev-parse","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-06-10T09:42:06Z","receivedAt":"2009-06-10T09:42:06Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n---\nHi Junio,\n\n> Nor anybody else for that matter ;-).\nI just didn't want to upset Peff as he answered to my inital patch.\n\n> A patch that adds a new feature to a low-level building block without any\n> in-tree users, especially if there is no test for it, ranks very low in\n> the priority scale when I am short of time.\nOK for me.  While waiting for you to have more time I added a few tests,\nfor the new and old code. :-)\n\nBest regards\nUwe\n\n Documentation/git-rev-parse.txt |    5 +++++\n builtin-rev-parse.c             |    8 ++++++--\n t/t1502-rev-parse-parseopt.sh   |    7 +++++++\n 3 files changed, 18 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt\nindex 4bbdd05..82045a2 100644\n--- a/Documentation/git-rev-parse.txt\n+++ b/Documentation/git-rev-parse.txt\n@@ -30,6 +30,11 @@ OPTIONS\n \tOnly meaningful in `--parseopt` mode. Tells the option parser to echo\n \tout the first `--` met instead of skipping it.\n \n+--stop-at-non-option::\n+\tOnly meaningful in `--parseopt` mode.  Lets the option parser stop at\n+\tthe first non-option argument.  This can be used to parse sub-commands\n+\tthat take options themself.\n+\n --sq-quote::\n \tUse 'git-rev-parse' in shell quoting mode (see SQ-QUOTE\n \tsection below). In contrast to the `--sq` option below, this\ndiff --git a/builtin-rev-parse.c b/builtin-rev-parse.c\nindex 112d622..5ea7518 100644\n--- a/builtin-rev-parse.c\n+++ b/builtin-rev-parse.c\n@@ -301,7 +301,7 @@ static const char *skipspaces(const char *s)\n \n static int cmd_parseopt(int argc, const char **argv, const char *prefix)\n {\n-\tstatic int keep_dashdash = 0;\n+\tstatic int keep_dashdash = 0, stop_at_non_option = 0;\n \tstatic char const * const parseopt_usage[] = {\n \t\t\"git rev-parse --parseopt [options] -- [<args>...]\",\n \t\tNULL\n@@ -309,6 +309,9 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)\n \tstatic struct option parseopt_opts[] = {\n \t\tOPT_BOOLEAN(0, \"keep-dashdash\", &keep_dashdash,\n \t\t\t\t\t\"keep the `--` passed as an arg\"),\n+\t\tOPT_BOOLEAN(0, \"stop-at-non-option\", &stop_at_non_option,\n+\t\t\t\t\t\"stop parsing after the \"\n+\t\t\t\t\t\"first non-option argument\"),\n \t\tOPT_END(),\n \t};\n \n@@ -394,7 +397,8 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)\n \tALLOC_GROW(opts, onb + 1, osz);\n \tmemset(opts + onb, 0, sizeof(opts[onb]));\n \targc = parse_options(argc, argv, prefix, opts, usage,\n-\t                     keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0);\n+\t\t\tkeep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0 |\n+\t\t\tstop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0);\n \n \tstrbuf_addf(&parsed, \" --\");\n \tsq_quote_argv(&parsed, argv, 0);\ndiff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh\nindex 081812b..93f2cd1 100755\n--- a/t/t1502-rev-parse-parseopt.sh\n+++ b/t/t1502-rev-parse-parseopt.sh\n@@ -73,6 +73,13 @@ EOF\n \ttest_cmp expect output\n '\n \n+test_expect_success 'test --parseopt --stop-at-non-option' '\n+\tgit rev-parse --parseopt --stop-at-non-option -- --foo arg --bar=ham << EOF > output &&\n+$OPTION_SPEC\n+EOF\n+\ttest_cmp expect output\n+'\n+\n cat > expect <<EOF\n set -- --foo -- '--' 'arg' '--bar=ham'\n EOF\n-- \n1.6.3.1\n"},{"id":"116002","messageId":"4A2F8CEC.4080600@viscovery.net","threadId":"19755","inReplyTo":"1244626926-19841-1-git-send-email-u.kleine-koenig@pengutronix.de","subject":"Re: [PATCH 1/2] more tests for git rev-parse --parse-opt","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-06-10T10:37:32Z","receivedAt":"2009-06-10T10:37:32Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Uwe Kleine-König schrieb:\n> I'm not completely sure that it's portable to use input redirection and\n> && together---at least it looks a bit ugly.  Probably you know better.\n\nThe problem is more likely that there are shells that dislike heredocs in\neval'ed expressions. But we use such constructs already in other tests, so\nit should not matter a lot. Since you are modifying the code anyway, you\ncan \"do it right\".\n\n> -test_expect_success 'test --parseopt help output' '\n> -\tgit rev-parse --parseopt -- -h 2> output.err <<EOF\n> +OPTION_SPEC=\"\\\n>  some-command [options] <args>...\n>  \n>  some-command does foo and bar!\n> @@ -36,8 +35,53 @@ C?        option C with an optional argument\n>  \n>  Extras\n>  extra1    line above used to cause a segfault but no longer does\n> +\"\n> +\n> +test_expect_success 'test --parseopt help output' '\n> +\tgit rev-parse --parseopt -- -h 2> output.err <<EOF\n> +$OPTION_SPEC\n>  EOF\n>  \ttest_cmp expect.err output.err\n>  '\n\nYou use the same input in this and all new tests; make this:\n\ncat > optionspec <<EOF\n...\nEOF\n\ntest_expect_success 'test --parseopt help output' '\n\tgit rev-parse --parseopt -- -h 2> output.err < optionspec &&\n\ttest_cmp expect.err output.err\n\n(note the added &&).\n\n-- Hannes\n"},{"id":"116011","messageId":"20090610141614.GA20299@pengutronix.de","threadId":"19755","inReplyTo":"4A2F8CEC.4080600@viscovery.net","subject":"Re: [PATCH 1/2] more tests for git rev-parse --parse-opt","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-06-10T14:16:14Z","receivedAt":"2009-06-10T14:16:14Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello Johannes,\n\nOn Wed, Jun 10, 2009 at 12:37:32PM +0200, Johannes Sixt wrote:\n> Uwe Kleine-König schrieb:\n> > -test_expect_success 'test --parseopt help output' '\n> > -\tgit rev-parse --parseopt -- -h 2> output.err <<EOF\n> > +OPTION_SPEC=\"\\\n> >  some-command [options] <args>...\n> >  \n> >  some-command does foo and bar!\n> > @@ -36,8 +35,53 @@ C?        option C with an optional argument\n> >  \n> >  Extras\n> >  extra1    line above used to cause a segfault but no longer does\n> > +\"\n> > +\n> > +test_expect_success 'test --parseopt help output' '\n> > +\tgit rev-parse --parseopt -- -h 2> output.err <<EOF\n> > +$OPTION_SPEC\n> >  EOF\n> >  \ttest_cmp expect.err output.err\n> >  '\n> \n> You use the same input in this and all new tests; make this:\n> \n> cat > optionspec <<EOF\n> ...\n> EOF\n> \n> test_expect_success 'test --parseopt help output' '\n> \tgit rev-parse --parseopt -- -h 2> output.err < optionspec &&\n> \ttest_cmp expect.err output.err\n> \n> (note the added &&).\nOK, this should work.  I will rework it later today.\n\nBTW: I wonder why\n\n\tgit rev-parse --parseopt -- -h 2> output.err < optionspec\n\nfills output.err, is there some magic that detects that the help should\nbe printed?  *read some source*  ah, -h is hardcoded to print the help.\nThis is a bit surprising, still more as -h is a valid option in the\nspecified optionspec.  Thoughts?\n\nThanks\nUwe\n\n-- \nPengutronix e.K.                              | Uwe Kleine-König            |\nIndustrial Linux Solutions                    | http://www.pengutronix.de/  |\n"},{"id":"116259","messageId":"1244937523-6194-1-git-send-email-u.kleine-koenig@pengutronix.de","threadId":"19755","inReplyTo":"20090610141614.GA20299@pengutronix.de","subject":"[PATCH 1/2] more tests for git rev-parse --parse-opt","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-06-13T23:58:42Z","receivedAt":"2009-06-13T23:58:42Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n---\n t/t1502-rev-parse-parseopt.sh |   38 ++++++++++++++++++++++++++++++++++++--\n 1 files changed, 36 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh\nindex 997002d..be0959e 100755\n--- a/t/t1502-rev-parse-parseopt.sh\n+++ b/t/t1502-rev-parse-parseopt.sh\n@@ -20,8 +20,7 @@ Extras\n \n EOF\n \n-test_expect_success 'test --parseopt help output' '\n-\tgit rev-parse --parseopt -- -h 2> output.err <<EOF\n+cat > optionspec << EOF\n some-command [options] <args>...\n \n some-command does foo and bar!\n@@ -37,7 +36,42 @@ C?        option C with an optional argument\n Extras\n extra1    line above used to cause a segfault but no longer does\n EOF\n+\n+test_expect_success 'test --parseopt help output' '\n+\tgit rev-parse --parseopt -- -h 2> output.err < optionspec\n \ttest_cmp expect.err output.err\n '\n \n+cat > expect <<EOF\n+set -- --foo --bar 'ham' -- 'arg'\n+EOF\n+\n+test_expect_success 'test --parseopt' '\n+\tgit rev-parse --parseopt -- --foo --bar=ham arg < optionspec > output &&\n+\ttest_cmp expect output\n+'\n+\n+test_expect_success 'test --parseopt with mixed options and arguments' '\n+\tgit rev-parse --parseopt -- --foo arg --bar=ham < optionspec > output &&\n+\ttest_cmp expect output\n+'\n+\n+cat > expect <<EOF\n+set -- --foo -- 'arg' '--bar=ham'\n+EOF\n+\n+test_expect_success 'test --parseopt with --' '\n+\tgit rev-parse --parseopt -- --foo -- arg --bar=ham < optionspec > output &&\n+\ttest_cmp expect output\n+'\n+\n+cat > expect <<EOF\n+set -- --foo -- '--' 'arg' '--bar=ham'\n+EOF\n+\n+test_expect_success 'test --parseopt --keep-dashdash' '\n+\tgit rev-parse --parseopt --keep-dashdash -- --foo -- arg --bar=ham < optionspec > output &&\n+\ttest_cmp expect output\n+'\n+\n test_done\n-- \n1.6.3.1\n"},{"id":"116260","messageId":"1244937523-6194-2-git-send-email-u.kleine-koenig@pengutronix.de","threadId":"19755","inReplyTo":"1244937523-6194-1-git-send-email-u.kleine-koenig@pengutronix.de","subject":"[PATCH 2/2] parse-opt: make PARSE_OPT_STOP_AT_NON_OPTION available to git rev-parse","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2009-06-13T23:58:43Z","receivedAt":"2009-06-13T23:58:43Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n---\n Documentation/git-rev-parse.txt |    5 +++++\n builtin-rev-parse.c             |    8 ++++++--\n t/t1502-rev-parse-parseopt.sh   |    5 +++++\n 3 files changed, 16 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt\nindex 4bbdd05..82045a2 100644\n--- a/Documentation/git-rev-parse.txt\n+++ b/Documentation/git-rev-parse.txt\n@@ -30,6 +30,11 @@ OPTIONS\n \tOnly meaningful in `--parseopt` mode. Tells the option parser to echo\n \tout the first `--` met instead of skipping it.\n \n+--stop-at-non-option::\n+\tOnly meaningful in `--parseopt` mode.  Lets the option parser stop at\n+\tthe first non-option argument.  This can be used to parse sub-commands\n+\tthat take options themself.\n+\n --sq-quote::\n \tUse 'git-rev-parse' in shell quoting mode (see SQ-QUOTE\n \tsection below). In contrast to the `--sq` option below, this\ndiff --git a/builtin-rev-parse.c b/builtin-rev-parse.c\nindex 112d622..5ea7518 100644\n--- a/builtin-rev-parse.c\n+++ b/builtin-rev-parse.c\n@@ -301,7 +301,7 @@ static const char *skipspaces(const char *s)\n \n static int cmd_parseopt(int argc, const char **argv, const char *prefix)\n {\n-\tstatic int keep_dashdash = 0;\n+\tstatic int keep_dashdash = 0, stop_at_non_option = 0;\n \tstatic char const * const parseopt_usage[] = {\n \t\t\"git rev-parse --parseopt [options] -- [<args>...]\",\n \t\tNULL\n@@ -309,6 +309,9 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)\n \tstatic struct option parseopt_opts[] = {\n \t\tOPT_BOOLEAN(0, \"keep-dashdash\", &keep_dashdash,\n \t\t\t\t\t\"keep the `--` passed as an arg\"),\n+\t\tOPT_BOOLEAN(0, \"stop-at-non-option\", &stop_at_non_option,\n+\t\t\t\t\t\"stop parsing after the \"\n+\t\t\t\t\t\"first non-option argument\"),\n \t\tOPT_END(),\n \t};\n \n@@ -394,7 +397,8 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)\n \tALLOC_GROW(opts, onb + 1, osz);\n \tmemset(opts + onb, 0, sizeof(opts[onb]));\n \targc = parse_options(argc, argv, prefix, opts, usage,\n-\t                     keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0);\n+\t\t\tkeep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0 |\n+\t\t\tstop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0);\n \n \tstrbuf_addf(&parsed, \" --\");\n \tsq_quote_argv(&parsed, argv, 0);\ndiff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh\nindex be0959e..e504058 100755\n--- a/t/t1502-rev-parse-parseopt.sh\n+++ b/t/t1502-rev-parse-parseopt.sh\n@@ -65,6 +65,11 @@ test_expect_success 'test --parseopt with --' '\n \ttest_cmp expect output\n '\n \n+test_expect_success 'test --parseopt --stop-at-non-option' '\n+\tgit rev-parse --parseopt --stop-at-non-option -- --foo arg --bar=ham < optionspec > output &&\n+\ttest_cmp expect output\n+'\n+\n cat > expect <<EOF\n set -- --foo -- '--' 'arg' '--bar=ham'\n EOF\n-- \n1.6.3.1\n"}]}