{"thread":{"id":"1207","subject":"Why is there no git-update-cache --modified (aka I give up)","startedAt":"2005-07-12T05:52:18Z","lastAt":"2005-07-13T19:52:35Z","messageCount":9,"participants":["Marc Singer","Petr Baudis","Junio C Hamano","Matthias Urlichs"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"6018","messageId":"20050712055218.GA18192@buici.com","threadId":"1207","inReplyTo":null,"subject":"Why is there no git-update-cache --modified (aka I give up)","fromName":"Marc Singer","fromEmail":"elf@buici.com","sentAt":"2005-07-12T05:52:18Z","receivedAt":"2005-07-12T05:52:18Z","isPatch":false,"sender":{"key":"elf@buici.com","avatar":null},"body":"  # git-diff-cache HEAD\n\nis really nice.  But, do I really have to invoke git-update-cache with\nevery modified file?  I could write a script to cul the filenames from\ngit-diff-cache, but I'm having a hard time believing that that is how\nothers are preparing their commits.\n"},{"id":"6022","messageId":"20050712072629.GA6363@pasky.ji.cz","threadId":"1207","inReplyTo":"20050712055218.GA18192@buici.com","subject":"Re: Why is there no git-update-cache --modified (aka I give up)","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-07-12T07:26:29Z","receivedAt":"2005-07-12T07:26:29Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Jul 12, 2005 at 07:52:18AM CEST, I got a letter\nwhere Marc Singer <elf@buici.com> told me that...\n>   # git-diff-cache HEAD\n> \n> is really nice.  But, do I really have to invoke git-update-cache with\n> every modified file?  I could write a script to cul the filenames from\n> git-diff-cache, but I'm having a hard time believing that that is how\n> others are preparing their commits.\n\nIt is. :-) It's only that they have cool scripts to do it, e.g.\ncg-commit. (You have to enumerate the files explicitly for\ngit-commit-script as well, IIRC.)\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n<Espy> be careful, some twit might quote you out of context..\n"},{"id":"6026","messageId":"7v7jfwbfvj.fsf@assigned-by-dhcp.cox.net","threadId":"1207","inReplyTo":"20050712055218.GA18192@buici.com","subject":"Re: Why is there no git-update-cache --modified (aka I give up)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-12T08:14:24Z","receivedAt":"2005-07-12T08:14:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marc Singer <elf@buici.com> writes:\n\n>   # git-diff-cache HEAD\n>\n> is really nice.  But, do I really have to invoke git-update-cache with\n> every modified file?  I could write a script to cul the filenames from\n> git-diff-cache, but I'm having a hard time believing that that is how\n> others are preparing their commits.\n\nMe too.  By the way, I think you mean diff-files not\ndiff-cache.\n\nI'd like to know how others do it, since this was the\nfirst thing I automated when I started using GIT.  Having clear\ndistinction between cache (aka index file) and work tree files\nand making user concious decision of when to and when not to\nregister/update index is what is quite different in GIT from\nCVS, SVN and friends [*1*], and while I appreciate its\nflexibility, it often ends up to be simply more typing (and to\ncertain degree more thinking which is not a bad thing) to the\nuser [*2*].\n\nThis snippet is essentially what I do to match the cache with\nthe current work tree [*3*]:\n\n\tcase \"$(git-ls-files --unmerged | sed -e 1q)\" in\n\t?*)\n\t\techo >&2 You have unmerged files and cannot commit.\n        \texit 1\n\t\t;;\n\tesac\n\tgit-update-cache --refresh >/dev/null\n\tgit-diff-files |\n        sed -e 's/.*\t//' |\n\txargs -r git-update-cache --add --remove --\n\n[Footnote]\n\n*1* I vaguely recall reading somewhere that GIT is not the first\nSCM to have these three (not two) levels.  Usual two-level SCM\nneeds to only move between your hackery and what's in the repo,\nand words like \"committing\" and \"checking in\" are used\ninterchangeably, while the other three level SCM (I do not\nremember which one I read about) gives distinct meaning to these\ntwo words.  Can anybody tell me which SCM I am talking about?\n\n*2* The commit flow in GIT is three level thing.  You have HEAD\nversion (a commit with an associated tree already in the object\ndatabase that you have checked out and started with), you have\ncache, and you have files in your work tree.  Checking out is to\nmatch cache and work tree to HEAD; update-cache is to match\ncache to work tree; and committing is to create a new commit\nthat matches the cache and make it your HEAD.  Roughly speaking,\ndiff-* brothers are about comparing these three stages:\n\n - diff-files compares cache and work tree\n - diff-cache compares commit and cache, or commit and work tree\n - diff-tree compares two commits\n\n*3* I do not officially do Porcelain ;-), but the script I use\nis slightly different from the one quoted above.  It uses\n\"git-diff-files -z\" and a helper program to handle filenames\nwith TAB in them.\n"},{"id":"6037","messageId":"20050712155316.GA5841@buici.com","threadId":"1207","inReplyTo":"7v7jfwbfvj.fsf@assigned-by-dhcp.cox.net","subject":"Re: Why is there no git-update-cache --modified (aka I give up)","fromName":"Marc Singer","fromEmail":"elf@buici.com","sentAt":"2005-07-12T15:53:16Z","receivedAt":"2005-07-12T15:53:16Z","isPatch":false,"sender":{"key":"elf@buici.com","avatar":null},"body":"On Tue, Jul 12, 2005 at 01:14:24AM -0700, Junio C Hamano wrote:\n> Marc Singer <elf@buici.com> writes:\n> \n> >   # git-diff-cache HEAD\n> >\n> > is really nice.  But, do I really have to invoke git-update-cache with\n> > every modified file?  I could write a script to cul the filenames from\n> > git-diff-cache, but I'm having a hard time believing that that is how\n> > others are preparing their commits.\n> \n> Me too.  By the way, I think you mean diff-files not\n> diff-cache.\n\nNo, I mean git-diff-cache.  I find that this works pretty well, though.\n\n  # git-update-cache `git-diff-cache | cut -f2`\n\nIt looks like the same thing works for git-diff-files. \n\n  # git-update-cache `git-diff-files | cut -f2`\n\nThis seems to agree with the way you handle things.\n\nSimilarly, there is the need to determine which files are new to the\ntree.  This isn't much of a burden when creating files in the tree,\nbut can be bothersome when using patch since git-apply is conservative\nabout fuzz.\n"},{"id":"6040","messageId":"pan.2005.07.12.16.16.45.990714@smurf.noris.de","threadId":"1207","inReplyTo":"20050712155316.GA5841@buici.com","subject":"Re: Why is there no git-update-cache --modified (aka I give up)","fromName":"Matthias Urlichs","fromEmail":"smurf@smurf.noris.de","sentAt":"2005-07-12T16:16:51Z","receivedAt":"2005-07-12T16:16:51Z","isPatch":false,"sender":{"key":"matthias@urlichs.de","avatar":"https://gravatar.com/avatar/2708905af227313eba6f2b2ae0f7d0259b5ac5d71baef58fe5a13c699ce0bbf0?d=mp&s=160"},"body":"Hi, Marc Singer wrote:\n\n>   # git-update-cache `git-diff-cache | cut -f2`\n\ng-d-c should have an option to print file names only. All that cutting\nand argument-backtick-ing gets pretty nasty when there are a lot of files,\nor if they contain special characters.\n\n-- \nMatthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf@smurf.noris.de\nDisclaimer: The quote was selected randomly. Really. | http://smurf.noris.de\n - -\nGod is a perfect example of the kind of aberration that can result from\nan untrained intellect combining with an unrestrained imagination.\n\t\t-- Simon Ewins\n"},{"id":"6058","messageId":"loom.20050712T224801-163@post.gmane.org","threadId":"1207","inReplyTo":"pan.2005.07.12.16.16.45.990714@smurf.noris.de","subject":"Re: Why is there no git-update-cache --modified (aka I give up)","fromName":"Junio C Hamano","fromEmail":"junkio@twinsun.com","sentAt":"2005-07-12T20:51:17Z","receivedAt":"2005-07-12T20:51:17Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthias Urlichs <smurf <at> smurf.noris.de> writes:\n\n> \n> Hi, Marc Singer wrote:\n> \n> >   # git-update-cache `git-diff-cache | cut -f2`\n> \n> g-d-c should have an option to print file names only. All that cutting\n> and argument-backtick-ing gets pretty nasty when there are a lot of files,\n> or if they contain special characters.\n\nI concur.  I'll add --name-only flag to diff brothers soonish.\n\nSorry I am at work and have turned the incoming connection to my home network\nbefore I left for work today -- this is the same junkio@cox.net who is guilty\nfor all your diff problems ;-).\n"},{"id":"6093","messageId":"7vll4aze0t.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1207","inReplyTo":"loom.20050712T224801-163@post.gmane.org","subject":"[PATCH] diff-stages: support \"-u\" as a synonym for \"-p\".","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-13T19:45:06Z","receivedAt":"2005-07-13T19:45:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Just to be consistent, support \"-u\" as a synonym for \"-p\" like\neverybody else does.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n diff-stages.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\nef519b28e8edb19d4a0233152c9497ee807a4f5b\ndiff --git a/diff-stages.c b/diff-stages.c\n--- a/diff-stages.c\n+++ b/diff-stages.c\n@@ -67,7 +67,7 @@ int main(int ac, const char **av)\n \t\tconst char *arg = av[1];\n \t\tif (!strcmp(arg, \"-r\"))\n \t\t\t; /* as usual */\n-\t\telse if (!strcmp(arg, \"-p\"))\n+\t\telse if (!strcmp(arg, \"-p\") || !strcmp(arg, \"-u\"))\n \t\t\tdiff_output_format = DIFF_FORMAT_PATCH;\n \t\telse if (!strncmp(arg, \"-B\", 2)) {\n \t\t\tif ((diff_break_opt = diff_scoreopt_parse(arg)) == -1)\n"},{"id":"6091","messageId":"7vfyuizdzk.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1207","inReplyTo":"loom.20050712T224801-163@post.gmane.org","subject":"[PATCH] git-diff-*: --name-only and --name-only-z.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-13T19:45:51Z","receivedAt":"2005-07-13T19:45:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Porcelain layers often want to find only names of changed files,\nand even with diff-raw output format they end up having to pick\nout only the filename.  Support --name-only (and --name-only-z\nfor xargs -0 and cpio -0 users that want to treat filenames with\nembedded newlines sanely) flag to help them.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n diff-cache.c  |    8 ++++++++\n diff-files.c  |    4 ++++\n diff-stages.c |    4 ++++\n diff-tree.c   |    8 ++++++++\n diff.c        |   13 ++++++++++++-\n diff.h        |    2 ++\n 6 files changed, 38 insertions(+), 1 deletions(-)\n\nea3228b62de0838cd854ecf503f6f534b0b7e25c\ndiff --git a/diff-cache.c b/diff-cache.c\n--- a/diff-cache.c\n+++ b/diff-cache.c\n@@ -223,6 +223,14 @@ int main(int argc, const char **argv)\n \t\t\tdiff_output_format = DIFF_FORMAT_MACHINE;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!strcmp(arg, \"--name-only\")) {\n+\t\t\tdiff_output_format = DIFF_FORMAT_NAME;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (!strcmp(arg, \"--name-only-z\")) {\n+\t\t\tdiff_output_format = DIFF_FORMAT_NAME_Z;\n+\t\t\tcontinue;\n+\t\t}\n \t\tif (!strcmp(arg, \"-R\")) {\n \t\t\tdiff_setup_opt |= DIFF_SETUP_REVERSE;\n \t\t\tcontinue;\ndiff --git a/diff-files.c b/diff-files.c\n--- a/diff-files.c\n+++ b/diff-files.c\n@@ -55,6 +55,10 @@ int main(int argc, const char **argv)\n \t\t\t; /* no-op */\n \t\telse if (!strcmp(argv[1], \"-z\"))\n \t\t\tdiff_output_format = DIFF_FORMAT_MACHINE;\n+\t\telse if (!strcmp(argv[1], \"--name-only\"))\n+\t\t\tdiff_output_format = DIFF_FORMAT_NAME;\n+\t\telse if (!strcmp(argv[1], \"--name-only-z\"))\n+\t\t\tdiff_output_format = DIFF_FORMAT_NAME_Z;\n \t\telse if (!strcmp(argv[1], \"-R\"))\n \t\t\tdiff_setup_opt |= DIFF_SETUP_REVERSE;\n \t\telse if (!strncmp(argv[1], \"-S\", 2))\ndiff --git a/diff-stages.c b/diff-stages.c\n--- a/diff-stages.c\n+++ b/diff-stages.c\n@@ -87,6 +87,10 @@ int main(int ac, const char **av)\n \t\t\tfind_copies_harder = 1;\n \t\telse if (!strcmp(arg, \"-z\"))\n \t\t\tdiff_output_format = DIFF_FORMAT_MACHINE;\n+\t\telse if (!strcmp(arg, \"--name-only\"))\n+\t\t\tdiff_output_format = DIFF_FORMAT_NAME;\n+\t\telse if (!strcmp(arg, \"--name-only-z\"))\n+\t\t\tdiff_output_format = DIFF_FORMAT_NAME_Z;\n \t\telse if (!strcmp(arg, \"-R\"))\n \t\t\tdiff_setup_opt |= DIFF_SETUP_REVERSE;\n \t\telse if (!strncmp(arg, \"-S\", 2))\ndiff --git a/diff-tree.c b/diff-tree.c\n--- a/diff-tree.c\n+++ b/diff-tree.c\n@@ -480,6 +480,14 @@ int main(int argc, const char **argv)\n \t\t\tfind_copies_harder = 1;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!strcmp(arg, \"--name-only\")) {\n+\t\t\tdiff_output_format = DIFF_FORMAT_NAME;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (!strcmp(arg, \"--name-only-z\")) {\n+\t\t\tdiff_output_format = DIFF_FORMAT_NAME_Z;\n+\t\t\tcontinue;\n+\t\t}\n \t\tif (!strcmp(arg, \"-z\")) {\n \t\t\tdiff_output_format = DIFF_FORMAT_MACHINE;\n \t\t\tcontinue;\ndiff --git a/diff.c b/diff.c\n--- a/diff.c\n+++ b/diff.c\n@@ -818,6 +818,12 @@ static void diff_flush_raw(struct diff_f\n \tputchar(line_termination);\n }\n \n+static void diff_flush_name(struct diff_filepair *p,\n+\t\t\t    int line_termination)\n+{\n+\tprintf(\"%s%c\", p->two->path, line_termination);\n+}\n+\n int diff_unmodified_pair(struct diff_filepair *p)\n {\n \t/* This function is written stricter than necessary to support\n@@ -978,7 +984,8 @@ void diff_flush(int diff_output_style)\n \tint line_termination = '\\n';\n \tint inter_name_termination = '\\t';\n \n-\tif (diff_output_style == DIFF_FORMAT_MACHINE)\n+\tif (diff_output_style == DIFF_FORMAT_MACHINE ||\n+\t    diff_output_style == DIFF_FORMAT_NAME_Z)\n \t\tline_termination = inter_name_termination = 0;\n \n \tfor (i = 0; i < q->nr; i++) {\n@@ -997,6 +1004,10 @@ void diff_flush(int diff_output_style)\n \t\t\tdiff_flush_raw(p, line_termination,\n \t\t\t\t       inter_name_termination);\n \t\t\tbreak;\n+\t\tcase DIFF_FORMAT_NAME:\n+\t\tcase DIFF_FORMAT_NAME_Z:\n+\t\t\tdiff_flush_name(p, line_termination);\n+\t\t\tbreak;\n \t\t}\n \t}\n \tfor (i = 0; i < q->nr; i++)\ndiff --git a/diff.h b/diff.h\n--- a/diff.h\n+++ b/diff.h\n@@ -59,6 +59,8 @@ extern int diff_queue_is_empty(void);\n #define DIFF_FORMAT_MACHINE\t1\n #define DIFF_FORMAT_PATCH\t2\n #define DIFF_FORMAT_NO_OUTPUT\t3\n+#define DIFF_FORMAT_NAME\t4\n+#define DIFF_FORMAT_NAME_Z\t5\n \n extern void diff_flush(int output_style);\n \n"},{"id":"6083","messageId":"7vvf3exz3w.fsf_-_@assigned-by-dhcp.cox.net","threadId":"1207","inReplyTo":"loom.20050712T224801-163@post.gmane.org","subject":"[PATCH] Clean up diff option descriptions.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-07-13T19:52:35Z","receivedAt":"2005-07-13T19:52:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I got tired of maintaining almost duplicated descriptions in\ndiff-* brothers, both in usage string and documentation.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n\n*** This comes after the \"diff-stages -u\" and \"--name-only\" patches.\n*** I am in the process of a full sweep over Documentation/ and\n*** program usage strings right now so you will see more patches\n*** to Documentation/ area from me.\n\n Documentation/Makefile            |    2 +\n Documentation/diff-options.txt    |   53 +++++++++++++++++++++++++++++++++++++\n Documentation/git-diff-cache.txt  |   48 ++--------------------------------\n Documentation/git-diff-files.txt  |   44 +------------------------------\n Documentation/git-diff-stages.txt |   48 ++--------------------------------\n Documentation/git-diff-tree.txt   |   46 ++------------------------------\n diff-cache.c                      |    4 ++-\n diff-files.c                      |    4 ++-\n diff-stages.c                     |    3 +-\n diff-tree.c                       |    4 ++-\n diff.h                            |   20 ++++++++++++++\n 11 files changed, 96 insertions(+), 180 deletions(-)\n create mode 100644 Documentation/diff-options.txt\n\n6a3a580f9f9da9d5e821c2ffbe9d0dd1fe54cb63\ndiff --git a/Documentation/Makefile b/Documentation/Makefile\n--- a/Documentation/Makefile\n+++ b/Documentation/Makefile\n@@ -25,7 +25,7 @@ man1: $(DOC_MAN1)\n man7: $(DOC_MAN7)\n \n # 'include' dependencies\n-git-diff-%.txt: diff-format.txt\n+git-diff-%.txt: diff-format.txt diff-options.txt\n \ttouch $@\n \n clean:\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nnew file mode 100644\n--- /dev/null\n+++ b/Documentation/diff-options.txt\n@@ -0,0 +1,53 @@\n+-p::\n+\tGenerate patch (see section on generating patches)\n+\n+-u::\n+\tSynonym for \"-p\".\n+\n+-r::\n+\tLook recursivelly in subdirectories; this flag does not\n+\tmean anything to commands other than \"git-diff-tree\";\n+\tother commands always looks at all the subdirectories.\n+\n+-z::\n+\t\\0 line termination on output\n+\n+--name-only::\n+\tShow only names of changed files.\n+\n+--name-only-z::\n+\tSame as --name-only, but terminate lines with NUL.\n+\n+-B::\n+\tBreak complete rewrite changes into pairs of delete and create.\n+\n+-M::\n+\tDetect renames.\n+\n+-C::\n+\tDetect copies as well as renames.\n+\n+--find-copies-harder::\n+\tBy default, -C option finds copies only if the original\n+\tfile of the copy was modified in the same changeset for\n+\tperformance reasons.  This flag makes the command\n+\tinspect unmodified files as candidates for the source of\n+\tcopy.  This is a very expensive operation for large\n+\tprojects, so use it with caution.\n+\n+-S<string>::\n+\tLook for differences that contains the change in <string>.\n+\n+--pickaxe-all::\n+\tWhen -S finds a change, show all the changes in that\n+\tchangeset, not just the files that contains the change\n+\tin <string>.\n+\n+-O<orderfile>::\n+\tOutput the patch in the order specified in the\n+\t<orderfile>, which has one shell glob pattern per line.\n+\n+-R::\n+\tSwap two inputs; that is, show differences from cache or\n+\ton-disk file to tree contents.\n+\ndiff --git a/Documentation/git-diff-cache.txt b/Documentation/git-diff-cache.txt\n--- a/Documentation/git-diff-cache.txt\n+++ b/Documentation/git-diff-cache.txt\n@@ -9,7 +9,7 @@ git-diff-cache - Compares content and mo\n \n SYNOPSIS\n --------\n-'git-diff-cache' [-p] [-r] [-z] [-m] [--cached] [-R] [-B] [-M] [-C] [--find-copies-harder] [-O<orderfile>] [-S<string>] [--pickaxe-all] <tree-ish> [<path>...]\n+'git-diff-cache' [-m] [--cached] [<common diff options>] <tree-ish> [<path>...]\n \n DESCRIPTION\n -----------\n@@ -21,53 +21,11 @@ entries in the cache are compared.\n \n OPTIONS\n -------\n+include::diff-options.txt[]\n+\n <tree-ish>::\n \tThe id of a tree object to diff against.\n \n--p::\n-\tGenerate patch (see section on generating patches)\n-\n--r::\n-\tThis flag does not mean anything.  It is there only to match\n-\t\"git-diff-tree\".  Unlike \"git-diff-tree\", \"git-diff-cache\"\n-\talways looks at all the subdirectories.\n-\n--z::\n-\t\\0 line termination on output\n-\n--B::\n-\tBreak complete rewrite changes into pairs of delete and create.\n-\n--M::\n-\tDetect renames.\n-\n--C::\n-\tDetect copies as well as renames.\n-\n---find-copies-harder::\n-\tBy default, -C option finds copies only if the original\n-\tfile of the copy was modified in the same changeset for\n-\tperformance reasons.  This flag makes the command\n-\tinspect unmodified files as candidates for the source of\n-\tcopy.  This is a very expensive operation for large\n-\tprojects, so use it with caution.\n-\n--S<string>::\n-\tLook for differences that contains the change in <string>.\n-\n---pickaxe-all::\n-\tWhen -S finds a change, show all the changes in that\n-\tchangeset, not just the files that contains the change\n-\tin <string>.\n-\n--O<orderfile>::\n-\tOutput the patch in the order specified in the\n-\t<orderfile>, which has one shell glob pattern per line.\n-\n--R::\n-\tSwap two inputs; that is, show differences from cache or\n-\ton-disk file to tree contents.\n-\n --cached::\n \tdo not consider the on-disk file at all\n \ndiff --git a/Documentation/git-diff-files.txt b/Documentation/git-diff-files.txt\n--- a/Documentation/git-diff-files.txt\n+++ b/Documentation/git-diff-files.txt\n@@ -9,7 +9,7 @@ git-diff-files - Compares files in the w\n \n SYNOPSIS\n --------\n-'git-diff-files' [-p] [-q] [-r] [-z] [-R] [-B] [-M] [-C] [--find-copies-harder] [-O<orderfile>] [-S<string>] [--pickaxe-all] [<path>...]\n+'git-diff-files' [-q] [<common diff options>] [<path>...]\n \n DESCRIPTION\n -----------\n@@ -20,51 +20,11 @@ same as \"git-diff-cache\" and \"git-diff-t\n \n OPTIONS\n -------\n--p::\n-\tgenerate patch (see section on generating patches).\n+include::diff-options.txt[]\n \n -q::\n \tRemain silent even on nonexisting files\n \n--R::\n-\tSwap two inputs; that is, show differences from on-disk files\n-\tto cache contents.\n-\n--B::\n-\tBreak complete rewrite changes into pairs of delete and create.\n-\n--M::\n-\tDetect renames.\n-\n--C::\n-\tDetect copies as well as renames.\n-\n---find-copies-harder::\n-\tBy default, -C option finds copies only if the original\n-\tfile of the copy was modified in the same changeset for\n-\tperformance reasons.  This flag makes the command\n-\tinspect unmodified files as candidates for the source of\n-\tcopy.  This is a very expensive operation for large\n-\tprojects, so use it with caution.\n-\n--S<string>::\n-\tLook for differences that contains the change in <string>.\n-\n---pickaxe-all::\n-\tWhen -S finds a change, show all the changes in that\n-\tchangeset, not just the files that contains the change\n-\tin <string>.\n-\n--O<orderfile>::\n-\tOutput the patch in the order specified in the\n-\t<orderfile>, which has one shell glob pattern per line.\n-\n--r::\n-\tThis flag does not mean anything.  It is there only to match\n-\tgit-diff-tree.  Unlike git-diff-tree, git-diff-files always looks\n-\tat all the subdirectories.\n-\n-\n Output format\n -------------\n include::diff-format.txt[]\ndiff --git a/Documentation/git-diff-stages.txt b/Documentation/git-diff-stages.txt\n--- a/Documentation/git-diff-stages.txt\n+++ b/Documentation/git-diff-stages.txt\n@@ -9,7 +9,7 @@ git-diff-stages - Compares content and m\n \n SYNOPSIS\n --------\n-'git-diff-stages' [-p] [-r] [-z] [-R] [-B] [-M] [-C] [--find-copies-harder] [-O<orderfile>] [-S<string>] [--pickaxe-all] <stage1> <stage2> [<path>...]\n+'git-diff-stages' [<common diff options>] <stage1> <stage2> [<path>...]\n \n DESCRIPTION\n -----------\n@@ -18,53 +18,11 @@ unmerged index file.\n \n OPTIONS\n -------\n+include::diff-options.txt[]\n+\n <stage1>,<stage2>::\n \tThe stage number to be compared.\n \n--p::\n-\tGenerate patch (see section on generating patches)\n-\n--r::\n-\tThis flag does not mean anything.  It is there only to match\n-\t\"git-diff-tree\".  Unlike \"git-diff-tree\", \"git-diff-stages\"\n-\talways looks at all the subdirectories.\n-\n--z::\n-\t\\0 line termination on output\n-\n--B::\n-\tBreak complete rewrite changes into pairs of delete and create.\n-\n--M::\n-\tDetect renames.\n-\n--C::\n-\tDetect copies as well as renames.\n-\n---find-copies-harder::\n-\tBy default, -C option finds copies only if the original\n-\tfile of the copy was modified in the same changeset for\n-\tperformance reasons.  This flag makes the command\n-\tinspect unmodified files as candidates for the source of\n-\tcopy.  This is a very expensive operation for large\n-\tprojects, so use it with caution.\n-\n--S<string>::\n-\tLook for differences that contains the change in <string>.\n-\n---pickaxe-all::\n-\tWhen -S finds a change, show all the changes in that\n-\tchangeset, not just the files that contains the change\n-\tin <string>.\n-\n--O<orderfile>::\n-\tOutput the patch in the order specified in the\n-\t<orderfile>, which has one shell glob pattern per line.\n-\n--R::\n-\tSwap two inputs; that is, show differences from <stage2> to\n-\t<stage1>.\n-\n Output format\n -------------\n include::diff-format.txt[]\ndiff --git a/Documentation/git-diff-tree.txt b/Documentation/git-diff-tree.txt\n--- a/Documentation/git-diff-tree.txt\n+++ b/Documentation/git-diff-tree.txt\n@@ -9,7 +9,7 @@ git-diff-tree - Compares the content and\n \n SYNOPSIS\n --------\n-'git-diff-tree' [-p] [-r] [-z] [--stdin] [-m] [-s] [-v] [-t] [-R] [-B] [-M] [-C] [--find-copies-harder] [-O<orderfile>] [-S<string>] [--pickaxe-all] <tree-ish> <tree-ish> [<path>...]\n+'git-diff-tree' [--stdin] [-m] [-s] [-v] [--pretty] [-t] [<common diff options>] <tree-ish> <tree-ish> [<path>...]\n \n DESCRIPTION\n -----------\n@@ -19,6 +19,8 @@ Note that \"git-diff-tree\" can use the tr\n \n OPTIONS\n -------\n+include::diff-options.txt[]\n+\n <tree-ish>::\n \tThe id of a tree object.\n \n@@ -29,51 +31,9 @@ OPTIONS\n \tNote that this parameter does not provide any wildcard or regexp\n \tfeatures.\n \n--p::\n-\tgenerate patch (see section on generating patches).  For\n-\tgit-diff-tree, this flag implies '-r' as well.\n-\n--B::\n-\tBreak complete rewrite changes into pairs of delete and create.\n-\n--M::\n-\tDetect renames.\n-\n--C::\n-\tDetect copies as well as renames.\n-\n---find-copies-harder::\n-\tBy default, -C option finds copies only if the original\n-\tfile of the copy was modified in the same changeset for\n-\tperformance reasons.  This flag makes the command\n-\tinspect unmodified files as candidates for the source of\n-\tcopy.  This is a very expensive operation for large\n-\tprojects, so use it with caution.\n-\n--R::\n-\tSwap two input trees.\n-\n--S<string>::\n-\tLook for differences that contains the change in <string>.\n-\n---pickaxe-all::\n-\tWhen -S finds a change, show all the changes in that\n-\tchangeset, not just the files that contains the change\n-\tin <string>.\n-\n--O<orderfile>::\n-\tOutput the patch in the order specified in the\n-\t<orderfile>, which has one shell glob pattern per line.\n-\n--r::\n-\trecurse\n-\n -t::\n \tshow tree entry itself as well as subtrees.  Implies -r.\n \n--z::\n-\t\\0 line termination on output\n-\n --root::\n \tWhen '--root' is specified the initial commit will be showed as a big\n \tcreation event. This is equivalent to a diff against the NULL tree.\ndiff --git a/diff-cache.c b/diff-cache.c\n--- a/diff-cache.c\n+++ b/diff-cache.c\n@@ -159,7 +159,9 @@ static void mark_merge_entries(void)\n }\n \n static char *diff_cache_usage =\n-\"git-diff-cache [-p] [-r] [-z] [-m] [--cached] [-R] [-B] [-M] [-C] [--find-copies-harder] [-O<orderfile>] [-S<string>] [--pickaxe-all] <tree-ish> [<path>...]\";\n+\"git-diff-cache [-m] [--cached] \"\n+\"[<common diff options>] <tree-ish> [<path>...]\"\n+COMMON_DIFF_OPTIONS_HELP;\n \n int main(int argc, const char **argv)\n {\ndiff --git a/diff-files.c b/diff-files.c\n--- a/diff-files.c\n+++ b/diff-files.c\n@@ -7,7 +7,9 @@\n #include \"diff.h\"\n \n static const char *diff_files_usage =\n-\"git-diff-files [-p] [-q] [-r] [-z] [-R] [-B] [-M] [-C] [--find-copies-harder] [-O<orderfile>] [-S<string>] [--pickaxe-all] [<path>...]\";\n+\"git-diff-files [-q] \"\n+\"[<common diff options>] [<path>...]\"\n+COMMON_DIFF_OPTIONS_HELP;\n \n static int diff_output_format = DIFF_FORMAT_HUMAN;\n static int detect_rename = 0;\ndiff --git a/diff-stages.c b/diff-stages.c\n--- a/diff-stages.c\n+++ b/diff-stages.c\n@@ -17,7 +17,8 @@ static const char *orderfile = NULL;\n static const char *diff_filter = NULL;\n \n static char *diff_stages_usage =\n-\"git-diff-stages [-p] [-r] [-z] [-R] [-B] [-M] [-C] [--find-copies-harder] [-O<orderfile>] [-S<string>] [--pickaxe-all] <stage1> <stage2> [<path>...]\";\n+\"git-diff-stages [<common diff options>] <stage1> <stage2> [<path>...]\"\n+COMMON_DIFF_OPTIONS_HELP;\n \n static void diff_stages(int stage1, int stage2)\n {\ndiff --git a/diff-tree.c b/diff-tree.c\n--- a/diff-tree.c\n+++ b/diff-tree.c\n@@ -395,7 +395,9 @@ static int diff_tree_stdin(char *line)\n }\n \n static char *diff_tree_usage =\n-\"git-diff-tree [-p] [-r] [-z] [--stdin] [-m] [-s] [-v] [--pretty] [-t] [-R] [-B] [-M] [-C] [--find-copies-header] [-O<orderfile>] [-S<string>] [--pickaxe-all] <tree-ish> <tree-ish>\";\n+\"git-diff-tree [--stdin] [-m] [-s] [-v] [--pretty] [-t] \"\n+\"[<common diff options>] <tree-ish> <tree-ish>\"\n+COMMON_DIFF_OPTIONS_HELP;\n \n int main(int argc, const char **argv)\n {\ndiff --git a/diff.h b/diff.h\n--- a/diff.h\n+++ b/diff.h\n@@ -53,6 +53,26 @@ extern void diffcore_std_no_resolve(cons\n \t\t\t\t    const char *pickaxe, int pickaxe_opts,\n \t\t\t\t    const char *orderfile, const char *filter);\n \n+#define COMMON_DIFF_OPTIONS_HELP \\\n+\"\\ncommon diff options:\\n\" \\\n+\"  -r\t\tdiff recursively (only meaningful in diff-tree)\\n\" \\\n+\"  -z\t\toutput diff-raw with lines terminated with NUL.\\n\" \\\n+\"  -p\t\toutput patch format.\\n\" \\\n+\"  -u\t\tsynonym for -p.\\n\" \\\n+\"  --name-only\tshow only names of changed files.\\n\" \\\n+\"  --name-only-z\\n\" \\\n+\"\t\tsame as --name-only but terminate lines with NUL.\\n\" \\\n+\"  -R\t\tswap input file pairs.\\n\" \\\n+\"  -B\t\tdetect complete rewrites.\\n\" \\\n+\"  -M\t\tdetect renames.\\n\" \\\n+\"  -C\t\tdetect copies.\\n\" \\\n+\"  --find-copies-harder\\n\" \\\n+\"\t\ttry unchanged files as candidate for copy detection.\\n\" \\\n+\"  -O<file>\treorder diffs according to the <file>.\\n\" \\\n+\"  -S<string>\tfind filepair whose only one side contains the string.\\n\" \\\n+\"  --pickaxe-all\\n\" \\\n+\"\t\tshow all files diff when -S is used and hit is found.\\n\"\n+\n extern int diff_queue_is_empty(void);\n \n #define DIFF_FORMAT_HUMAN\t0\n"}]}