rev-parse doc: pass "--" to rev-parse in the --prefix example
authorRichard Hansen <hansenr@google.com>
Tue, 10 Jan 2017 20:41:50 +0000 (15:41 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 10 Jan 2017 21:22:19 +0000 (13:22 -0800)
The "--" argument avoids "ambiguous argument: unknown revision or
path not in the working tree" errors when a pathname argument refers
to a non-existent file.

The "--" passed explicitly to set was removed because rev-parse
outputs the "--" argument that it is given.

Signed-off-by: Richard Hansen <hansenr@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-rev-parse.txt
index b6c6326cdc7bb42993cf16fcae0d492944720e51..7241e968935505cdb9d507ab910b35178fcbf3bd 100644 (file)
@@ -91,7 +91,8 @@ repository.  For example:
 ----
 prefix=$(git rev-parse --show-prefix)
 cd "$(git rev-parse --show-toplevel)"
-eval "set -- $(git rev-parse --sq --prefix "$prefix" "$@")"
+# rev-parse provides the -- needed for 'set'
+eval "set $(git rev-parse --sq --prefix "$prefix" -- "$@")"
 ----
 
 --verify::