{"thread":{"id":"31176","subject":"[PATCH] setup: clarify error messages for file/revisions ambiguity","startedAt":"2012-08-03T08:21:20Z","lastAt":"2012-08-03T08:21:20Z","messageCount":1,"participants":["Matthieu Moy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"196397","messageId":"1343982080-15054-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"31176","inReplyTo":null,"subject":"[PATCH] setup: clarify error messages for file/revisions ambiguity","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2012-08-03T08:21:20Z","receivedAt":"2012-08-03T08:21:20Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"The previous \"Use '--' to separate filenames from revisions\" may sound\nobvious for an old-time Unix user, but does not make it clear how to use\nthis '--'. In addition to mentionning this '--', give an idea of what the\nnew command should look like.\n\nIdeally, we could provide cut-and-paste ready commands based on the\ncommand that just failed, but we have no easy access to argv[] in this\nplace of the code.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n setup.c | 8 +++++---\n 1 file changed, 5 insertions(+), 3 deletions(-)\n\ndiff --git a/setup.c b/setup.c\nindex 9139bee..3a1b2fd 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -79,7 +79,7 @@ static void NORETURN die_verify_filename(const char *prefix,\n {\n \tif (!diagnose_misspelt_rev)\n \t\tdie(\"%s: no such path in the working tree.\\n\"\n-\t\t    \"Use '-- <path>...' to specify paths that do not exist locally.\",\n+\t\t    \"Use 'git <command> -- <path>...' to specify paths that do not exist locally.\",\n \t\t    arg);\n \t/*\n \t * Saying \"'(icase)foo' does not exist in the index\" when the\n@@ -92,7 +92,8 @@ static void NORETURN die_verify_filename(const char *prefix,\n \n \t/* ... or fall back the most general message. */\n \tdie(\"ambiguous argument '%s': unknown revision or path not in the working tree.\\n\"\n-\t    \"Use '--' to separate paths from revisions\", arg);\n+\t    \"Use '--' to separate paths from revisions, like this:\\n\"\n+\t    \"'git <command> [<revision>...] -- [<file>...]'\", arg);\n \n }\n \n@@ -141,7 +142,8 @@ void verify_non_filename(const char *prefix, const char *arg)\n \tif (!check_filename(prefix, arg))\n \t\treturn;\n \tdie(\"ambiguous argument '%s': both revision and filename\\n\"\n-\t    \"Use '--' to separate filenames from revisions\", arg);\n+\t    \"Use '--' to separate paths from revisions, like this:\\n\"\n+\t    \"'git <command> [<revision>...] -- [<file>...]'\", arg);\n }\n \n /*\n-- \n1.7.12.rc0.32.g9fb4847.dirty\n"}]}