1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
From git-owner@vger.kernel.org Wed Apr 10 11:18:40 2019
Date: 10 Apr 2019 18:18:35 +0700
Message-ID: <20190410111834.GA25638@ash>
From: "Duy Nguyen" <pclouds@gmail.com>
Sender: git-owner@vger.kernel.org
Subject: Re: regression AGAIN in output of git-pull --rebase --recurse-submodules=yes --quiet
References: <robbat2-20180120T054223-685328376Z@orbis-terrarum.net>
<robbat2-20190410T062730-540884809Z@orbis-terrarum.net>
List-ID: <git.vger.kernel.org>
...
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
|