{"thread":{"id":"357","subject":"[PATCH] Make -s flag to show-diff a no-op.","startedAt":"2005-04-27T22:06:58Z","lastAt":"2005-04-27T23:11:16Z","messageCount":5,"participants":["Junio C Hamano","Linus Torvalds"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"1916","messageId":"7vfyxbeuwt.fsf@assigned-by-dhcp.cox.net","threadId":"357","inReplyTo":null,"subject":"[PATCH] Make -s flag to show-diff a no-op.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-27T22:06:58Z","receivedAt":"2005-04-27T22:06:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"With the recent \"no-patch-by-default\" change, the -s flag to\nthe show-diff command (and silent variable in the show-diff.c)\nbecame meaningless.  This patch deprecates it.\n\nCogito uses \"show-diff -s\" for the purpose of \"I do not want the\npatch text.  I just want to know if something has potentially\nchanged, in which case I know you will have some output.  I'll\nrun update-cache --refresh if you say something\", so we cannot\nbarf on seeing -s on our command line yet.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\nshow-diff.c |   18 +++++++++---------\n1 files changed, 9 insertions(+), 9 deletions(-)\n\n--- k/show-diff.c\n+++ l/show-diff.c\n@@ -6,12 +6,12 @@\n #include \"cache.h\"\n #include \"diff.h\"\n \n-static const char *show_diff_usage = \"show-diff [-q] [-s] [-z] [-p] [paths...]\";\n+static const char *show_diff_usage =\n+\"show-diff [-p] [-q] [-r] [-z] [paths...]\";\n \n static int generate_patch = 0;\n static int line_termination = '\\n';\n static int silent = 0;\n-static int silent_on_nonexisting_files = 0;\n \n static int matches_pathspec(struct cache_entry *ce, char **spec, int cnt)\n {\n@@ -69,16 +69,16 @@ int main(int argc, char **argv)\n \tint i;\n \n \twhile (1 < argc && argv[1][0] == '-') {\n-\t\tif (!strcmp(argv[1], \"-s\"))\n-\t\t\tsilent_on_nonexisting_files = silent = 1;\n-\t\telse if (!strcmp(argv[1], \"-p\"))\n+\t\tif (!strcmp(argv[1], \"-p\"))\n \t\t\tgenerate_patch = 1;\n \t\telse if (!strcmp(argv[1], \"-q\"))\n-\t\t\tsilent_on_nonexisting_files = 1;\n-\t\telse if (!strcmp(argv[1], \"-z\"))\n-\t\t\tline_termination = 0;\n+\t\t\tsilent = 1;\n \t\telse if (!strcmp(argv[1], \"-r\"))\n \t\t\t; /* no-op */\n+\t\telse if (!strcmp(argv[1], \"-s\"))\n+\t\t\t; /* no-op */\n+\t\telse if (!strcmp(argv[1], \"-z\"))\n+\t\t\tline_termination = 0;\n \t\telse\n \t\t\tusage(show_diff_usage);\n \t\targv++; argc--;\n@@ -116,7 +116,7 @@ int main(int argc, char **argv)\n \t\t\t\tperror(ce->name);\n \t\t\t\tcontinue;\n \t\t\t}\t\n-\t\t\tif (silent_on_nonexisting_files)\n+\t\t\tif (silent)\n \t\t\t\tcontinue;\n \t\t\tshow_file('-', ce);\n \t\t\tcontinue;\n\n"},{"id":"1923","messageId":"Pine.LNX.4.58.0504271520150.18901@ppc970.osdl.org","threadId":"357","inReplyTo":"7vfyxbeuwt.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Make -s flag to show-diff a no-op.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-04-27T22:20:45Z","receivedAt":"2005-04-27T22:20:45Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 27 Apr 2005, Junio C Hamano wrote:\n>\n> With the recent \"no-patch-by-default\" change, the -s flag to\n> the show-diff command (and silent variable in the show-diff.c)\n> became meaningless.  This patch deprecates it.\n\nI also wonder whether \"-p\" should turn on recursion by default (for all \nthe tools). \"-p\" without \"-r\" doesn't really seem to make much sense, does \nit?\n\n\t\tLinus\n"},{"id":"1922","messageId":"7v64y7etko.fsf@assigned-by-dhcp.cox.net","threadId":"357","inReplyTo":"Pine.LNX.4.58.0504271520150.18901@ppc970.osdl.org","subject":"Re: [PATCH] Make -s flag to show-diff a no-op.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-27T22:35:51Z","receivedAt":"2005-04-27T22:35:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n\nLT> I also wonder whether \"-p\" should turn on recursion by default (for all \nLT> the tools). \"-p\" without \"-r\" doesn't really seem to make much sense, does \nLT> it?\n\nWhen I know which path I am interested in,\n\n    $ diff-tree -p <tree-1> <tree-2> ls-tree.c\n\nwould still get the benefit of not descending down into ppc and\nmozilla-sha1 subdirectories, if I am not mistaken.\n\nThink of the kernel sources, and I would say leaving the option\nof not recursing down is a good thing.\n\n"},{"id":"1927","messageId":"Pine.LNX.4.58.0504271600280.18901@ppc970.osdl.org","threadId":"357","inReplyTo":"7v64y7etko.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Make -s flag to show-diff a no-op.","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-04-27T23:05:02Z","receivedAt":"2005-04-27T23:05:02Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 27 Apr 2005, Junio C Hamano wrote:\n> \n> When I know which path I am interested in,\n> \n>     $ diff-tree -p <tree-1> <tree-2> ls-tree.c\n> \n> would still get the benefit of not descending down into ppc and\n> mozilla-sha1 subdirectories, if I am not mistaken.\n\nIt won't. It will see that those two aren't interesting, because they \ndon't match the pathname, so it will ignore them regardless of whether \nthere is a -r or not.\n\n> Think of the kernel sources, and I would say leaving the option\n> of not recursing down is a good thing.\n\nWell, if you give pathnames, it's always going to limit recursion to only \nthose subdirectories that match one of them. \n\nAnd if you don't give pathnames, then nor recursing will do something \npretty strange, ie give a diff of only the files in the top-level \ndirectory, and totally ignore the subdirectories that did change:\n\n\ttorvalds@ppc970:~/v2.6/linux> diff-tree e8108c98dd6d65613fa0ec9d2300f89c48d554bf $(cat .git/HEAD)\n\t*040000->040000 tree    d44b45026cd1c9530a78756b11d6bb9a78718cc3->474afcccb9cac147aa3b95a9afdd91c2edb139f5      arch\n\t*040000->040000 tree    2394cd732a73c793ba93c32be6e7f058bd7171d8->da5f26fc8b12defe39e58b76e8087281effbf6bf      drivers\n\t*040000->040000 tree    8d5010b0ff2b7325131536c63ed04071a563e310->cf51450069a2ab187b611599d1a0e037f176c6c3      fs\n\t*040000->040000 tree    a06b4fb363dcfd3225cfe3ac3a0aa02e8d628975->c27a22db91b056499a5c1198ace432768475b5bd      include\n\nand then\n\n\ttorvalds@ppc970:~/v2.6/linux> diff-tree -p e8108c98dd6d65613fa0ec9d2300f89c48d554bf $(cat .git/HEAD)\n\t<no output what-so-ever>\n\nwhere showing things as if nothing changed seems to be actively _wrong_, \nI'd say..\n\n\t\tLinus\n"},{"id":"1929","messageId":"7vwtqnddd7.fsf@assigned-by-dhcp.cox.net","threadId":"357","inReplyTo":"Pine.LNX.4.58.0504271600280.18901@ppc970.osdl.org","subject":"Re: [PATCH] Make -s flag to show-diff a no-op.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-04-27T23:11:16Z","receivedAt":"2005-04-27T23:11:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":">>>>> \"LT\" == Linus Torvalds <torvalds@osdl.org> writes:\n\nLT> Well, if you give pathnames, it's always going to limit recursion to only \nLT> those subdirectories that match one of them. \n\nIf that is the case then -p should imply -r.  Will fix it up.\n\n"}]}