Skip to content

Commit 50ab655

Browse files
jrngitster
authored andcommitted
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 <[email protected]> Acked-by: Miklos Vajna <[email protected]> Signed-off-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 30c56ea commit 50ab655

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

contrib/git-resurrect.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ other/Merge <other> into <name> (respectively) commit subjects, which
99
is rather slow but allows you to resurrect other people's topic
1010
branches."
1111

12+
OPTIONS_KEEPDASHDASH=
1213
OPTIONS_SPEC="\
1314
git resurrect $USAGE
1415
--

git-request-pull.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ USAGE='<start> <url> [<end>]'
88
LONG_USAGE='Summarizes the changes between two commits to the standard output,
99
and includes the given URL in the generated summary.'
1010
SUBDIRECTORY_OK='Yes'
11+
OPTIONS_KEEPDASHDASH=
1112
OPTIONS_SPEC='git request-pull [options] start url [end]
1213
--
1314
p show patch text as well

t/t5150-request-pull.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,4 +211,18 @@ test_expect_success 'pull request format' '
211211
212212
'
213213

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+
214228
test_done

0 commit comments

Comments
 (0)