threads / discuss / 19755

notice: pu broken tonight

Subject: notice: pu broken tonight

## tl;dr

10 messages between Jun 9, 2009 and Jun 13, 2009.

replies: 9people: 4as markdown or json

Junio C Hamano· Jun 9, 2009, 08:36 UTC · lore

I've queued a handful of patches from yesterday on maint and master, advanced sp/msysgit topic to next, and queued the remaining new patches along with the old topics on pu.

I added "just in case output from strerror() had % in it" patch to tr/die_errno topic when I queued it, but I didn't look at the conversion from die() to die_errno().

Also I didn't queue the show-branch default_arg patch. Other than that I do not think I forgot to queue any patch I saw on the list.

I usually make sure all four branches pass the tests before pushing them out, but in tonight's integration, the tip of 'pu' does not pass test for me, hence this notice.

René Scharfe· Jun 9, 2009, 17:11 UTC · re: Junio C Hamano · lore

Re: notice: pu broken tonight

Junio C Hamano schrieb:
> I usually make sure all four branches pass the tests before pushing them
> out, but in tonight's integration, the tip of 'pu' does not pass test for
> me, hence this notice.

The following patch makes the tests pass again for me. Feel free to squash it into 10c29915.

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 2d36f78..25029a9 100644
--- a/Makefile
+++ b/Makefile
@@ -921,7 +921,7 @@ SANE_TOOL_PATH_SQ = $(subst ','\'',$(SANE_TOOL_PATH))
 BROKEN_PATH_FIX = 's|^\# @@BROKEN_PATH_FIX@@$$|git_broken_path_fix $(SANE_TOOL_PATH_SQ)|'
 PATH := $(SANE_TOOL_PATH):${PATH}
 else
-BROKEN_PATH_FIX = d
+BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
 endif
 
 ifeq ($(uname_S),Darwin)
Uwe Kleine-König· Jun 10, 2009, 07:44 UTC · re: Junio C Hamano · lore

Re: notice: pu broken tonight

Hello Junio,
On Tue, Jun 09, 2009 at 01:36:20AM -0700, Junio C Hamano wrote:
>                                                         Other than that I
> do not think I forgot to queue any patch I saw on the list.
What about
	http://news.gmane.org/find-root.php?group=gmane.comp.version-control.git&article=120990

? I think it's save, but I didn't get any feed-back by you yet. (And I won't believe you when you say you didn't see it, because you took

	http://news.gmane.org/find-root.php?group=gmane.comp.version-control.git&article=117807
from the same thread. :-))

Best regards Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
Junio C Hamano· Jun 10, 2009, 07:56 UTC · re: Uwe Kleine-König · lore

Re: notice: pu broken tonight

Uwe Kleine-König  <u.kleine-koenig@pengutronix.de> writes:
Show 8 quoted lines
> Hello Junio,
>
> On Tue, Jun 09, 2009 at 01:36:20AM -0700, Junio C Hamano wrote:
>>                                                         Other than that I
>> do not think I forgot to queue any patch I saw on the list.
> What about
>
> 	http://news.gmane.org/find-root.php?group=gmane.comp.version-control.git&article=120990
> ?  I think it's save, but I didn't get any feed-back by you yet.
Nor anybody else for that matter ;-).

A patch that adds a new feature to a low-level building block without any in-tree users, especially if there is no test for it, ranks very low in the priority scale when I am short of time.

Uwe Kleine-König· Jun 10, 2009, 09:42 UTC · re: Junio C Hamano · lore

[PATCH 1/2] more tests for git rev-parse --parse-opt

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,

I'm not completely sure that it's portable to use input redirection and && together---at least it looks a bit ugly. Probably you know better.

Best regards Uwe

 t/t1502-rev-parse-parseopt.sh |   48 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index 997002d..081812b 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -20,8 +20,7 @@ Extras
 
 EOF
 
-test_expect_success 'test --parseopt help output' '
-	git rev-parse --parseopt -- -h 2> output.err <<EOF
+OPTION_SPEC="\
 some-command [options] <args>...
 
 some-command does foo and bar!
@@ -36,8 +35,53 @@ C?        option C with an optional argument
 
 Extras
 extra1    line above used to cause a segfault but no longer does
+"
+
+test_expect_success 'test --parseopt help output' '
+	git rev-parse --parseopt -- -h 2> output.err <<EOF
+$OPTION_SPEC
 EOF
 	test_cmp expect.err output.err
 '
 
