All of lore.kernel.org
 help / color / mirror / Atom feed
From: Duy Nguyen <pclouds@gmail.com>
To: "Robin H. Johnson" <robbat2@gentoo.org>
Cc: Git Mailing List <git@vger.kernel.org>,
	Prathamesh Chavan <pc44800@gmail.com>
Subject: Re: regression AGAIN in output of git-pull --rebase --recurse-submodules=yes --quiet
Date: Wed, 10 Apr 2019 18:18:35 +0700	[thread overview]
Message-ID: <20190410111834.GA25638@ash> (raw)
In-Reply-To: <robbat2-20190410T062730-540884809Z@orbis-terrarum.net>

On Wed, Apr 10, 2019 at 06:41:05AM +0000, Robin H. Johnson wrote:
> A year ago, I raised <robbat2-20190410T062730-540884809Z@orbis-terrarum.net> 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@gentoo.org
> > 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@gentoo.org
> GnuPG FP : 11ACBA4F 4778E3F6 E4EDF38E B27B944E 34884E85
> GnuPG FP : 7D0B3CEB E9B85B1F 825BCECF EE05E6F6 A48F6136



  reply	other threads:[~2019-04-10 11:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-20  5:57 regression in output of git-pull --rebase --recurse-submodules=yes --quiet Robin H. Johnson
2018-01-25 19:08 ` [PATCH] builtin/pull: respect verbosity settings in submodules Stefan Beller
2018-01-25 19:18   ` Junio C Hamano
2019-04-10  6:41 ` regression AGAIN in output of git-pull --rebase --recurse-submodules=yes --quiet Robin H. Johnson
2019-04-10 11:18   ` Duy Nguyen [this message]
2019-04-12  7:08     ` Robin H. Johnson
2019-04-12  9:25       ` Duy Nguyen
2019-04-15 14:40       ` Johannes Schindelin
     [not found]     ` <CAODn77oL6sj5zvxgPGw=4TNqmnSeBq4=j2r2nx_51YHooECo7w@mail.gmail.com>
2019-04-16  7:48       ` Duy Nguyen
2019-04-12 10:08   ` [PATCH] submodule foreach: fix "<command> --quiet" not being respected Nguyễn Thái Ngọc Duy
2019-04-12 17:22     ` Robin H. Johnson
2019-04-15  2:59       ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190410111834.GA25638@ash \
    --to=pclouds@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=pc44800@gmail.com \
    --cc=robbat2@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.