{"thread":{"id":"34041","subject":"git diff bug?","startedAt":"2013-06-06T21:26:41Z","lastAt":"2013-06-10T14:41:04Z","messageCount":6,"participants":["Sarma Tangirala","Célestin Matte","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"219563","messageId":"CANd8icJ_1mqT9m-n3wPPdjzG1oNjwxfQeUA6YL6KVxbq0iEa1g@mail.gmail.com","threadId":"34041","inReplyTo":null,"subject":"git diff bug?","fromName":"Sarma Tangirala","fromEmail":"vtangira@buffalo.edu","sentAt":"2013-06-06T21:26:41Z","receivedAt":"2013-06-06T21:26:41Z","isPatch":false,"sender":{"key":"vtangira@buffalo.edu","avatar":null},"body":"Hello All,\n\nIf I did 'git diff HEAD^..HEAD -- file' should git not report some\nkind of warning if it could not match the file? For example, if 'file'\nwere infact 'dir/file' and 'file' were unique, would it not be a good\nidea to report that in the present working directory 'file' were not\nfound but 'dir/file' were a match?\n\nApologies if I missed this in the man page.\n\nThanks\n\n--\n010\n001\n111\n"},{"id":"219566","messageId":"51B10236.2030009@ensimag.fr","threadId":"34041","inReplyTo":"CANd8icJ_1mqT9m-n3wPPdjzG1oNjwxfQeUA6YL6KVxbq0iEa1g@mail.gmail.com","subject":"Re: git diff bug?","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-06T21:42:14Z","receivedAt":"2013-06-06T21:42:14Z","isPatch":false,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Le 06/06/2013 23:26, Sarma Tangirala a écrit :\n> Hello All,\n> \n> If I did 'git diff HEAD^..HEAD -- file' should git not report some\n> kind of warning if it could not match the file? For example, if 'file'\n> were infact 'dir/file' and 'file' were unique, would it not be a good\n> idea to report that in the present working directory 'file' were not\n> found but 'dir/file' were a match?\n\nI don't know any program doing such a thing, and I don't think it is the\nrole of the program to predict which file the user actually wanted to\nprovide in the command line.\nThat would imply looking for files with the same name or a close name in\nthe current directory and its subdirectories - and maybe even in the\nsuperdirectory? It is hard to decide when you have to stop looking for\nthe file.\n"},{"id":"219568","messageId":"7v4ndayjdt.fsf@alter.siamese.dyndns.org","threadId":"34041","inReplyTo":"51B10236.2030009@ensimag.fr","subject":"Re: git diff bug?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-06-06T22:17:02Z","receivedAt":"2013-06-06T22:17:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Célestin Matte <celestin.matte@ensimag.fr> writes:\n\n> Le 06/06/2013 23:26, Sarma Tangirala a écrit :\n>> Hello All,\n>> \n>> If I did 'git diff HEAD^..HEAD -- file' should git not report some\n>> kind of warning if it could not match the file? For example, if 'file'\n>> were infact 'dir/file' and 'file' were unique, would it not be a good\n>> idea to report that in the present working directory 'file' were not\n>> found but 'dir/file' were a match?\n>\n> I don't know any program doing such a thing, and I don't think it is the\n> role of the program to predict which file the user actually wanted to\n> provide in the command line.\n> That would imply looking for files with the same name or a close name in\n> the current directory and its subdirectories - and maybe even in the\n> superdirectory? It is hard to decide when you have to stop looking for\n> the file.\n\nThe parameters after \"--\" are pathspecs, which is a set of patterns\nthe paths discovered by the operation (in this case \"diff\" that\nfinds paths in HEAD^ and HEAD) are matched against.  They are used\nto filter out uninteresting paths.\n\nIf HEAD^ and HEAD does not have anything that match the given\npattern (in this case, literal four-letter string \"file\"), the set\nof interesting paths may become empty and that is perfectly normal.\n\nSo this is working as designed.\n\nHaving said that, we do detect typo by noticing when a pathspec did\nnot find _any_ path that matched it in some front-end Porcelain\ncommands, e.g.\n\n\t$ git add 'foo*'\n        fatal: pathspec 'foo*' did not match any files\n\nIt is unreasonable to do the same in \"git log old..new -- path\" and\nerror out when the pathspec does not match, because it is normal for\nsome revisions to have path while some other revisions to lack it.\n\nBut for a two-endpoint diff Porcelain (not the plumbing diff-files,\ndiff-index and diff-tree), I do not think it is particularly a bad\nidea to add such a \"typo-detection\" feature.\n"},{"id":"219643","messageId":"CANd8ic+6AtWgbK3S7DMkaOz7K9WJYdq8ozP9mesc-vJRhxLjqg@mail.gmail.com","threadId":"34041","inReplyTo":"7v4ndayjdt.fsf@alter.siamese.dyndns.org","subject":"Re: git diff bug?","fromName":"Sarma Tangirala","fromEmail":"vtangira@buffalo.edu","sentAt":"2013-06-07T16:01:07Z","receivedAt":"2013-06-07T16:01:07Z","isPatch":false,"sender":{"key":"vtangira@buffalo.edu","avatar":null},"body":"On Thu, Jun 6, 2013 at 6:17 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Célestin Matte <celestin.matte@ensimag.fr> writes:\n>\n\n> But for a two-endpoint diff Porcelain (not the plumbing diff-files,\n> diff-index and diff-tree), I do not think it is particularly a bad\n> idea to add such a \"typo-detection\" feature.\n\nI was wondering if this feature is going to be added and if I could\ntry implementing it.\n\n--\n010\n001\n111\n"},{"id":"220277","messageId":"51B5CA2B.101@ensimag.fr","threadId":"34041","inReplyTo":"CANd8ic+6AtWgbK3S7DMkaOz7K9WJYdq8ozP9mesc-vJRhxLjqg@mail.gmail.com","subject":"Re: git diff bug?","fromName":"Célestin Matte","fromEmail":"celestin.matte@ensimag.fr","sentAt":"2013-06-10T12:44:27Z","receivedAt":"2013-06-10T12:44:27Z","isPatch":false,"sender":{"key":"celestin.matte@ensimag.fr","avatar":"https://avatars.githubusercontent.com/u/2753554?v=4"},"body":"Le 07/06/2013 18:01, Sarma Tangirala a écrit :\n> On Thu, Jun 6, 2013 at 6:17 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Célestin Matte <celestin.matte@ensimag.fr> writes:\n>>\n> \n>> But for a two-endpoint diff Porcelain (not the plumbing diff-files,\n>> diff-index and diff-tree), I do not think it is particularly a bad\n>> idea to add such a \"typo-detection\" feature.\n> \n> I was wondering if this feature is going to be added and if I could\n> try implementing it.\n\nSince nobody answered you (publicly at least), I will try doing it myself:\nI think the best thing to do if you want a feature to be added is to\ncome with a patch and request for comments on it. Then, people will\ndiscuss it and decide whether it's worth adding it to git. So yes, you\ncan try implementing it - all work is welcome :)\n\n-- \nCélestin Matte\n"},{"id":"220294","messageId":"CANd8icJxGO0r0iezB0hO+OhFFATDG=vV=jUJNGROs+BGMYNmzQ@mail.gmail.com","threadId":"34041","inReplyTo":"51B5CA2B.101@ensimag.fr","subject":"Re: git diff bug?","fromName":"Sarma Tangirala","fromEmail":"vtangira@buffalo.edu","sentAt":"2013-06-10T14:41:04Z","receivedAt":"2013-06-10T14:41:04Z","isPatch":false,"sender":{"key":"vtangira@buffalo.edu","avatar":null},"body":"On Mon, Jun 10, 2013 at 8:44 AM, Célestin Matte\n<celestin.matte@ensimag.fr> wrote:\n\n> Since nobody answered you (publicly at least), I will try doing it myself:\n> I think the best thing to do if you want a feature to be added is to\n> come with a patch and request for comments on it. Then, people will\n> discuss it and decide whether it's worth adding it to git. So yes, you\n> can try implementing it - all work is welcome :)\n\nThat sounds great. I will try implementing and send out a patch soon!\n\n\n--\n010\n001\n111\n"}]}