git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] request-pull: protect against OPTIONS_KEEPDASHDASH from environment

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Apr 24, 2010, 12:15 UTC
Message-ID
<20100424121537.GB12312@progeny.tock>
In-Reply-To
<20100424120437.GA12237@progeny.tock>

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).

Cc: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Forgot to mention: this series is against maint.  For master, the test
needs a fixup to pass with v1.7.1-rc0~144^2 (request-pull: avoid
mentioning that the start point is a single commit, 2010-01-29), which
I’ll send as a reply.

Thanks for reading. As always, thoughts and simplifying suggestions are welcome.

 contrib/git-resurrect.sh |    1 +
 git-request-pull.sh      |    1 +
 t/t5150-request-pull.sh  |   14 ++++++++++++++
 3 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh
index c364dda..a4ed4c3 100755
--- a/contrib/git-resurrect.sh
+++ b/contrib/git-resurrect.sh
@@ -9,6 +9,7 @@ other/Merge <other> into <name> (respectively) commit subjects, which
 is rather slow but allows you to resurrect other people's topic
 branches."
 
+OPTIONS_KEEPDASHDASH=
 OPTIONS_SPEC="\
 git resurrect $USAGE
 --
diff --git a/git-request-pull.sh b/git-request-pull.sh
index 630cedd..b0a0311 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -8,6 +8,7 @@ USAGE='<start> <url> [<end>]'
 LONG_USAGE='Summarizes the changes between two commits to the standard output,
 and includes the given URL in the generated summary.'
 SUBDIRECTORY_OK='Yes'
+OPTIONS_KEEPDASHDASH=
 OPTIONS_SPEC='git request-pull [options] start url [end]
 --
 p    show patch text as well
diff --git a/t/t5150-request-pull.sh b/t/t5150-request-pull.sh
index e012a36..4c7f48a 100644
--- a/t/t5150-request-pull.sh
+++ b/t/t5150-request-pull.sh
@@ -211,4 +211,18 @@ test_expect_success 'pull request format' '
 
 '
 
+test_expect_success 'request-pull ignores OPTIONS_KEEPDASHDASH poison' '
+
+	(
+		cd local &&
+		OPTIONS_KEEPDASHDASH=Yes &&
+		export OPTIONS_KEEPDASHDASH &&
+		git checkout initial &&
+		git merge --ff-only master &&
+		git push origin master:for-upstream &&
+		git request-pull -- initial "$downstream_url" >../request
+	)
+
+'
+
 test_done
-- 
1.7.1.rc1
Previous: Jonathan NiederNext: Thomas Rast
Message 4 of 6 in “request-pull: protect against OPTIONS_KEEPDASHDASH from environment”
  1. 0/2 request-pull: protect against OPTIONS_KEEPDASHDASH from environmentJonathan Nieder, Apr 24, 2010
  2. 1/2 tests for request-pullJonathan Nieder, Apr 24, 2010
  3. adapt request-pull tests for new pull request formatJonathan Nieder, Apr 24, 2010
  4. 2/2 request-pull: protect against OPTIONS_KEEPDASHDASH from environmentJonathan Nieder, Apr 24, 2010
  5. Thomas RastApr 25, 2010
  6. Miklos VajnaApr 26, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.