@matheusbsbs / matheus-bagliano / commits / 50ab6558bf
Fork 0

request-pull: protect against OPTIONS_KEEPDASHDASH from environment

Like most git commands, request-pull supports a -- delimiter to allow callers to pass arguments that would otherwise be treated as an option afterwards. The internal OPTIONS_KEEPDASHDASH variable is passed empty to git-sh-setup to indicate that request-pull itself does not care about the position of the -- delimiter. But if the user has that variable in her environment, request-pull will see the “--” and fail. Empty it explicitly to guard against this. While at it, make the corresponding fix to git-resurrect, too (all other scripts in git.git already protect themselves). Acked-by: Thomas Rast <trast@student.ethz.ch> Acked-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jonathan Nieder committed Apr 24, 2010 at 07:15 UTC 50ab6558bf688e15048e189bdaf9174b217e1748
3 files changed +16
contrib/git-resurrect.sh
+1
@@ -9,6 +9,7 @@ other/Merge <other> into <name> (respectively) commit subjects, which
9 is rather slow but allows you to resurrect other people's topic
10 branches."
11
12 +OPTIONS_KEEPDASHDASH=
13 OPTIONS_SPEC="\
14 git resurrect $USAGE
15 --
git-request-pull.sh
+1
@@ -8,6 +8,7 @@ USAGE='<start> <url> [<end>]'
8 LONG_USAGE='Summarizes the changes between two commits to the standard output,
9 and includes the given URL in the generated summary.'
10 SUBDIRECTORY_OK='Yes'
11 +OPTIONS_KEEPDASHDASH=
12 OPTIONS_SPEC='git request-pull [options] start url [end]
13 --
14 p show patch text as well
t/t5150-request-pull.sh
+14
@@ -211,4 +211,18 @@ test_expect_success 'pull request format' '
211
212 '
213
214 +test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' '
215 +
216 + (
217 + cd local &&
218 + OPTIONS_KEEPDASHDASH=Yes &&
219 + export OPTIONS_KEEPDASHDASH &&
220 + git checkout initial &&
221 + git merge --ff-only master &&
222 + git push origin master:for-upstream &&
223 + git request-pull -- initial "$downstream_url" >../request
224 + )
225 +
226 +'
227 +
228 test_done