{"thread":{"id":"41010","subject":"[PATCH] blame: display a more helpful error message if the file was deleted","startedAt":"2015-12-16T00:00:47Z","lastAt":"2015-12-16T19:56:47Z","messageCount":2,"participants":["Alex Henrie","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"274528","messageId":"1450224047-25527-1-git-send-email-alexhenrie24@gmail.com","threadId":"41010","inReplyTo":null,"subject":"[PATCH] blame: display a more helpful error message if the file was deleted","fromName":"Alex Henrie","fromEmail":"alexhenrie24@gmail.com","sentAt":"2015-12-16T00:00:47Z","receivedAt":"2015-12-16T00:00:47Z","isPatch":true,"sender":{"key":"alexhenrie24@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5951993?v=4"},"body":"`git blame 22414770 generate-cmdlist.perl` currently results in:\n    fatal: cannot stat path '22414770': No such file or directory\n\nThis patch changes the error message to:\n    fatal: ambiguous argument 'generate-cmdlist.perl': unknown revision\n    or path not in the working tree.\n    Use '--' to separate paths from revisions, like this:\n    'git <command> [<revision>...] -- [<file>...]'\"\n\nThat way, the user knows to rewrite the command as\n`git blame 22414770 -- generate-cmdlist.perl`.\n\nSigned-off-by: Alex Henrie <alexhenrie24@gmail.com>\n---\n builtin/blame.c | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/builtin/blame.c b/builtin/blame.c\nindex 1df13cf..f070272 100644\n--- a/builtin/blame.c\n+++ b/builtin/blame.c\n@@ -2683,8 +2683,6 @@ parse_done:\n \t\targv[argc - 1] = \"--\";\n \n \t\tsetup_work_tree();\n-\t\tif (!file_exists(path))\n-\t\t\tdie_errno(\"cannot stat path '%s'\", path);\n \t}\n \n \trevs.disable_stdin = 1;\n-- \n2.6.4\n"},{"id":"274598","messageId":"xmqq37v2dv5s.fsf@gitster.mtv.corp.google.com","threadId":"41010","inReplyTo":"1450224047-25527-1-git-send-email-alexhenrie24@gmail.com","subject":"Re: [PATCH] blame: display a more helpful error message if the file was deleted","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-12-16T19:56:47Z","receivedAt":"2015-12-16T19:56:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Henrie <alexhenrie24@gmail.com> writes:\n\n> `git blame 22414770 generate-cmdlist.perl` currently results in:\n>     fatal: cannot stat path '22414770': No such file or directory\n>\n> This patch changes the error message to:\n>     fatal: ambiguous argument 'generate-cmdlist.perl': unknown revision\n>     or path not in the working tree.\n>     Use '--' to separate paths from revisions, like this:\n>     'git <command> [<revision>...] -- [<file>...]'\"\n>\n> That way, the user knows to rewrite the command as\n> `git blame 22414770 -- generate-cmdlist.perl`.\n\nIt is unfortunate that the command line parser of 'blame' needs to\ncater to an oddball syntax, 'git annotate <path> [<rev>]'.\n\nThis change still makes us emit the following funny errors:\n\n    $ ./git blame 00000000 generate-cmdlist.prel\n    fatal: bad revision 'generate-cmdlist.prel'\n    $ ./git blame generate-cmdlist.prel 00000000\n    fatal: bad revision '00000000'\n\nand gives the users a wrong impression that the early argument is\nthe path and then comes the revision.\n\nI'll take the patch as-is, because the original is not better, i.e.\n\n    $ git blame 00000000 generate-cmdlist.prel\n    fatal: cannot stat path '00000000': No such file or directory\n    $ git blame generate-cmdlist.prel 00000000\n    fatal: cannot stat path 'generate-cmdlist.prel': No such file or directory\n\nand the change is not making things worse.\n\nBut I think in the longer term we should deprecate and eventually\nremove 'git annotate' with its odd syntax, so that we can lose the\nspecial case we have in the command line parser of 'git blame'.\n\nThanks.\n\n>\n> Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>\n> ---\n>  builtin/blame.c | 2 --\n>  1 file changed, 2 deletions(-)\n>\n> diff --git a/builtin/blame.c b/builtin/blame.c\n> index 1df13cf..f070272 100644\n> --- a/builtin/blame.c\n> +++ b/builtin/blame.c\n> @@ -2683,8 +2683,6 @@ parse_done:\n>  \t\targv[argc - 1] = \"--\";\n>  \n>  \t\tsetup_work_tree();\n> -\t\tif (!file_exists(path))\n> -\t\t\tdie_errno(\"cannot stat path '%s'\", path);\n>  \t}\n>  \n>  \trevs.disable_stdin = 1;\n"}]}