{"thread":{"id":"11344","subject":"[PATCH] Add format-patch option --no-name-prefix.","startedAt":"2007-12-18T15:42:54Z","lastAt":"2007-12-19T09:21:53Z","messageCount":22,"participants":["Pascal Obry","Johannes Sixt","Andreas Ericsson","Johannes Schindelin","Linus Torvalds","Matthieu Moy","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"63624","messageId":"1197992574-3464-1-git-send-email-pascal@obry.net","threadId":"11344","inReplyTo":null,"subject":"[PATCH] Add format-patch option --no-name-prefix.","fromName":"Pascal Obry","fromEmail":"pascal.obry@gmail.com","sentAt":"2007-12-18T15:42:54Z","receivedAt":"2007-12-18T15:42:54Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"This option can be used to generate a patch file\nwhere file names are relative to the Git root\ndirectory. Such a patch can then be applied with\nthe standard patch tool using option -p0.\n\nSigned-off-by: Pascal Obry <pascal@obry.net>\n---\n Documentation/git-format-patch.txt |    6 +++++-\n builtin-log.c                      |    7 ++++++-\n diff.c                             |   10 ++++++++--\n diff.h                             |    1 +\n 4 files changed, 20 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt\nindex 6fb9429..5a642ad 100644\n--- a/Documentation/git-format-patch.txt\n+++ b/Documentation/git-format-patch.txt\n@@ -15,7 +15,7 @@ SYNOPSIS\n                    [-n | --numbered | -N | --no-numbered]\n                    [--start-number <n>] [--numbered-files]\n                    [--in-reply-to=Message-Id] [--suffix=.<sfx>]\n-                   [--ignore-if-in-upstream]\n+                   [--ignore-if-in-upstream] [--no-name-prefix]\n                    [--subject-prefix=Subject-Prefix]\n \t\t   [ <since> | <revision range> ]\n \n@@ -90,6 +90,10 @@ include::diff-options.txt[]\n \twithout the default first line of the commit appended.\n \tMutually exclusive with the --stdout option.\n \n+--no-name-prefix::\n+\tGenerate a patch file that can be applied with a patch(1) -p0\n+\tfrom the Git root directory.\n+\n -k|--keep-subject::\n \tDo not strip/add '[PATCH]' from the first line of the\n \tcommit log message.\ndiff --git a/builtin-log.c b/builtin-log.c\nindex cc3cc90..36582bd 100644\n--- a/builtin-log.c\n+++ b/builtin-log.c\n@@ -599,6 +599,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \tint subject_prefix = 0;\n \tint ignore_if_in_upstream = 0;\n \tint thread = 0;\n+\tint no_name_prefix = 0;\n \tconst char *in_reply_to = NULL;\n \tstruct patch_ids ids;\n \tchar *add_signoff = NULL;\n@@ -636,6 +637,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\t}\n \t\telse if (!prefixcmp(argv[i], \"--start-number=\"))\n \t\t\tstart_number = strtol(argv[i] + 15, NULL, 10);\n+\t\telse if (!prefixcmp(argv[i], \"--no-name-prefix\"))\n+\t\t\tno_name_prefix = 1;\n \t\telse if (!strcmp(argv[i], \"--numbered-files\"))\n \t\t\tnumbered_files = 1;\n \t\telse if (!strcmp(argv[i], \"--start-number\")) {\n@@ -719,8 +722,10 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)\n \t\tdie (\"unrecognized argument: %s\", argv[1]);\n \n \tif (!rev.diffopt.output_format)\n-\t\trev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH;\n+\t\trev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_SUMMARY | DIFF_FORMAT_PATCH | DIFF_FORMAT_NAME_PREFIX;\n \n+\tif (no_name_prefix)\n+\t\trev.diffopt.output_format &= ~DIFF_FORMAT_NAME_PREFIX;\n \tif (!DIFF_OPT_TST(&rev.diffopt, TEXT))\n \t\tDIFF_OPT_SET(&rev.diffopt, BINARY);\n \ndiff --git a/diff.c b/diff.c\nindex e26584c..f07d9c0 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -1212,8 +1212,14 @@ static void builtin_diff(const char *name_a,\n \tconst char *set = diff_get_color_opt(o, DIFF_METAINFO);\n \tconst char *reset = diff_get_color_opt(o, DIFF_RESET);\n \n-\ta_one = quote_two(\"a/\", name_a + (*name_a == '/'));\n-\tb_two = quote_two(\"b/\", name_b + (*name_b == '/'));\n+\tif (o->output_format & DIFF_FORMAT_NAME_PREFIX) {\n+\t\ta_one = quote_two(\"a/\", name_a + (*name_a == '/'));\n+\t\tb_two = quote_two(\"b/\", name_b + (*name_b == '/'));\n+\t}\n+\telse {\n+\t\ta_one = quote_two(\"\", name_a + (*name_a == '/'));\n+\t\tb_two = quote_two(\"\", name_b + (*name_b == '/'));\n+\t}\n \tlbl[0] = DIFF_FILE_VALID(one) ? a_one : \"/dev/null\";\n \tlbl[1] = DIFF_FILE_VALID(two) ? b_two : \"/dev/null\";\n \tprintf(\"%sdiff --git %s %s%s\\n\", set, a_one, b_two, reset);\ndiff --git a/diff.h b/diff.h\nindex 7e8000a..86458a3 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -30,6 +30,7 @@ typedef void (*diff_format_fn_t)(struct diff_queue_struct *q,\n #define DIFF_FORMAT_SUMMARY\t0x0008\n #define DIFF_FORMAT_PATCH\t0x0010\n #define DIFF_FORMAT_SHORTSTAT\t0x0020\n+#define DIFF_FORMAT_NAME_PREFIX 0x0040\n \n /* These override all above */\n #define DIFF_FORMAT_NAME\t0x0100\n-- \n1.5.4.rc0.56.g6fbe\n"},{"id":"63625","messageId":"4767EB77.4060106@obry.net","threadId":"11344","inReplyTo":"1197992574-3464-1-git-send-email-pascal@obry.net","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2007-12-18T15:47:03Z","receivedAt":"2007-12-18T15:47:03Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"\nTo give a bit of context about this patch. I need to send changeset to a\nserver by e-mail for testing purpose before committing. The server is\nassuming that the patch can be applied with \"patch -p0 < file\" from the\nrepository root. The option --no-name-prefix does just that, removing\nthe leading 'a/' and 'b/'.\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63626","messageId":"4767ED52.9010004@viscovery.net","threadId":"11344","inReplyTo":"1197992574-3464-1-git-send-email-pascal@obry.net","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2007-12-18T15:54:58Z","receivedAt":"2007-12-18T15:54:58Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Pascal Obry schrieb:\n> This option can be used to generate a patch file\n> where file names are relative to the Git root\n> directory. Such a patch can then be applied with\n> the standard patch tool using option -p0.\n\nWhile I've always wondered what the a/ and b/ prefixes were good for (and\nI still do), I also wonder what's so different between typing\n\n     patch -p0\nand\n     patch -p1\n\nthat we need another diff option for it. Ok, on my keyboard 0 is typed\nwith the right hand, and 1 with the left hand, but... ??\n\n-- Hannes\n"},{"id":"63627","messageId":"4767EE6D.5070509@obry.net","threadId":"11344","inReplyTo":"4767ED52.9010004@viscovery.net","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2007-12-18T15:59:41Z","receivedAt":"2007-12-18T15:59:41Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Johannes Sixt a écrit :\n> that we need another diff option for it. Ok, on my keyboard 0 is typed\n> with the right hand, and 1 with the left hand, but... ??\n\nBecause you just did not read my follow-up message :)\n\nI need this has I do not have the way to change the server applying the\npatch. So nothing wrong with my hands or fingers :)\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63628","messageId":"4767EF5B.3010600@op5.se","threadId":"11344","inReplyTo":"1197992574-3464-1-git-send-email-pascal@obry.net","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-12-18T16:03:39Z","receivedAt":"2007-12-18T16:03:39Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Pascal Obry wrote:\n>  \tint thread = 0;\n> +\tint no_name_prefix = 0;\n\nDo we not need no double negations, yes?\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"63631","messageId":"4767F145.3030109@obry.net","threadId":"11344","inReplyTo":"4767EF5B.3010600@op5.se","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2007-12-18T16:11:49Z","receivedAt":"2007-12-18T16:11:49Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Andreas Ericsson a écrit :\n> Pascal Obry wrote:\n>>      int thread = 0;\n>> +    int no_name_prefix = 0;\n> \n> Do we not need no double negations, yes?\n\nNot sure, looks clearer to use variable name corresponding to the option\nname to me...\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63634","messageId":"Pine.LNX.4.64.0712181619550.23902@racer.site","threadId":"11344","inReplyTo":"1197992574-3464-1-git-send-email-pascal@obry.net","subject":"[PATCH] Teach diff machinery to display other prefixes than \"a/\" and \"b/\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-18T16:21:45Z","receivedAt":"2007-12-18T16:21:45Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWith the new option \"--prefix=<prefix1>[:<prefix2>]\" you can change\nthe shown prefix, or suppress it (by specifying the empty string).\n\nInitial patch by Pascal Obry.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Tue, 18 Dec 2007, Pascal Obry wrote:\n\n\t> This option can be used to generate a patch file\n\t> where file names are relative to the Git root\n\t> directory. Such a patch can then be applied with\n\t> the standard patch tool using option -p0.\n\n\tHow about this instead?  It is not much longer, but more \n\tversatile, as you can actually change the prefix, and not only in \n\tformat-patch.\n\n\tOh, and if somebody has a better idea for the name of the option, \n\tI would appreciate your input.\n\n Documentation/diff-options.txt |    4 ++++\n diff.c                         |   29 +++++++++++++++++++++--------\n diff.h                         |    1 +\n 3 files changed, 26 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 9ecc1d7..672a2d0 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -211,5 +211,9 @@ endif::git-format-patch[]\n --no-ext-diff::\n \tDisallow external diff drivers.\n \n+--prefix=<prefix1>[:<prefix2>]::\n+\tShow the given path prefixes instead of \"a/\" and \"b/\".  Leave\n+\tit empty to show no prefix at all.\n+\n For more detailed explanation on these common options, see also\n link:diffcore.html[diffcore documentation].\ndiff --git a/diff.c b/diff.c\nindex e26584c..404ba91 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -290,9 +290,10 @@ static void emit_rewrite_diff(const char *name_a,\n \t\t\t      const char *name_b,\n \t\t\t      struct diff_filespec *one,\n \t\t\t      struct diff_filespec *two,\n-\t\t\t      int color_diff)\n+\t\t\t      struct diff_options *o)\n {\n \tint lc_a, lc_b;\n+\tint color_diff = DIFF_OPT_TST(o, COLOR_DIFF);\n \tconst char *name_a_tab, *name_b_tab;\n \tconst char *metainfo = diff_get_color(color_diff, DIFF_METAINFO);\n \tconst char *fraginfo = diff_get_color(color_diff, DIFF_FRAGINFO);\n@@ -309,9 +310,9 @@ static void emit_rewrite_diff(const char *name_a,\n \tdiff_populate_filespec(two, 0);\n \tlc_a = count_lines(one->data, one->size);\n \tlc_b = count_lines(two->data, two->size);\n-\tprintf(\"%s--- a/%s%s%s\\n%s+++ b/%s%s%s\\n%s@@ -\",\n-\t       metainfo, name_a, name_a_tab, reset,\n-\t       metainfo, name_b, name_b_tab, reset, fraginfo);\n+\tprintf(\"%s--- %s%s%s%s\\n%s+++ %s%s%s%s\\n%s@@ -\",\n+\t       metainfo, o->a_prefix, name_a, name_a_tab, reset,\n+\t       metainfo, o->b_prefix, name_b, name_b_tab, reset, fraginfo);\n \tprint_line_count(lc_a);\n \tprintf(\" +\");\n \tprint_line_count(lc_b);\n@@ -1212,8 +1213,8 @@ static void builtin_diff(const char *name_a,\n \tconst char *set = diff_get_color_opt(o, DIFF_METAINFO);\n \tconst char *reset = diff_get_color_opt(o, DIFF_RESET);\n \n-\ta_one = quote_two(\"a/\", name_a + (*name_a == '/'));\n-\tb_two = quote_two(\"b/\", name_b + (*name_b == '/'));\n+\ta_one = quote_two(o->a_prefix, name_a + (*name_a == '/'));\n+\tb_two = quote_two(o->b_prefix, name_b + (*name_b == '/'));\n \tlbl[0] = DIFF_FILE_VALID(one) ? a_one : \"/dev/null\";\n \tlbl[1] = DIFF_FILE_VALID(two) ? b_two : \"/dev/null\";\n \tprintf(\"%sdiff --git %s %s%s\\n\", set, a_one, b_two, reset);\n@@ -1242,8 +1243,7 @@ static void builtin_diff(const char *name_a,\n \t\tif ((one->mode ^ two->mode) & S_IFMT)\n \t\t\tgoto free_ab_and_return;\n \t\tif (complete_rewrite) {\n-\t\t\temit_rewrite_diff(name_a, name_b, one, two,\n-\t\t\t\t\tDIFF_OPT_TST(o, COLOR_DIFF));\n+\t\t\temit_rewrite_diff(name_a, name_b, one, two, o);\n \t\t\to->found_changes = 1;\n \t\t\tgoto free_ab_and_return;\n \t\t}\n@@ -2020,6 +2020,9 @@ void diff_setup(struct diff_options *options)\n \telse\n \t\tDIFF_OPT_CLR(options, COLOR_DIFF);\n \toptions->detect_rename = diff_detect_rename_default;\n+\n+\toptions->a_prefix = \"a/\";\n+\toptions->b_prefix = \"b/\";\n }\n \n int diff_setup_done(struct diff_options *options)\n@@ -2291,6 +2294,16 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)\n \t\telse if (40 < options->abbrev)\n \t\t\toptions->abbrev = 40;\n \t}\n+\telse if (!strcmp(arg, \"--prefix=\")) {\n+\t\tchar *colon = strchr(arg + 9, ':');\n+\t\toptions->a_prefix = arg + 9;\n+\t\tif (colon) {\n+\t\t\t*colon = '\\0';\n+\t\t\toptions->b_prefix = colon + 1;\n+\t\t}\n+\t\telse\n+\t\t\toptions->b_prefix = options->a_prefix;\n+\t}\n \telse\n \t\treturn 0;\n \treturn 1;\ndiff --git a/diff.h b/diff.h\nindex 7e8000a..beccf85 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -69,6 +69,7 @@ struct diff_options {\n \tconst char *orderfile;\n \tconst char *pickaxe;\n \tconst char *single_follow;\n+\tconst char *a_prefix, *b_prefix;\n \tunsigned flags;\n \tint context;\n \tint break_opt;\n-- \n1.5.4.rc0.70.g30f7\n"},{"id":"63637","messageId":"4767F935.8060207@obry.net","threadId":"11344","inReplyTo":"Pine.LNX.4.64.0712181619550.23902@racer.site","subject":"Re: [PATCH] Teach diff machinery to display other prefixes than \"a/\" and \"b/\"","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2007-12-18T16:45:41Z","receivedAt":"2007-12-18T16:45:41Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Johannes Schindelin a écrit :\n> With the new option \"--prefix=<prefix1>[:<prefix2>]\" you can change\n> the shown prefix, or suppress it (by specifying the empty string).\n\nWhy not ? But do you have a motivation for this change ? I mean why\nwould you want to use a completely different prefix ?\n\nMy change was only for format-patch as this is used to build patch that\nsome other tools can process. If we find a sensible usage for your\nprefix option I'm all for it as this solves also my problem. It is just\nthat I think all options must have at least one usage :)\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63638","messageId":"alpine.LFD.0.9999.0712180840060.21557@woody.linux-foundation.org","threadId":"11344","inReplyTo":"4767EE6D.5070509@obry.net","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-12-18T16:50:01Z","receivedAt":"2007-12-18T16:50:01Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 18 Dec 2007, Pascal Obry wrote:\n\n> Johannes Sixt a écrit :\n> > that we need another diff option for it. Ok, on my keyboard 0 is typed\n> > with the right hand, and 1 with the left hand, but... ??\n> \n> Because you just did not read my follow-up message :)\n> \n> I need this has I do not have the way to change the server applying the\n> patch. So nothing wrong with my hands or fingers :)\n\nWell, we'd also need something like that for doing recursive diffs of \nsubmodules (since then we'd want to do the internal diff with the \nsubmodule name appended to the prefix), so I do think this whole \n\"--prefix\" makes sense. \n\nBut I obviously think the version by Dscho is better (exactly because it's \n*not* enough to just clear the name prefix entirely), although I think \nthat one is broken too - using ':' to separate the prefixes is *not* \nacceptable, since ':' is very possibly part of the prefix.\n\nSo I think you'd need separate arguments for the from/to prefixes, and not \ntry to shoehorn it into one argument. With possibly some simple form to \nsay \"no prefix\". So maybe something like\n\n  --src-prefix=<string>\t\t// default \"a/\"\n  --dst-prefix=<string>\t\t// default \"b/\"\n  --no-prefix\t\t\t// shorthand for --src-prefix=\"\" --dst-prefix=\"\"\n\nwould work for everybody?\n\n\t\tLinus\n"},{"id":"63641","messageId":"4767FB37.2030505@obry.net","threadId":"11344","inReplyTo":"alpine.LFD.0.9999.0712180840060.21557@woody.linux-foundation.org","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2007-12-18T16:54:15Z","receivedAt":"2007-12-18T16:54:15Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Linus Torvalds a écrit :\n>   --src-prefix=<string>\t\t// default \"a/\"\n>   --dst-prefix=<string>\t\t// default \"b/\"\n>   --no-prefix\t\t\t// shorthand for --src-prefix=\"\" --dst-prefix=\"\"\n> \n> would work for everybody?\n\nFine with me.\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63642","messageId":"Pine.LNX.4.64.0712181654410.23902@racer.site","threadId":"11344","inReplyTo":"4767F935.8060207@obry.net","subject":"Re: [PATCH] Teach diff machinery to display other prefixes than \"a/\" and \"b/\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-18T16:58:07Z","receivedAt":"2007-12-18T16:58:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 18 Dec 2007, Pascal Obry wrote:\n\n> Johannes Schindelin a ?crit :\n> > With the new option \"--prefix=<prefix1>[:<prefix2>]\" you can change \n> > the shown prefix, or suppress it (by specifying the empty string).\n> \n> Why not ? But do you have a motivation for this change ? I mean why \n> would you want to use a completely different prefix ?\n\nI vaguely remember that somebody once asked for something a la GNU patch's \n-B option.\n\nBesides, why restrict ourselves?  I mean, really, my patch only adds 6/4 \nadded/removed lines relative to your patch (part of which stems from the \nfact that I did not forget the \"diff --git\" line).  Why not take the added \nvalue virtually for free?\n\nCiao,\nDscho\n"},{"id":"63643","messageId":"vpqprx4uea4.fsf@bauges.imag.fr","threadId":"11344","inReplyTo":"4767F935.8060207@obry.net","subject":"Re: [PATCH] Teach diff machinery to display other prefixes than \"a/\" and \"b/\"","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-12-18T17:02:43Z","receivedAt":"2007-12-18T17:02:43Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Pascal Obry <pascal@obry.net> writes:\n\n> Johannes Schindelin a écrit :\n>> With the new option \"--prefix=<prefix1>[:<prefix2>]\" you can change\n>> the shown prefix, or suppress it (by specifying the empty string).\n>\n> Why not ? But do you have a motivation for this change ? I mean why\n> would you want to use a completely different prefix ?\n\nIt can make sense when you send the patch to someone who might not\nknow the context in which you wrote the patch, and who's not using\ngit. Then\n\n--- your-version/foo.c\n+++ my-version/foo.c\n\ncan be more expressive than a/ and b/. Some people like to have orig/\nand mod/ also.\n\nI can live without --prefix=... option, but doing it general at once\nis a good idea, since adding this backward-compatibly on top of your\npatch would mean having several redundant options.\n\n-- \nMatthieu\n"},{"id":"63644","messageId":"Pine.LNX.4.64.0712181703560.23902@racer.site","threadId":"11344","inReplyTo":"alpine.LFD.0.9999.0712180840060.21557@woody.linux-foundation.org","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-18T17:06:07Z","receivedAt":"2007-12-18T17:06:07Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Tue, 18 Dec 2007, Linus Torvalds wrote:\n\n> But I obviously think the version by Dscho is better (exactly because it's \n> *not* enough to just clear the name prefix entirely), although I think \n> that one is broken too - using ':' to separate the prefixes is *not* \n> acceptable, since ':' is very possibly part of the prefix.\n> \n> So I think you'd need separate arguments for the from/to prefixes, and not \n> try to shoehorn it into one argument. With possibly some simple form to \n> say \"no prefix\". So maybe something like\n> \n>   --src-prefix=<string>\t\t// default \"a/\"\n>   --dst-prefix=<string>\t\t// default \"b/\"\n>   --no-prefix\t\t\t// shorthand for --src-prefix=\"\" --dst-prefix=\"\"\n> \n> would work for everybody?\n\nIf this is preferred, please squash this:\n\n-- snipsnap --\n\n Documentation/diff-options.txt |   11 ++++++++---\n diff.c                         |   24 ++++++++++++++----------\n 2 files changed, 22 insertions(+), 13 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 672a2d0..0d3dccc 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -211,9 +211,14 @@ endif::git-format-patch[]\n --no-ext-diff::\n \tDisallow external diff drivers.\n \n---prefix=<prefix1>[:<prefix2>]::\n-\tShow the given path prefixes instead of \"a/\" and \"b/\".  Leave\n-\tit empty to show no prefix at all.\n+--src-prefix <prefix>::\n+\tShow the given source prefix instead of \"a/\".\n+\n+--dst-prefix <prefix>::\n+\tShow the given destination prefix instead of \"b/\".\n+\n+--no-prefix::\n+\tDo not show any source or destination prefix.\n \n For more detailed explanation on these common options, see also\n link:diffcore.html[diffcore documentation].\ndiff --git a/diff.c b/diff.c\nindex 095bbb5..9bc5fea 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -2317,16 +2317,20 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)\n \t\telse if (40 < options->abbrev)\n \t\t\toptions->abbrev = 40;\n \t}\n-\telse if (!strcmp(arg, \"--prefix=\")) {\n-\t\tchar *colon = strchr(arg + 9, ':');\n-\t\toptions->a_prefix = arg + 9;\n-\t\tif (colon) {\n-\t\t\t*colon = '\\0';\n-\t\t\toptions->b_prefix = colon + 1;\n-\t\t}\n-\t\telse\n-\t\t\toptions->b_prefix = options->a_prefix;\n-\t}\n+\telse if (!strcmp(arg, \"--src-prefix\")) {\n+\t\tif (ac < 2)\n+\t\t\treturn error(\"--src-prefix needs a parameter\");\n+\t\toptions->a_prefix = arg + 1;\n+\t\treturn 2;\n+\t}\n+\telse if (!strcmp(arg, \"--dst-prefix\")) {\n+\t\tif (ac < 2)\n+\t\t\treturn error(\"--dst-prefix needs a parameter\");\n+\t\toptions->b_prefix = arg + 1;\n+\t\treturn 2;\n+\t}\n+\telse if (!strcmp(arg, \"--no-prefix\"))\n+\t\toptions->a_prefix = options->b_prefix = \"\";\n \telse\n \t\treturn 0;\n \treturn 1;\n"},{"id":"63649","messageId":"476809EA.6080608@obry.net","threadId":"11344","inReplyTo":"Pine.LNX.4.64.0712181703560.23902@racer.site","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2007-12-18T17:56:58Z","receivedAt":"2007-12-18T17:56:58Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Johannes Schindelin a écrit :\n> If this is preferred, please squash this:\n\nWork fine for me.\n\nWe just need a consolidated patch with proper change log.\n\nThanks,\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63652","messageId":"Pine.LNX.4.64.0712181855020.23902@racer.site","threadId":"11344","inReplyTo":"476809EA.6080608@obry.net","subject":"[PATCH] Teach diff machinery to display other prefixes than \"a/\" and \"b/\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-18T18:56:19Z","receivedAt":"2007-12-18T18:56:19Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWith the new options \"--src-prefix <prefix>\", \"--dst-prefix <prefix>\"\nand \"--no-prefix\", you can now control the path prefixes of the diff\nmachinery.  These used to by hardwired to \"a/\" for the source prefix\nand \"b/\" for the destination prefix.\n\nInitial patch by Pascal Obry.  Sane option names suggested by Linus.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Tue, 18 Dec 2007, Pascal Obry wrote:\n\n\t> Johannes Schindelin a ?crit :\n\t> > If this is preferred, please squash this:\n\t> \n\t> Work fine for me.\n\t> \n\t> We just need a consolidated patch with proper change log.\n\n\tHow does this grab you?\n\n Documentation/diff-options.txt |    9 +++++++++\n diff.c                         |   33 +++++++++++++++++++++++++--------\n diff.h                         |    1 +\n 3 files changed, 35 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 9ecc1d7..0d3dccc 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -211,5 +211,14 @@ endif::git-format-patch[]\n --no-ext-diff::\n \tDisallow external diff drivers.\n \n+--src-prefix <prefix>::\n+\tShow the given source prefix instead of \"a/\".\n+\n+--dst-prefix <prefix>::\n+\tShow the given destination prefix instead of \"b/\".\n+\n+--no-prefix::\n+\tDo not show any source or destination prefix.\n+\n For more detailed explanation on these common options, see also\n link:diffcore.html[diffcore documentation].\ndiff --git a/diff.c b/diff.c\nindex e26584c..43f62d8 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -290,9 +290,10 @@ static void emit_rewrite_diff(const char *name_a,\n \t\t\t      const char *name_b,\n \t\t\t      struct diff_filespec *one,\n \t\t\t      struct diff_filespec *two,\n-\t\t\t      int color_diff)\n+\t\t\t      struct diff_options *o)\n {\n \tint lc_a, lc_b;\n+\tint color_diff = DIFF_OPT_TST(o, COLOR_DIFF);\n \tconst char *name_a_tab, *name_b_tab;\n \tconst char *metainfo = diff_get_color(color_diff, DIFF_METAINFO);\n \tconst char *fraginfo = diff_get_color(color_diff, DIFF_FRAGINFO);\n@@ -309,9 +310,9 @@ static void emit_rewrite_diff(const char *name_a,\n \tdiff_populate_filespec(two, 0);\n \tlc_a = count_lines(one->data, one->size);\n \tlc_b = count_lines(two->data, two->size);\n-\tprintf(\"%s--- a/%s%s%s\\n%s+++ b/%s%s%s\\n%s@@ -\",\n-\t       metainfo, name_a, name_a_tab, reset,\n-\t       metainfo, name_b, name_b_tab, reset, fraginfo);\n+\tprintf(\"%s--- %s%s%s%s\\n%s+++ %s%s%s%s\\n%s@@ -\",\n+\t       metainfo, o->a_prefix, name_a, name_a_tab, reset,\n+\t       metainfo, o->b_prefix, name_b, name_b_tab, reset, fraginfo);\n \tprint_line_count(lc_a);\n \tprintf(\" +\");\n \tprint_line_count(lc_b);\n@@ -1212,8 +1213,8 @@ static void builtin_diff(const char *name_a,\n \tconst char *set = diff_get_color_opt(o, DIFF_METAINFO);\n \tconst char *reset = diff_get_color_opt(o, DIFF_RESET);\n \n-\ta_one = quote_two(\"a/\", name_a + (*name_a == '/'));\n-\tb_two = quote_two(\"b/\", name_b + (*name_b == '/'));\n+\ta_one = quote_two(o->a_prefix, name_a + (*name_a == '/'));\n+\tb_two = quote_two(o->b_prefix, name_b + (*name_b == '/'));\n \tlbl[0] = DIFF_FILE_VALID(one) ? a_one : \"/dev/null\";\n \tlbl[1] = DIFF_FILE_VALID(two) ? b_two : \"/dev/null\";\n \tprintf(\"%sdiff --git %s %s%s\\n\", set, a_one, b_two, reset);\n@@ -1242,8 +1243,7 @@ static void builtin_diff(const char *name_a,\n \t\tif ((one->mode ^ two->mode) & S_IFMT)\n \t\t\tgoto free_ab_and_return;\n \t\tif (complete_rewrite) {\n-\t\t\temit_rewrite_diff(name_a, name_b, one, two,\n-\t\t\t\t\tDIFF_OPT_TST(o, COLOR_DIFF));\n+\t\t\temit_rewrite_diff(name_a, name_b, one, two, o);\n \t\t\to->found_changes = 1;\n \t\t\tgoto free_ab_and_return;\n \t\t}\n@@ -2020,6 +2020,9 @@ void diff_setup(struct diff_options *options)\n \telse\n \t\tDIFF_OPT_CLR(options, COLOR_DIFF);\n \toptions->detect_rename = diff_detect_rename_default;\n+\n+\toptions->a_prefix = \"a/\";\n+\toptions->b_prefix = \"b/\";\n }\n \n int diff_setup_done(struct diff_options *options)\n@@ -2291,6 +2294,20 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)\n \t\telse if (40 < options->abbrev)\n \t\t\toptions->abbrev = 40;\n \t}\n+\telse if (!strcmp(arg, \"--src-prefix\")) {\n+\t\tif (ac < 2)\n+\t\t\treturn error(\"--src-prefix needs a parameter\");\n+\t\toptions->a_prefix = arg + 1;\n+\t\treturn 2;\n+\t}\n+\telse if (!strcmp(arg, \"--dst-prefix\")) {\n+\t\tif (ac < 2)\n+\t\t\treturn error(\"--dst-prefix needs a parameter\");\n+\t\toptions->b_prefix = arg + 1;\n+\t\treturn 2;\n+\t}\n+\telse if (!strcmp(arg, \"--no-prefix\"))\n+\t\toptions->a_prefix = options->b_prefix = \"\";\n \telse\n \t\treturn 0;\n \treturn 1;\ndiff --git a/diff.h b/diff.h\nindex 7e8000a..beccf85 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -69,6 +69,7 @@ struct diff_options {\n \tconst char *orderfile;\n \tconst char *pickaxe;\n \tconst char *single_follow;\n+\tconst char *a_prefix, *b_prefix;\n \tunsigned flags;\n \tint context;\n \tint break_opt;\n-- \n1.5.4.rc0.70.g30f7\n"},{"id":"63653","messageId":"47681980.6050603@obry.net","threadId":"11344","inReplyTo":"Pine.LNX.4.64.0712181855020.23902@racer.site","subject":"Re: [PATCH] Teach diff machinery to display other prefixes than \"a/\" and \"b/\"","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2007-12-18T19:03:28Z","receivedAt":"2007-12-18T19:03:28Z","isPatch":true,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Johannes Schindelin a écrit :\n> With the new options \"--src-prefix <prefix>\", \"--dst-prefix <prefix>\"\n> and \"--no-prefix\", you can now control the path prefixes of the diff\n> machinery.  These used to by hardwired to \"a/\" for the source prefix\n> and \"b/\" for the destination prefix.\n> \n> Initial patch by Pascal Obry.  Sane option names suggested by Linus.\n> \n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nThanks this looks good to me.\n\nPascal.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"63654","messageId":"alpine.LFD.0.9999.0712181059220.21557@woody.linux-foundation.org","threadId":"11344","inReplyTo":"Pine.LNX.4.64.0712181855020.23902@racer.site","subject":"Re: [PATCH] Teach diff machinery to display other prefixes than \"a/\" and \"b/\"","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-12-18T19:05:31Z","receivedAt":"2007-12-18T19:05:31Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 18 Dec 2007, Johannes Schindelin wrote:\n> \n> With the new options \"--src-prefix <prefix>\", \"--dst-prefix <prefix>\"\n\nI really would prefer \"--[src|dst]-prefix=<prefix>\" as a single argument. \n\nI think that's the more common form for long arguments, isn't it (with any \nshort-format arguments usually using the \"-L <prefix>\" kind of form)?\n\n\t\tLinus\n"},{"id":"63656","messageId":"Pine.LNX.4.64.0712181930130.23902@racer.site","threadId":"11344","inReplyTo":"alpine.LFD.0.9999.0712181059220.21557@woody.linux-foundation.org","subject":"[PATCH v4] Teach diff machinery to display other prefixes than \"a/\" and \"b/\"","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-12-18T19:32:14Z","receivedAt":"2007-12-18T19:32:14Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWith the new options \"--src-prefix=<prefix>\", \"--dst-prefix=<prefix>\"\nand \"--no-prefix\", you can now control the path prefixes of the diff\nmachinery.  These used to by hardwired to \"a/\" for the source prefix\nand \"b/\" for the destination prefix.\n\nInitial patch by Pascal Obry.  Sane option names suggested by Linus.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Tue, 18 Dec 2007, Linus Torvalds wrote:\n\n\t> On Tue, 18 Dec 2007, Johannes Schindelin wrote:\n\t> > \n\t> > With the new options \"--src-prefix <prefix>\", \"--dst-prefix \n\t> > <prefix>\"\n\t> \n\t> I really would prefer \"--[src|dst]-prefix=<prefix>\" as a single \n\t> argument.\n\t> \n\t> I think that's the more common form for long arguments, isn't it \n\t> (with any short-format arguments usually using the \"-L <prefix>\" \n\t> kind of form)?\n\n\tIncidentally, this fixes src-prefix and dst-prefix (I wrote av[1] \n\tinstead of arg + 1, but forgot to commit).\n\n\tSo now, it is tested at least once per option.\n\n Documentation/diff-options.txt |    9 +++++++++\n diff.c                         |   25 +++++++++++++++++--------\n diff.h                         |    1 +\n 3 files changed, 27 insertions(+), 8 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 9ecc1d7..1a78635 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -211,5 +211,14 @@ endif::git-format-patch[]\n --no-ext-diff::\n \tDisallow external diff drivers.\n \n+--src-prefix=<prefix>::\n+\tShow the given source prefix instead of \"a/\".\n+\n+--dst-prefix=<prefix>::\n+\tShow the given destination prefix instead of \"b/\".\n+\n+--no-prefix::\n+\tDo not show any source or destination prefix.\n+\n For more detailed explanation on these common options, see also\n link:diffcore.html[diffcore documentation].\ndiff --git a/diff.c b/diff.c\nindex e26584c..61fd492 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -290,9 +290,10 @@ static void emit_rewrite_diff(const char *name_a,\n \t\t\t      const char *name_b,\n \t\t\t      struct diff_filespec *one,\n \t\t\t      struct diff_filespec *two,\n-\t\t\t      int color_diff)\n+\t\t\t      struct diff_options *o)\n {\n \tint lc_a, lc_b;\n+\tint color_diff = DIFF_OPT_TST(o, COLOR_DIFF);\n \tconst char *name_a_tab, *name_b_tab;\n \tconst char *metainfo = diff_get_color(color_diff, DIFF_METAINFO);\n \tconst char *fraginfo = diff_get_color(color_diff, DIFF_FRAGINFO);\n@@ -309,9 +310,9 @@ static void emit_rewrite_diff(const char *name_a,\n \tdiff_populate_filespec(two, 0);\n \tlc_a = count_lines(one->data, one->size);\n \tlc_b = count_lines(two->data, two->size);\n-\tprintf(\"%s--- a/%s%s%s\\n%s+++ b/%s%s%s\\n%s@@ -\",\n-\t       metainfo, name_a, name_a_tab, reset,\n-\t       metainfo, name_b, name_b_tab, reset, fraginfo);\n+\tprintf(\"%s--- %s%s%s%s\\n%s+++ %s%s%s%s\\n%s@@ -\",\n+\t       metainfo, o->a_prefix, name_a, name_a_tab, reset,\n+\t       metainfo, o->b_prefix, name_b, name_b_tab, reset, fraginfo);\n \tprint_line_count(lc_a);\n \tprintf(\" +\");\n \tprint_line_count(lc_b);\n@@ -1212,8 +1213,8 @@ static void builtin_diff(const char *name_a,\n \tconst char *set = diff_get_color_opt(o, DIFF_METAINFO);\n \tconst char *reset = diff_get_color_opt(o, DIFF_RESET);\n \n-\ta_one = quote_two(\"a/\", name_a + (*name_a == '/'));\n-\tb_two = quote_two(\"b/\", name_b + (*name_b == '/'));\n+\ta_one = quote_two(o->a_prefix, name_a + (*name_a == '/'));\n+\tb_two = quote_two(o->b_prefix, name_b + (*name_b == '/'));\n \tlbl[0] = DIFF_FILE_VALID(one) ? a_one : \"/dev/null\";\n \tlbl[1] = DIFF_FILE_VALID(two) ? b_two : \"/dev/null\";\n \tprintf(\"%sdiff --git %s %s%s\\n\", set, a_one, b_two, reset);\n@@ -1242,8 +1243,7 @@ static void builtin_diff(const char *name_a,\n \t\tif ((one->mode ^ two->mode) & S_IFMT)\n \t\t\tgoto free_ab_and_return;\n \t\tif (complete_rewrite) {\n-\t\t\temit_rewrite_diff(name_a, name_b, one, two,\n-\t\t\t\t\tDIFF_OPT_TST(o, COLOR_DIFF));\n+\t\t\temit_rewrite_diff(name_a, name_b, one, two, o);\n \t\t\to->found_changes = 1;\n \t\t\tgoto free_ab_and_return;\n \t\t}\n@@ -2020,6 +2020,9 @@ void diff_setup(struct diff_options *options)\n \telse\n \t\tDIFF_OPT_CLR(options, COLOR_DIFF);\n \toptions->detect_rename = diff_detect_rename_default;\n+\n+\toptions->a_prefix = \"a/\";\n+\toptions->b_prefix = \"b/\";\n }\n \n int diff_setup_done(struct diff_options *options)\n@@ -2291,6 +2294,12 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)\n \t\telse if (40 < options->abbrev)\n \t\t\toptions->abbrev = 40;\n \t}\n+\telse if (!prefixcmp(arg, \"--src-prefix=\"))\n+\t\toptions->a_prefix = arg + 13;\n+\telse if (!prefixcmp(arg, \"--dst-prefix=\"))\n+\t\toptions->b_prefix = arg + 13;\n+\telse if (!strcmp(arg, \"--no-prefix\"))\n+\t\toptions->a_prefix = options->b_prefix = \"\";\n \telse\n \t\treturn 0;\n \treturn 1;\ndiff --git a/diff.h b/diff.h\nindex 7e8000a..beccf85 100644\n--- a/diff.h\n+++ b/diff.h\n@@ -69,6 +69,7 @@ struct diff_options {\n \tconst char *orderfile;\n \tconst char *pickaxe;\n \tconst char *single_follow;\n+\tconst char *a_prefix, *b_prefix;\n \tunsigned flags;\n \tint context;\n \tint break_opt;\n-- \n1.5.4.rc0.70.g30f7\n"},{"id":"63659","messageId":"alpine.LFD.0.9999.0712181155030.21557@woody.linux-foundation.org","threadId":"11344","inReplyTo":"Pine.LNX.4.64.0712181930130.23902@racer.site","subject":"Re: [PATCH v4] Teach diff machinery to display other prefixes than \"a/\" and \"b/\"","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-12-18T19:55:27Z","receivedAt":"2007-12-18T19:55:27Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 18 Dec 2007, Johannes Schindelin wrote:\n> \n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nAcked-by: Linus Torvalds <torvalds@linux-foundation.org>\n\nThanks,\n\n\t\tLinus\n"},{"id":"63660","messageId":"7vk5nbzrzf.fsf@gitster.siamese.dyndns.org","threadId":"11344","inReplyTo":"alpine.LFD.0.9999.0712180840060.21557@woody.linux-foundation.org","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-12-18T20:07:48Z","receivedAt":"2007-12-18T20:07:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> On Tue, 18 Dec 2007, Pascal Obry wrote:\n>\n>> Johannes Sixt a écrit :\n>> > that we need another diff option for it. Ok, on my keyboard 0 is typed\n>> > with the right hand, and 1 with the left hand, but... ??\n>> \n>> Because you just did not read my follow-up message :)\n>> \n>> I need this has I do not have the way to change the server applying the\n>> patch. So nothing wrong with my hands or fingers :)\n> ....\n> So I think you'd need separate arguments for the from/to prefixes, and not \n> try to shoehorn it into one argument. With possibly some simple form to \n> say \"no prefix\". So maybe something like\n>\n>   --src-prefix=<string>\t\t// default \"a/\"\n>   --dst-prefix=<string>\t\t// default \"b/\"\n>   --no-prefix\t\t\t// shorthand for --src-prefix=\"\" --dst-prefix=\"\"\n>\n> would work for everybody?\n\nOne worry I have is that \"diff --git\" is validated more strictly than\nother diffs by \"git-apply\", and patches generated with arbitrary prefix\nwould break it.  It might make sense to drop \" --git\" from the patch\nheader if we allow a/ and b/ to be changed inconsistently.\n"},{"id":"63727","messageId":"4768DC78.9010304@op5.se","threadId":"11344","inReplyTo":"4767F145.3030109@obry.net","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-12-19T08:55:20Z","receivedAt":"2007-12-19T08:55:20Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Pascal Obry wrote:\n> Andreas Ericsson a écrit :\n>> Pascal Obry wrote:\n>>>      int thread = 0;\n>>> +    int no_name_prefix = 0;\n>> Do we not need no double negations, yes?\n> \n> Not sure, looks clearer to use variable name corresponding to the option\n> name to me...\n> \n\nPerhaps. We just had this discussion on the list where multiple people had\nextended a negative-sounding option. Personally I find it hard to parse\nand bug-prone to write (and edit) something like\n\n\tif (!no_prefix)\n\t\tadd_the_prefix();\",\n\nbut perhaps that's just me.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"63731","messageId":"4768E2B1.7030405@viscovery.net","threadId":"11344","inReplyTo":"4768DC78.9010304@op5.se","subject":"Re: [PATCH] Add format-patch option --no-name-prefix.","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2007-12-19T09:21:53Z","receivedAt":"2007-12-19T09:21:53Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Andreas Ericsson schrieb:\n> Pascal Obry wrote:\n>> Andreas Ericsson a écrit :\n>>> Pascal Obry wrote:\n>>>>      int thread = 0;\n>>>> +    int no_name_prefix = 0;\n>>> Do we not need no double negations, yes?\n>>\n>> Not sure, looks clearer to use variable name corresponding to the option\n>> name to me...\n\nSure. Only that the option name is --name-prefix, and the no- part of it\nis just the negation (that many other long option names also offer).\n\n> Perhaps. We just had this discussion on the list where multiple people had\n> extended a negative-sounding option. Personally I find it hard to parse\n> and bug-prone to write (and edit) something like\n> \n>     if (!no_prefix)\n>         add_the_prefix();\",\n> \n> but perhaps that's just me.\n\nOh, no, you are not alone!\n\nJohannes \"We-don't-need-no-steenkin'-duuble-negations\" Sixt\n"}]}