{"thread":{"id":"3175","subject":"[PATCH] diff: add --no-diff-deleted to make -p more pleasant","startedAt":"2006-01-29T14:24:04Z","lastAt":"2006-01-30T18:08:46Z","messageCount":4,"participants":["Eric Wong","Junio C Hamano","Jon Loeliger"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"15203","messageId":"20060129142403.GA15482@Muzzle","threadId":"3175","inReplyTo":null,"subject":"[PATCH] diff: add --no-diff-deleted to make -p more pleasant","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-01-29T14:24:04Z","receivedAt":"2006-01-29T14:24:04Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"This is a feature I've stol^Wborrowed from svn that I find very\nuseful since I usually don't care to see what I've deleted.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n\n---\n\n diff.c |    6 ++++++\n diff.h |    3 +++\n 2 files changed, 9 insertions(+), 0 deletions(-)\n\n0b426af15a7da4f430d9cca8c1ad057557d93627\ndiff --git a/diff.c b/diff.c\nindex f45d18c..6db3e19 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -769,6 +769,7 @@ void diff_setup(struct diff_options *opt\n {\n \tmemset(options, 0, sizeof(*options));\n \toptions->output_format = DIFF_FORMAT_RAW;\n+\toptions->diff_deleted = 1;\n \toptions->line_termination = '\\n';\n \toptions->break_opt = -1;\n \toptions->rename_limit = -1;\n@@ -849,6 +850,8 @@ int diff_opt_parse(struct diff_options *\n \t}\n \telse if (!strcmp(arg, \"--find-copies-harder\"))\n \t\toptions->find_copies_harder = 1;\n+\telse if (!strcmp(arg, \"--no-diff-deleted\"))\n+\t\toptions->diff_deleted = 0;\n \telse if (!strcmp(arg, \"--abbrev\"))\n \t\toptions->abbrev = DEFAULT_ABBREV;\n \telse if (!strncmp(arg, \"--abbrev=\", 9)) {\n@@ -1103,6 +1106,9 @@ int diff_unmodified_pair(struct diff_fil\n \n static void diff_flush_patch(struct diff_filepair *p, struct diff_options *o)\n {\n+\tif (!o->diff_deleted && (p->status == DIFF_STATUS_DELETED))\n+\t\treturn;\n+\n \tif (diff_unmodified_pair(p))\n \t\treturn;\n \ndiff --git a/diff.h b/diff.h\nindex 9a0169c..4f320ac 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -39,6 +39,7 @@ struct diff_options {\n \tint find_copies_harder;\n \tint line_termination;\n \tint output_format;\n+\tint diff_deleted;\n \tint pickaxe_opts;\n \tint rename_score;\n \tint reverse_diff;\n@@ -120,6 +121,8 @@ extern void diffcore_std_no_resolve(stru\n \"  -C            detect copies.\\n\" \\\n \"  --find-copies-harder\\n\" \\\n \"                try unchanged files as candidate for copy detection.\\n\" \\\n+\"  --no-diff-deleted\\n\" \\\n+\"                do not print patch format for deleted files\\n\" \\\n \"  -l<n>         limit rename attempts up to <n> paths.\\n\" \\\n \"  -O<file>      reorder diffs according to the <file>.\\n\" \\\n \"  -S<string>    find filepair whose only one side contains the string.\\n\" \\\n-- \n1.1.5.gae18-dirty\n"},{"id":"15217","messageId":"7vy80ykd3j.fsf@assigned-by-dhcp.cox.net","threadId":"3175","inReplyTo":"20060129142403.GA15482@Muzzle","subject":"Re: [PATCH] diff: add --no-diff-deleted to make -p more pleasant","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-01-29T20:12:32Z","receivedAt":"2006-01-29T20:12:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> This is a feature I've stol^Wborrowed from svn that I find very\n> useful since I usually don't care to see what I've deleted.\n\nThere is a thing called --diff-filter, and \n\n\tgit diff -p --no-diff-deleted\n\nis equivalent to\n\n\tgit diff -p --diff-filter=AM\n\nwhen you are not using rename/copy detection (and a byte\nshorter).  Or maybe improve its syntax to also take:\n\n\t--diff-filter=-D\n\nThat is, a minus followed by list of undesired change class\nletters.\n"},{"id":"15237","messageId":"20060130003820.GE15482@Muzzle","threadId":"3175","inReplyTo":"7vy80ykd3j.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] diff: add --no-diff-deleted to make -p more pleasant","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-01-30T00:38:20Z","receivedAt":"2006-01-30T00:38:20Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <junkio@cox.net> wrote:\n> Eric Wong <normalperson@yhbt.net> writes:\n> \n> > This is a feature I've stol^Wborrowed from svn that I find very\n> > useful since I usually don't care to see what I've deleted.\n> \n> There is a thing called --diff-filter, and \n> \n> \tgit diff -p --no-diff-deleted\n> \n> is equivalent to\n> \n> \tgit diff -p --diff-filter=AM\n\nCool, didn't notice this feature before.  Thanks.\n\n> when you are not using rename/copy detection (and a byte\n> shorter).  Or maybe improve its syntax to also take:\n> \n> \t--diff-filter=-D\n> \n> That is, a minus followed by list of undesired change class\n> letters.\n\nHmm.. maybe another day.  AM is good enough for now.\n\n-- \nEric Wong\n"},{"id":"15267","messageId":"1138644525.24410.18.camel@cashmere.sps.mot.com","threadId":"3175","inReplyTo":"7vy80ykd3j.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] diff: add --no-diff-deleted to make -p more pleasant","fromName":"Jon Loeliger","fromEmail":"jdl@freescale.com","sentAt":"2006-01-30T18:08:46Z","receivedAt":"2006-01-30T18:08:46Z","isPatch":true,"sender":{"key":"jdl@jdl.com","avatar":"https://gravatar.com/avatar/75ce9a10b151acd2c28ec4ab2136dba7b2ff1634530bd04b155981a749d08a64?d=mp&s=160"},"body":"On Sun, 2006-01-29 at 14:12, Junio C Hamano wrote:\n> Eric Wong <normalperson@yhbt.net> writes:\n> \n> > This is a feature I've stol^Wborrowed from svn that I find very\n> > useful since I usually don't care to see what I've deleted.\n> \n> There is a thing called --diff-filter, and \n> \n> \tgit diff -p --no-diff-deleted\n> \n> is equivalent to\n> \n> \tgit diff -p --diff-filter=AM\n> \n> when you are not using rename/copy detection (and a byte\n> shorter).\n\nHmmm.... I think this may be the problem:\n\n    % grep -r diff-filter Documentation/\n    Documentation/git-diff.txt:$ git diff --diff-filter=MRC <1>\n\nAnd that is:\n\n    Limiting the diff output::\n    +\n    ------------\n    $ git diff --diff-filter=MRC <1>\n    $ git diff --name-status -r <2>\n    $ git diff arch/i386 include/asm-i386 <3>\n \n    <1> show only modification, rename and copy, but not addition\n    nor deletion.\n    <2> show only names and the nature of change, but not actual\n    diff output.  --name-status disables usual patch generation\n    which in turn also disables recursive behaviour, so without -r\n    you would only see the directory name if there is a change in a\n    file in a subdirectory.\n    <3> limit diff output to named subtrees.\n\nThat's pretty thin documentation there.\nUnless someone beats me to it, I'll try to find\na spare documentation cycle...\n\njdl\n"}]}