{"thread":{"id":"3474","subject":"[PATCH 2/2] combine-diff: Honour -z option correctly.","startedAt":"2006-02-27T12:48:15Z","lastAt":"2006-02-27T12:52:52Z","messageCount":3,"participants":["Mark Wooding"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"16809","messageId":"20060227124815.25144.83101.stgit@metalzone.distorted.org.uk","threadId":"3474","inReplyTo":null,"subject":"[PATCH 0/2] combine-diff consistency fixes","fromName":"Mark Wooding","fromEmail":"mdw@distorted.org.uk","sentAt":"2006-02-27T12:48:15Z","receivedAt":"2006-02-27T12:48:15Z","isPatch":true,"sender":{"key":"mdw@distorted.org.uk","avatar":null},"body":"The output of git diff-tree --cc on a merge is not consistent with its\noutput for a normal commit.  In particular:\n\n  * the index lines on a combined diff are abbreviated even if\n    --full-index is given, and\n\n  * the headers on a combined diff are not null terminated, even if -z\n    is given.\n\nFor example, run\n\n  git-diff-tree --cc -z --full-index f0b0af1b04f558b684cae2a3b805ca4bab84d45f\n\n-- [mdw]\n"},{"id":"16810","messageId":"20060227125250.25144.28246.stgit@metalzone.distorted.org.uk","threadId":"3474","inReplyTo":"20060227124815.25144.83101.stgit@metalzone.distorted.org.uk","subject":"[PATCH 1/2] combine-diff: Honour --full-index.","fromName":"Mark Wooding","fromEmail":"mdw@distorted.org.uk","sentAt":"2006-02-27T12:52:50Z","receivedAt":"2006-02-27T12:52:50Z","isPatch":true,"sender":{"key":"mdw@distorted.org.uk","avatar":null},"body":"From: Mark Wooding <mdw@distorted.org.uk>\n\nFor some reason, combined diffs don't honour the --full-index flag when\nemitting patches.  Fix this.\n\nSigned-off-by: Mark Wooding <mdw@distorted.org.uk>\n---\n\n combine-diff.c |   10 ++++++----\n 1 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/combine-diff.c b/combine-diff.c\nindex d812600..984103e 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -621,7 +621,8 @@ static void reuse_combine_diff(struct sl\n }\n \n static int show_patch_diff(struct combine_diff_path *elem, int num_parent,\n-\t\t\t   int dense, const char *header)\n+\t\t\t   int dense, const char *header,\n+\t\t\t   struct diff_options *opt)\n {\n \tunsigned long size, cnt, lno;\n \tchar *result, *cp, *ep;\n@@ -631,6 +632,7 @@ static int show_patch_diff(struct combin\n \tchar ourtmp_buf[TMPPATHLEN];\n \tchar *ourtmp = ourtmp_buf;\n \tint working_tree_file = !memcmp(elem->sha1, null_sha1, 20);\n+\tint abbrev = opt->full_index ? 40 : DEFAULT_ABBREV;\n \n \t/* Read the result of merge first */\n \tif (!working_tree_file) {\n@@ -735,10 +737,10 @@ static int show_patch_diff(struct combin\n \t\tprintf(\"index \");\n \t\tfor (i = 0; i < num_parent; i++) {\n \t\t\tabb = find_unique_abbrev(elem->parent[i].sha1,\n-\t\t\t\t\t\t DEFAULT_ABBREV);\n+\t\t\t\t\t\t abbrev);\n \t\t\tprintf(\"%s%s\", i ? \",\" : \"\", abb);\n \t\t}\n-\t\tabb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV);\n+\t\tabb = find_unique_abbrev(elem->sha1, abbrev);\n \t\tprintf(\"..%s\\n\", abb);\n \n \t\tif (mode_differs) {\n@@ -862,7 +864,7 @@ int show_combined_diff(struct combine_di\n \n \tdefault:\n \tcase DIFF_FORMAT_PATCH:\n-\t\treturn show_patch_diff(p, num_parent, dense, header);\n+\t\treturn show_patch_diff(p, num_parent, dense, header, opt);\n \t}\n }\n \n"},{"id":"16808","messageId":"20060227125252.25144.12278.stgit@metalzone.distorted.org.uk","threadId":"3474","inReplyTo":"20060227124815.25144.83101.stgit@metalzone.distorted.org.uk","subject":"[PATCH 2/2] combine-diff: Honour -z option correctly.","fromName":"Mark Wooding","fromEmail":"mdw@distorted.org.uk","sentAt":"2006-02-27T12:52:52Z","receivedAt":"2006-02-27T12:52:52Z","isPatch":true,"sender":{"key":"mdw@distorted.org.uk","avatar":null},"body":"From: Mark Wooding <mdw@distorted.org.uk>\n\nCombined diffs don't null terminate things in the same way as standard\ndiffs.  This is presumably wrong.\n\nSigned-off-by: Mark Wooding <mdw@distorted.org.uk>\n---\n\n combine-diff.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/combine-diff.c b/combine-diff.c\nindex 984103e..a23894d 100644\n--- a/combine-diff.c\n+++ b/combine-diff.c\n@@ -726,7 +726,7 @@ static int show_patch_diff(struct combin\n \n \t\tif (header) {\n \t\t\tshown_header++;\n-\t\t\tputs(header);\n+\t\t\tprintf(\"%s%c\", header, opt->line_termination);\n \t\t}\n \t\tprintf(\"diff --%s \", dense ? \"cc\" : \"combined\");\n \t\tif (quote_c_style(elem->path, NULL, NULL, 0))\n@@ -799,7 +799,7 @@ static void show_raw_diff(struct combine\n \t\tinter_name_termination = 0;\n \n \tif (header)\n-\t\tputs(header);\n+\t\tprintf(\"%s%c\", header, line_termination);\n \n \tfor (i = 0; i < num_parent; i++) {\n \t\tif (p->parent[i].mode)\n"}]}