From b7ebc951da8800f711142f69d9d958bde67a112d Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 28 Apr 2019 09:54:45 +0100 Subject: gentoo resync : 28.04.2019 --- .../git-2.21.0-quiet-submodules-testcase.patch | 38 ++++++++++++++ .../git/files/git-2.21.0-quiet-submodules.patch | 61 ++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 dev-vcs/git/files/git-2.21.0-quiet-submodules-testcase.patch create mode 100644 dev-vcs/git/files/git-2.21.0-quiet-submodules.patch (limited to 'dev-vcs/git/files') 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" +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 +CC: Prathamesh Chavan +Signed-off-by: Robin H. Johnson +--- + 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" +Sender: git-owner@vger.kernel.org +Subject: Re: regression AGAIN in output of git-pull --rebase --recurse-submodules=yes --quiet +References: + +List-ID: + +... + +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 + -- cgit v1.2.3