+cat > expect <<EOF
+set -- --foo --bar 'ham' -- 'arg'
+EOF
+
+test_expect_success 'test --parseopt' '
+	git rev-parse --parseopt -- --foo --bar=ham arg << EOF > output &&
+$OPTION_SPEC
+EOF
+	test_cmp expect output
+'
+
+test_expect_success 'test --parseopt with mixed options and arguments' '
+	git rev-parse --parseopt -- --foo arg --bar=ham << EOF > output &&
+$OPTION_SPEC
+EOF
+	test_cmp expect output
+'
+
+cat > expect <<EOF
+set -- --foo -- 'arg' '--bar=ham'
+EOF
+
+test_expect_success 'test --parseopt with --' '
+	git rev-parse --parseopt -- --foo -- arg --bar=ham << EOF > output &&
+$OPTION_SPEC
+EOF
+	test_cmp expect output
+'
+
+cat > expect <<EOF
+set -- --foo -- '--' 'arg' '--bar=ham'
+EOF
+
+test_expect_success 'test --parseopt --keep-dashdash' '
+	git rev-parse --parseopt --keep-dashdash -- --foo -- arg --bar=ham << EOF > output &&
+$OPTION_SPEC
+EOF
+	test_cmp expect output
+'
+
 test_done
-- 
1.6.3.1
Uwe Kleine-König· Jun 10, 2009, 09:42 UTC · re: Uwe Kleine-König · lore

[PATCH 2/2] parse-opt: make PARSE_OPT_STOP_AT_NON_OPTION available to git rev-parse

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hi Junio,
> Nor anybody else for that matter ;-).
I just didn't want to upset Peff as he answered to my inital patch.
> A patch that adds a new feature to a low-level building block without any
> in-tree users, especially if there is no test for it, ranks very low in
> the priority scale when I am short of time.

OK for me. While waiting for you to have more time I added a few tests, for the new and old code. :-)

Best regards Uwe

 Documentation/git-rev-parse.txt |    5 +++++
 builtin-rev-parse.c             |    8 ++++++--
 t/t1502-rev-parse-parseopt.sh   |    7 +++++++
 3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 4bbdd05..82045a2 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -30,6 +30,11 @@ OPTIONS
 	Only meaningful in `--parseopt` mode. Tells the option parser to echo
 	out the first `--` met instead of skipping it.
 
