Re: regression AGAIN in output of git-pull --rebase --recurse-submodules=yes --quiet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Apr 10, 2019 at 06:41:05AM +0000, Robin H. Johnson wrote:
> A year ago, I raised <robbat2-20190410T062730-540884809Z@xxxxxxxxxxxxxxxxxx> as an issue,
> which lead to commit commit a56771a668dd4963675914bc5da0e1e015952dae.
> 
> The exact same workload somewhere between 2.18.0 and 2.19.0 has caused
> the message to come back. I noticed it first in a 2.18.0->2.21.0
> upgrade, and did a partial bisect based on tags to trace it to 2.19.0.
> 
> ===
> $ git submodule foreach --quiet git pull origin master --quiet >/dev/null
> From git://anongit.gentoo.org/data/gentoo-news
>  * branch            master     -> FETCH_HEAD
> From git://anongit.gentoo.org/data/glep
>  * branch            master     -> FETCH_HEAD
> ===

If you run this with GIT_TRACE=1, you can see that --quiet is passed
to submodule--helper correctly.

trace: built-in: git submodule--helper foreach --quiet git pull --quiet origin master

The problem here is the option parser of this command would try to
parse all options, so it considers both --quiet the same thing and are
to tell "submodule--foreach" to be quiet, the second --quiet is not
part of the "git pull" command anymore.

So the fix would be to pass "--" to stop option parsing.
submodule--helper should not parse options it does not understand
anyway. Something like this should work.

-- 8< --
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index 6bcc4f1bd7..6394222628 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -571,7 +571,7 @@ static int module_foreach(int argc, const char **argv, const char *prefix)
 	};
 
 	argc = parse_options(argc, argv, prefix, module_foreach_options,
-			     git_submodule_helper_usage, PARSE_OPT_KEEP_UNKNOWN);
+			     git_submodule_helper_usage, 0);
 
 	if (module_list_compute(0, NULL, prefix, &pathspec, &list) < 0)
 		return 1;
diff --git a/git-submodule.sh b/git-submodule.sh
index 2c0fb6d723..a967b2890d 100755
--- a/git-submodule.sh
+++ b/git-submodule.sh
@@ -346,7 +346,7 @@ cmd_foreach()
 		shift
 	done
 
-	git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} submodule--helper foreach ${GIT_QUIET:+--quiet} ${recursive:+--recursive} "$@"
+	git ${wt_prefix:+-C "$wt_prefix"} ${prefix:+--super-prefix "$prefix"} submodule--helper foreach ${GIT_QUIET:+--quiet} ${recursive:+--recursive} -- "$@"
 }
 
 #
-- 8< --

I'm a bit reluctant to follow up with a proper patch because I can't
digest the t5572-submodule-pull.sh tests. And we definitely need to
add a test case about --quiet to make sure it won't happen again.
--
Duy

> 
> I suspect it was a result of:
> ea27893a65cc41cad2710466aa6a58866ff22f1e Merge branch 'pc/submodule-helper-foreach'
> 
> But I haven't done a full bisect to prove it yet.
> 
> On Sat, Jan 20, 2018 at 05:57:29AM +0000, Robin H. Johnson wrote:
> > Somewhere between 2.13.6 & 2.14.1 there's an output regression. I
> > haven't done a bisect to trace it down further yet.
> > 
> > Specifically, --rebase --recurse-submodules=yes seems to cause --quiet
> > to not be effective anymore.
> > 
> > Full commandline:
> > $ git pull --rebase --recurse-submodules --quiet
> > 
> > In 2.13.6, there is no output, it's quiet as expect.
> > 
> > In 2.14.1, you get:
> > HEAD is up to date.
> > Submodule path '_data/news': rebased into 'a50b763c338161b4621d23e9fa5cd6e11455d6ca'
> > HEAD is up to date.
> > Submodule path 'glep': rebased into 'e1f100ec3ba44ab1672d61cabf4690b355e46158'
> > 
> > Steps to reproduction:
> > 1. git clone --recurse-submodules \
> >  https://anongit.gentoo.org/git/sites/www.git
> > 2. cd www
> > 3. git submodule foreach --quiet git pull --quiet origin master
> > 4. git pull --rebase --recurse-submodules=yes --quiet
> > 
> > Repeat step 4 for repeated bug output.
> > If you drop the --rebase, then you need to re-run step 3 first.
> > 
> > -- 
> > Robin Hugh Johnson
> > Gentoo Linux: Dev, Infra Lead, Foundation Treasurer
> > E-Mail   : robbat2@xxxxxxxxxx
> > GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
> > GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136
> 
> 
> 
> -- 
> Robin Hugh Johnson
> Gentoo Linux: Dev, Infra Lead, Foundation Treasurer
> E-Mail   : robbat2@xxxxxxxxxx
> GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
> GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux