summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/rev-parse.c11
-rwxr-xr-xt/t1506-rev-parse-diagnosis.sh9
2 files changed, 15 insertions, 5 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index ed200c8af1..293428fa0d 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -622,6 +622,12 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
+ if (as_is) {
+ if (show_file(arg, output_prefix) && as_is < 2)
+ verify_filename(prefix, arg, 0);
+ continue;
+ }
+
if (!strcmp(arg, "--local-env-vars")) {
int i;
for (i = 0; local_repo_env[i]; i++)
@@ -655,11 +661,6 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
i++;
continue;
}
- if (as_is) {
- if (show_file(arg, output_prefix) && as_is < 2)
- verify_filename(prefix, arg, 0);
- continue;
- }
if (!strcmp(arg,"-n")) {
if (++i >= argc)
die("-n requires an argument");
diff --git a/t/t1506-rev-parse-diagnosis.sh b/t/t1506-rev-parse-diagnosis.sh
index 3e657e693b..2ed5d50059 100755
--- a/t/t1506-rev-parse-diagnosis.sh
+++ b/t/t1506-rev-parse-diagnosis.sh
@@ -254,4 +254,13 @@ test_expect_success 'escaped char does not trigger wildcard rule' '
test_must_fail git rev-parse "foo\\*bar"
'
+test_expect_success 'arg after dashdash not interpreted as option' '
+ cat >expect <<-\EOF &&
+ --
+ --local-env-vars
+ EOF
+ git rev-parse -- --local-env-vars >actual &&
+ test_cmp expect actual
+'
+
test_done