{"thread":{"id":"24825","subject":"[PATCH 2/2] git-merge: ignore space support","startedAt":"2010-08-22T05:46:31Z","lastAt":"2010-08-22T05:46:31Z","messageCount":1,"participants":["Justin Frankel"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"148693","messageId":"20100822054631.GC64856@ns1.cockos.com","threadId":"24825","inReplyTo":null,"subject":"[PATCH 2/2] git-merge: ignore space support","fromName":"Justin Frankel","fromEmail":"justin@cockos.com","sentAt":"2010-08-22T05:46:31Z","receivedAt":"2010-08-22T05:46:31Z","isPatch":true,"sender":{"key":"justin@cockos.com","avatar":"https://avatars.githubusercontent.com/u/5803984?v=4"},"body":"(this patch is for the next branch, specifically af7f2b0e6225e5d9faa54bc30e96669b4c706de8)\n\n---\n builtin/merge-recursive.c |    9 +++++++++\n builtin/merge.c           |    9 +++++++++\n ll-merge.c                |    1 +\n ll-merge.h                |   15 ++++++++++++++-\n merge-recursive.c         |    2 +-\n merge-recursive.h         |    1 +\n 6 files changed, 35 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin/merge-recursive.c b/builtin/merge-recursive.c\nindex c2d4677..6606bb8 100644\n--- a/builtin/merge-recursive.c\n+++ b/builtin/merge-recursive.c\n@@ -2,6 +2,7 @@\n #include \"commit.h\"\n #include \"tag.h\"\n #include \"merge-recursive.h\"\n+#include \"xdiff-interface.h\"\n \n static const char *better_branch_name(const char *branch)\n {\n@@ -49,6 +50,14 @@ int cmd_merge_recursive(int argc, const char **argv, const char *prefix)\n \t\t\t\to.renormalize = 1;\n \t\t\telse if (!strcmp(arg+2, \"no-renormalize\"))\n \t\t\t\to.renormalize = 0;\n+                        else if (!strcmp(arg+2, \"ignore-all-space\"))\n+                                o.xdl_opts |= XDF_IGNORE_WHITESPACE;\n+                        else if (!strcmp(arg+2, \"ignore-space-change\"))\n+                                o.xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;\n+                        else if (!strcmp(arg+2, \"ignore-space-at-eol\"))\n+                                o.xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL;\n+                        else if (!strcmp(arg+2, \"patience\"))\n+                                o.xdl_opts |= XDF_PATIENCE_DIFF;\n \t\t\telse\n \t\t\t\tdie(\"Unknown option %s\", arg);\n \t\t\tcontinue;\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex da26cd6..98c04b7 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -25,6 +25,7 @@\n #include \"help.h\"\n #include \"merge-recursive.h\"\n #include \"resolve-undo.h\"\n+#include \"xdiff-interface.h\"\n \n #define DEFAULT_TWOHEAD (1<<0)\n #define DEFAULT_OCTOPUS (1<<1)\n@@ -646,6 +647,14 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,\n \t\t\t\to.renormalize = 1;\n \t\t\telse if (!strcmp(xopts[x], \"no-renormalize\"))\n \t\t\t\to.renormalize = 0;\n+\t\t        else if (!strcmp(xopts[x], \"ignore-all-space\"))\n+\t\t                o.xdl_opts |= XDF_IGNORE_WHITESPACE;\n+\t\t        else if (!strcmp(xopts[x], \"ignore-space-change\"))\n+\t\t                o.xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;\n+\t\t        else if (!strcmp(xopts[x], \"ignore-space-at-eol\"))\n+\t\t                o.xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL;\n+\t\t        else if (!strcmp(xopts[x], \"patience\"))\n+\t\t                o.xdl_opts |= XDF_PATIENCE_DIFF;\n \t\t\telse\n \t\t\t\tdie(\"Unknown option for merge-recursive: -X%s\", xopts[x]);\n \t\t}\ndiff --git a/ll-merge.c b/ll-merge.c\nindex 6bb3095..4e56665 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -80,6 +80,7 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,\n \tmemset(&xmp, 0, sizeof(xmp));\n \txmp.level = XDL_MERGE_ZEALOUS;\n \txmp.favor = ll_opt_favor(flag);\n+        xmp.xpp.flags = ll_opt_xdl_opt(flag);\n \tif (git_xmerge_style >= 0)\n \t\txmp.style = git_xmerge_style;\n \tif (marker_size > 0)\ndiff --git a/ll-merge.h b/ll-merge.h\nindex ff7ca87..cf2d7b9 100644\n--- a/ll-merge.h\n+++ b/ll-merge.h\n@@ -7,19 +7,32 @@\n \n #define LL_OPT_VIRTUAL_ANCESTOR\t(1 << 0)\n #define LL_OPT_FAVOR_MASK\t((1 << 1) | (1 << 2))\n-#define LL_OPT_FAVOR_SHIFT 1\n+#define LL_OPT_FAVOR_SHIFT \t1\n #define LL_OPT_RENORMALIZE\t(1 << 3)\n+#define LL_OPT_XDL_MASK \t(0x3F << 4)\n+#define LL_OPT_XDL_SHIFT \t4\n \n static inline int ll_opt_favor(int flag)\n {\n \treturn (flag & LL_OPT_FAVOR_MASK) >> LL_OPT_FAVOR_SHIFT;\n }\n \n+static inline int ll_opt_xdl_opt(int flag)\n+{\n+\treturn ((flag & LL_OPT_XDL_MASK) >> LL_OPT_XDL_SHIFT);\n+}\n+\n static inline int create_ll_flag(int favor)\n {\n \treturn ((favor << LL_OPT_FAVOR_SHIFT) & LL_OPT_FAVOR_MASK);\n }\n \n+static inline int create_ll_flag_xdl_opt(int favor, int xdl_opt)\n+{\n+\treturn ((favor << LL_OPT_FAVOR_SHIFT) & LL_OPT_FAVOR_MASK) |\n+\t\t((xdl_opt << LL_OPT_XDL_SHIFT) & LL_OPT_XDL_MASK);\n+}\n+\n int ll_merge(mmbuffer_t *result_buf,\n \t     const char *path,\n \t     mmfile_t *ancestor, const char *ancestor_label,\ndiff --git a/merge-recursive.c b/merge-recursive.c\nindex aadd48c..506c9db 100644\n--- a/merge-recursive.c\n+++ b/merge-recursive.c\n@@ -646,7 +646,7 @@ static int merge_3way(struct merge_options *o,\n \t\t\t\t&src1, name1, &src2, name2,\n \t\t\t\t((o->call_depth ? LL_OPT_VIRTUAL_ANCESTOR : 0) |\n \t\t\t\t (o->renormalize ? LL_OPT_RENORMALIZE : 0) |\n-\t\t\t\t create_ll_flag(favor)));\n+\t\t\t\t create_ll_flag_xdl_opt(favor,o->xdl_opts)));\n \n \tfree(name1);\n \tfree(name2);\ndiff --git a/merge-recursive.h b/merge-recursive.h\nindex 196f053..33ab9d3 100644\n--- a/merge-recursive.h\n+++ b/merge-recursive.h\n@@ -13,6 +13,7 @@ struct merge_options {\n \t\tMERGE_RECURSIVE_THEIRS\n \t} recursive_variant;\n \tconst char *subtree_shift;\n+        int xdl_opts;\n \tunsigned buffer_output : 1;\n \tunsigned renormalize : 1;\n \tint verbosity;\n-- \n1.7.2.2.333.gec5bc.dirty\n"}]}