+--stop-at-non-option::
+	Only meaningful in `--parseopt` mode.  Lets the option parser stop at
+	the first non-option argument.  This can be used to parse sub-commands
+	that take options themself.
+
 --sq-quote::
 	Use 'git-rev-parse' in shell quoting mode (see SQ-QUOTE
 	section below). In contrast to the `--sq` option below, this
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 112d622..5ea7518 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -301,7 +301,7 @@ static const char *skipspaces(const char *s)
 
 static int cmd_parseopt(int argc, const char **argv, const char *prefix)
 {
-	static int keep_dashdash = 0;
+	static int keep_dashdash = 0, stop_at_non_option = 0;
 	static char const * const parseopt_usage[] = {
 		"git rev-parse --parseopt [options] -- [<args>...]",
 		NULL
@@ -309,6 +309,9 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
 	static struct option parseopt_opts[] = {
 		OPT_BOOLEAN(0, "keep-dashdash", &keep_dashdash,
 					"keep the `--` passed as an arg"),
+		OPT_BOOLEAN(0, "stop-at-non-option", &stop_at_non_option,
+					"stop parsing after the "
+					"first non-option argument"),
 		OPT_END(),
 	};
 
@@ -394,7 +397,8 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
 	ALLOC_GROW(opts, onb + 1, osz);
 	memset(opts + onb, 0, sizeof(opts[onb]));
 	argc = parse_options(argc, argv, prefix, opts, usage,
-	                     keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0);
+			keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0 |
+			stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0);
 
 	strbuf_addf(&parsed, " --");
 	sq_quote_argv(&parsed, argv, 0);
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index 081812b..93f2cd1 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -73,6 +73,13 @@ EOF
 	test_cmp expect output
 '
 
+test_expect_success 'test --parseopt --stop-at-non-option' '
+	git rev-parse --parseopt --stop-at-non-option -- --foo arg --bar=ham << EOF > output &&
+$OPTION_SPEC
+EOF
+	test_cmp expect output
+'
+
 cat > expect <<EOF
 set -- --foo -- '--' 'arg' '--bar=ham'
 EOF
-- 
1.6.3.1
Johannes Sixt· Jun 10, 2009, 10:37 UTC · re: Uwe Kleine-König · lore

Re: [PATCH 1/2] more tests for git rev-parse --parse-opt

Uwe Kleine-König schrieb:
> I'm not completely sure that it's portable to use input redirection and
> && together---at least it looks a bit ugly.  Probably you know better.

The problem is more likely that there are shells that dislike heredocs in eval'ed expressions. But we use such constructs already in other tests, so it should not matter a lot. Since you are modifying the code anyway, you can "do it right".

Show 18 quoted lines
> -test_expect_success 'test --parseopt help output' '
> -	git rev-parse --parseopt -- -h 2> output.err <<EOF
> +OPTION_SPEC="\
>  some-command [options] <args>...
>  
>  some-command does foo and bar!
> @@ -36,8 +35,53 @@ C?        option C with an optional argument
>  
>  Extras
>  extra1    line above used to cause a segfault but no longer does
> +"
> +
> +test_expect_success 'test --parseopt help output' '
> +	git rev-parse --parseopt -- -h 2> output.err <<EOF
> +$OPTION_SPEC
>  EOF
>  	test_cmp expect.err output.err
>  '
You use the same input in this and all new tests; make this:

cat > optionspec <<EOF ... EOF

test_expect_success 'test --parseopt help output' '
	git rev-parse --parseopt -- -h 2> output.err < optionspec &&
	test_cmp expect.err output.err
(note the added &&).
-- Hannes
Uwe Kleine-König· Jun 10, 2009, 14:16 UTC · re: Johannes Sixt · lore

Re: [PATCH 1/2] more tests for git rev-parse --parse-opt

Hello Johannes,
On Wed, Jun 10, 2009 at 12:37:32PM +0200, Johannes Sixt wrote:
Show 31 quoted lines
> Uwe Kleine-König schrieb:
> > -test_expect_success 'test --parseopt help output' '
> > -	git rev-parse --parseopt -- -h 2> output.err <<EOF
> > +OPTION_SPEC="\
> >  some-command [options] <args>...
> >  
> >  some-command does foo and bar!
> > @@ -36,8 +35,53 @@ C?        option C with an optional argument
> >  
> >  Extras
> >  extra1    line above used to cause a segfault but no longer does
> > +"
> > +
> > +test_expect_success 'test --parseopt help output' '
> > +	git rev-parse --parseopt -- -h 2> output.err <<EOF
> > +$OPTION_SPEC
> >  EOF
> >  	test_cmp expect.err output.err
> >  '
> 
> You use the same input in this and all new tests; make this:
> 
> cat > optionspec <<EOF
> ...
> EOF
> 
> test_expect_success 'test --parseopt help output' '
> 	git rev-parse --parseopt -- -h 2> output.err < optionspec &&
> 	test_cmp expect.err output.err
> 
> (note the added &&).
OK, this should work.  I will rework it later today.
BTW: I wonder why
	git rev-parse --parseopt -- -h 2> output.err < optionspec

fills output.err, is there some magic that detects that the help should be printed? *read some source* ah, -h is hardcoded to print the help. This is a bit surprising, still more as -h is a valid option in the specified optionspec. Thoughts?

Thanks Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
Uwe Kleine-König· Jun 13, 2009, 23:58 UTC · re: Uwe Kleine-König · lore

[PATCH 1/2] more tests for git rev-parse --parse-opt

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 t/t1502-rev-parse-parseopt.sh |   38 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 2 deletions(-)
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index 997002d..be0959e 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -20,8 +20,7 @@ Extras
 
 EOF
 
-test_expect_success 'test --parseopt help output' '
-	git rev-parse --parseopt -- -h 2> output.err <<EOF
+cat > optionspec << EOF
 some-command [options] <args>...
 
 some-command does foo and bar!
@@ -37,7 +36,42 @@ C?        option C with an optional argument
 Extras
 extra1    line above used to cause a segfault but no longer does
 EOF
+
+test_expect_success 'test --parseopt help output' '
+	git rev-parse --parseopt -- -h 2> output.err < optionspec
 	test_cmp expect.err output.err
 '
 
+cat > expect <<EOF
+set -- --foo --bar 'ham' -- 'arg'
+EOF
+
+test_expect_success 'test --parseopt' '
+	git rev-parse --parseopt -- --foo --bar=ham arg < optionspec > output &&
+	test_cmp expect output
+'
+
+test_expect_success 'test --parseopt with mixed options and arguments' '
+	git rev-parse --parseopt -- --foo arg --bar=ham < optionspec > output &&
+	test_cmp expect output
+'
+
+cat > expect <<EOF
+set -- --foo -- 'arg' '--bar=ham'
+EOF
+
+test_expect_success 'test --parseopt with --' '
+	git rev-parse --parseopt -- --foo -- arg --bar=ham < optionspec > output &&
+	test_cmp expect output
+'
+
+cat > expect <<EOF
+set -- --foo -- '--' 'arg' '--bar=ham'
+EOF
+
+test_expect_success 'test --parseopt --keep-dashdash' '
+	git rev-parse --parseopt --keep-dashdash -- --foo -- arg --bar=ham < optionspec > output &&
+	test_cmp expect output
+'
+
 test_done
-- 
1.6.3.1
Uwe Kleine-König· Jun 13, 2009, 23:58 UTC · re: Uwe Kleine-König · lore

[PATCH 2/2] parse-opt: make PARSE_OPT_STOP_AT_NON_OPTION available to git rev-parse

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 Documentation/git-rev-parse.txt |    5 +++++
 builtin-rev-parse.c             |    8 ++++++--
 t/t1502-rev-parse-parseopt.sh   |    5 +++++
 3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 4bbdd05..82045a2 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -30,6 +30,11 @@ OPTIONS
 	Only meaningful in `--parseopt` mode. Tells the option parser to echo
 	out the first `--` met instead of skipping it.
 
+--stop-at-non-option::
+	Only meaningful in `--parseopt` mode.  Lets the option parser stop at
+	the first non-option argument.  This can be used to parse sub-commands
+	that take options themself.
+
 --sq-quote::
 	Use 'git-rev-parse' in shell quoting mode (see SQ-QUOTE
 	section below). In contrast to the `--sq` option below, this
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 112d622..5ea7518 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -301,7 +301,7 @@ static const char *skipspaces(const char *s)
 
 static int cmd_parseopt(int argc, const char **argv, const char *prefix)
 {
-	static int keep_dashdash = 0;
+	static int keep_dashdash = 0, stop_at_non_option = 0;
 	static char const * const parseopt_usage[] = {
 		"git rev-parse --parseopt [options] -- [<args>...]",
 		NULL
@@ -309,6 +309,9 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
 	static struct option parseopt_opts[] = {
 		OPT_BOOLEAN(0, "keep-dashdash", &keep_dashdash,
 					"keep the `--` passed as an arg"),
+		OPT_BOOLEAN(0, "stop-at-non-option", &stop_at_non_option,
+					"stop parsing after the "
+					"first non-option argument"),
 		OPT_END(),
 	};
 
@@ -394,7 +397,8 @@ static int cmd_parseopt(int argc, const char **argv, const char *prefix)
 	ALLOC_GROW(opts, onb + 1, osz);
 	memset(opts + onb, 0, sizeof(opts[onb]));
 	argc = parse_options(argc, argv, prefix, opts, usage,
-	                     keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0);
+			keep_dashdash ? PARSE_OPT_KEEP_DASHDASH : 0 |
+			stop_at_non_option ? PARSE_OPT_STOP_AT_NON_OPTION : 0);
 
 	strbuf_addf(&parsed, " --");
 	sq_quote_argv(&parsed, argv, 0);
diff --git a/t/t1502-rev-parse-parseopt.sh b/t/t1502-rev-parse-parseopt.sh
index be0959e..e504058 100755
--- a/t/t1502-rev-parse-parseopt.sh
+++ b/t/t1502-rev-parse-parseopt.sh
@@ -65,6 +65,11 @@ test_expect_success 'test --parseopt with --' '
 	test_cmp expect output
 '
 
+test_expect_success 'test --parseopt --stop-at-non-option' '
+	git rev-parse --parseopt --stop-at-non-option -- --foo arg --bar=ham < optionspec > output &&
+	test_cmp expect output
+'
+
 cat > expect <<EOF
 set -- --foo -- '--' 'arg' '--bar=ham'
 EOF
-- 
1.6.3.1

← back to recent threads