Skip to content

Commit 4d4b573

Browse files
moygitster
authored andcommitted
setup: clarify error messages for file/revisions ambiguity
The previous "Use '--' to separate filenames from revisions" may sound obvious for an old-time Unix user, but does not make it clear how to use this '--'. In addition to mentionning this '--', give an idea of what the new command should look like. Ideally, we could provide cut-and-paste ready commands based on the command that just failed, but we have no easy access to argv[] in this place of the code. Signed-off-by: Matthieu Moy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0e4c882 commit 4d4b573

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

setup.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static void NORETURN die_verify_filename(const char *prefix,
8282

8383
if (!diagnose_misspelt_rev)
8484
die("%s: no such path in the working tree.\n"
85-
"Use '-- <path>...' to specify paths that do not exist locally.",
85+
"Use 'git <command> -- <path>...' to specify paths that do not exist locally.",
8686
arg);
8787
/*
8888
* Saying "'(icase)foo' does not exist in the index" when the
@@ -96,7 +96,8 @@ static void NORETURN die_verify_filename(const char *prefix,
9696

9797
/* ... or fall back the most general message. */
9898
die("ambiguous argument '%s': unknown revision or path not in the working tree.\n"
99-
"Use '--' to separate paths from revisions", arg);
99+
"Use '--' to separate paths from revisions, like this:\n"
100+
"'git <command> [<revision>...] -- [<file>...]'", arg);
100101

101102
}
102103

@@ -145,7 +146,8 @@ void verify_non_filename(const char *prefix, const char *arg)
145146
if (!check_filename(prefix, arg))
146147
return;
147148
die("ambiguous argument '%s': both revision and filename\n"
148-
"Use '--' to separate filenames from revisions", arg);
149+
"Use '--' to separate paths from revisions, like this:\n"
150+
"'git <command> [<revision>...] -- [<file>...]'", arg);
149151
}
150152

151153
/*

0 commit comments

Comments
 (0)