summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-09-09 12:26:35 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-09-09 12:26:36 -0700
commit4a12f89865236789b5723277bb6809e92ce68f54 (patch)
tree3b42d70a0914171eae0b2e1ef6be0d5af6fc6114 /Documentation
parentMerge branch 'jk/repo-init-cleanup' (diff)
parentgitcli: document --end-of-options (diff)
downloadtgif-4a12f89865236789b5723277bb6809e92ce68f54.tar.xz
Merge branch 'jk/eoo'
The command line parser learned "--end-of-options" notation; the standard convention for scripters to have hardcoded set of options first on the command line, and force the command to treat end-user input as non-options, has been to use "--" as the delimiter, but that would not work for commands that use "--" as a delimiter between revs and pathspec. * jk/eoo: gitcli: document --end-of-options parse-options: allow --end-of-options as a synonym for "--" revision: allow --end-of-options to end option parsing
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/gitcli.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/Documentation/gitcli.txt b/Documentation/gitcli.txt
index 1ed3ca33b7..4b32876b6e 100644
--- a/Documentation/gitcli.txt
+++ b/Documentation/gitcli.txt
@@ -37,6 +37,12 @@ arguments. Here are the rules:
file called HEAD in your work tree, `git diff HEAD` is ambiguous, and
you have to say either `git diff HEAD --` or `git diff -- HEAD` to
disambiguate.
+
+ * Because `--` disambiguates revisions and paths in some commands, it
+ cannot be used for those commands to separate options and revisions.
+ You can use `--end-of-options` for this (it also works for commands
+ that do not distinguish between revisions in paths, in which case it
+ is simply an alias for `--`).
+
When writing a script that is expected to handle random user-input, it is
a good practice to make it explicit which arguments are which by placing