diff options
Diffstat (limited to 'dev-vcs/git/files')
-rw-r--r-- | dev-vcs/git/files/git-2.21.0-quiet-submodules-testcase.patch | 38 | ||||
-rw-r--r-- | dev-vcs/git/files/git-2.21.0-quiet-submodules.patch | 61 |
2 files changed, 99 insertions, 0 deletions
diff --git a/dev-vcs/git/files/git-2.21.0-quiet-submodules-testcase.patch b/dev-vcs/git/files/git-2.21.0-quiet-submodules-testcase.patch new file mode 100644 index 000000000000..0874ea9352e9 --- /dev/null +++ b/dev-vcs/git/files/git-2.21.0-quiet-submodules-testcase.patch @@ -0,0 +1,38 @@ +From a57994f2d78134936521375ba9798a1b7418e230 Mon Sep 17 00:00:00 2001 +From: "Robin H. Johnson" <robbat2@gentoo.org> +Date: Fri, 12 Apr 2019 00:00:07 -0700 +Subject: [PATCH] submodule foreach: test foreach option swallowing + +Add a testcase for submodule foreach option parsing not knowing where to +stop taking options, and accidently removing options intended for +foreach target commands. + +CC: Duy Nguyen <pclouds@gmail.com> +CC: Prathamesh Chavan <pc44800@gmail.com> +Signed-off-by: Robin H. Johnson <robbat2@gentoo.org> +--- + t/t7407-submodule-foreach.sh | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/t/t7407-submodule-foreach.sh b/t/t7407-submodule-foreach.sh +index 77729ac4aa..706ae762e0 100755 +--- a/t/t7407-submodule-foreach.sh ++++ b/t/t7407-submodule-foreach.sh +@@ -411,4 +411,14 @@ test_expect_success 'multi-argument command passed to foreach is not shell-evalu + test_cmp expected actual + ' + ++test_expect_success 'option-like arguments passed to foreach commands are not lost' ' ++ ( ++ cd super && ++ git submodule foreach "echo be --quiet" > ../expected && ++ git submodule foreach echo be --quiet > ../actual ++ ) && ++ grep -sq -e "--quiet" expected && ++ test_cmp expected actual ++' ++ + test_done +-- +2.21.0 + diff --git a/dev-vcs/git/files/git-2.21.0-quiet-submodules.patch b/dev-vcs/git/files/git-2.21.0-quiet-submodules.patch new file mode 100644 index 000000000000..adb0dfd582a1 --- /dev/null +++ b/dev-vcs/git/files/git-2.21.0-quiet-submodules.patch @@ -0,0 +1,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 + |