{"thread":{"id":"22856","subject":"[PATCH 1/3] merge-file: add option to specify the marker size","startedAt":"2010-02-28T19:56:19Z","lastAt":"2010-03-01T17:28:16Z","messageCount":10,"participants":["Bert Wesarg","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"135887","messageId":"972adf380be481b5e8d031481586e9c34da2cbb7.1267385538.git.bert.wesarg@googlemail.com","threadId":"22856","inReplyTo":null,"subject":"[PATCH 1/3] merge-file: add option to specify the marker size","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-02-28T19:56:19Z","receivedAt":"2010-02-28T19:56:19Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n\n---\n\nThis can probably improved in a way, that the marker size will be taken\nfrom attributes. This could be done by an explicit --marker-size-by-path\noption or an option which names one of the three input files as a git\npath.\n\nFor example:\n\n $ echo \"foo conflict-marker-size=32\" > .gitattributes\n $ git merge-file --marker-size-by-path=foo fileA fileB fileC\n\n=> marker size would be 32\n\nOr:\n\n $ echo \"fileC conflict-marker-size=32\" > .gitattributes\n $ git merge-file --marker-size-by-source=theirs fileA fileB fileC\n\n=> marker size would be 32\n\n Documentation/git-merge-file.txt |    5 +++--\n builtin-merge-file.c             |    1 +\n t/t6023-merge-file.sh            |   37 +++++++++++++++++++++++++++++++++++++\n 3 files changed, 41 insertions(+), 2 deletions(-)\n\ndiff --git a/Documentation/git-merge-file.txt b/Documentation/git-merge-file.txt\nindex 234269a..a5b9c1f 100644\n--- a/Documentation/git-merge-file.txt\n+++ b/Documentation/git-merge-file.txt\n@@ -10,7 +10,7 @@ SYNOPSIS\n --------\n [verse]\n 'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]\n-\t[--ours|--theirs] [-p|--stdout] [-q|--quiet]\n+\t[--ours|--theirs] [-p|--stdout] [-q|--quiet] [--marker-size=<n>]\n \t<current-file> <base-file> <other-file>\n \n \n@@ -37,7 +37,8 @@ normally outputs a warning and brackets the conflict with lines containing\n If there are conflicts, the user should edit the result and delete one of\n the alternatives.  When `--ours` or `--theirs` option is in effect, however,\n these conflicts are resolved favouring lines from `<current-file>` or\n-lines from `<other-file>` respectively.\n+lines from `<other-file>` respectively.  The length of the conflict markers\n+can be given with the `--marker-size` option.\n \n The exit value of this program is negative on error, and the number of\n conflicts otherwise. If the merge was clean, the exit value is 0.\ndiff --git a/builtin-merge-file.c b/builtin-merge-file.c\nindex 1e70073..57d757c 100644\n--- a/builtin-merge-file.c\n+++ b/builtin-merge-file.c\n@@ -39,6 +39,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)\n \t\t\t    XDL_MERGE_FAVOR_OURS),\n \t\tOPT_SET_INT(0, \"theirs\", &favor, \"for conflicts, use their version\",\n \t\t\t    XDL_MERGE_FAVOR_THEIRS),\n+\t\tOPT_INTEGER(0, \"marker-size\", &xmp.marker_size, \"for conflicts, use this marker size\"),\n \t\tOPT__QUIET(&quiet),\n \t\tOPT_CALLBACK('L', NULL, names, \"name\",\n \t\t\t     \"set labels for file1/orig_file/file2\", &label_cb),\ndiff --git a/t/t6023-merge-file.sh b/t/t6023-merge-file.sh\nindex d605024..5034dd1 100755\n--- a/t/t6023-merge-file.sh\n+++ b/t/t6023-merge-file.sh\n@@ -215,4 +215,41 @@ test_expect_success '\"diff3 -m\" style output (2)' '\n \ttest_cmp expect actual\n '\n \n+cat >expect <<\\EOF\n+Dominus regit me,\n+<<<<<<<<<< new8.txt\n+et nihil mihi deerit;\n+\n+\n+\n+\n+In loco pascuae ibi me collocavit;\n+super aquam refectionis educavit me.\n+||||||||||\n+et nihil mihi deerit.\n+In loco pascuae ibi me collocavit,\n+super aquam refectionis educavit me;\n+==========\n+et nihil mihi deerit,\n+\n+\n+\n+\n+In loco pascuae ibi me collocavit --\n+super aquam refectionis educavit me,\n+>>>>>>>>>> new9.txt\n+animam meam convertit,\n+deduxit me super semitas jusitiae,\n+propter nomen suum.\n+Nam et si ambulavero in medio umbrae mortis,\n+non timebo mala, quoniam TU mecum es:\n+virga tua et baculus tuus ipsa me consolata sunt.\n+EOF\n+\n+test_expect_success 'marker size' '\n+\ttest_must_fail git merge-file -p --marker-size=10 \\\n+\t\tnew8.txt new5.txt new9.txt >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_done\n-- \n1.7.0.584.g2da2b\n"},{"id":"135888","messageId":"17999fdb3ff374156acb7fc670426265fa27b94b.1267385538.git.bert.wesarg@googlemail.com","threadId":"22856","inReplyTo":"972adf380be481b5e8d031481586e9c34da2cbb7.1267385538.git.bert.wesarg@googlemail.com","subject":"[PATCH 2/3] make union merge an xdl merge favor","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-02-28T19:56:20Z","receivedAt":"2010-02-28T19:56:20Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"The current union merge driver is implemented as an post process.  But the\nxdl_merge code is quite capable to produce the result by itself.  Therefore\nmove to it there and teach git-merge-file a new --union option.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n Documentation/git-merge-file.txt |    2 +-\n builtin-merge-file.c             |    2 +\n ll-merge.c                       |   43 ++++---------------------------------\n xdiff/xdiff.h                    |    1 +\n xdiff/xmerge.c                   |   20 +++++++++++------\n 5 files changed, 22 insertions(+), 46 deletions(-)\n\ndiff --git a/Documentation/git-merge-file.txt b/Documentation/git-merge-file.txt\nindex a5b9c1f..11dff6f 100644\n--- a/Documentation/git-merge-file.txt\n+++ b/Documentation/git-merge-file.txt\n@@ -10,7 +10,7 @@ SYNOPSIS\n --------\n [verse]\n 'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]\n-\t[--ours|--theirs] [-p|--stdout] [-q|--quiet] [--marker-size=<n>]\n+\t[--ours|--theirs|--union] [-p|--stdout] [-q|--quiet] [--marker-size=<n>]\n \t<current-file> <base-file> <other-file>\n \n \ndiff --git a/builtin-merge-file.c b/builtin-merge-file.c\nindex 57d757c..f69dad6 100644\n--- a/builtin-merge-file.c\n+++ b/builtin-merge-file.c\n@@ -39,6 +39,8 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)\n \t\t\t    XDL_MERGE_FAVOR_OURS),\n \t\tOPT_SET_INT(0, \"theirs\", &favor, \"for conflicts, use their version\",\n \t\t\t    XDL_MERGE_FAVOR_THEIRS),\n+\t\tOPT_SET_INT(0, \"union\", &xmp.favor, \"for conflicts, use a union version\",\n+\t\t\t    XDL_MERGE_FAVOR_UNION),\n \t\tOPT_INTEGER(0, \"marker-size\", &xmp.marker_size, \"for conflicts, use this marker size\"),\n \t\tOPT__QUIET(&quiet),\n \t\tOPT_CALLBACK('L', NULL, names, \"name\",\ndiff --git a/ll-merge.c b/ll-merge.c\nindex 4c7f11b..a4b2f4c 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -98,44 +98,11 @@ static int ll_union_merge(const struct ll_merge_driver *drv_unused,\n \t\t\t  mmfile_t *src2, const char *name2,\n \t\t\t  int flag, int marker_size)\n {\n-\tchar *src, *dst;\n-\tlong size;\n-\tint status, saved_style;\n-\n-\t/* We have to force the RCS \"merge\" style */\n-\tsaved_style = git_xmerge_style;\n-\tgit_xmerge_style = 0;\n-\tstatus = ll_xdl_merge(drv_unused, result, path_unused,\n-\t\t\t      orig, src1, NULL, src2, NULL,\n-\t\t\t      flag, marker_size);\n-\tgit_xmerge_style = saved_style;\n-\tif (status <= 0)\n-\t\treturn status;\n-\tsize = result->size;\n-\tsrc = dst = result->ptr;\n-\twhile (size) {\n-\t\tchar ch;\n-\t\tif ((marker_size < size) &&\n-\t\t    (*src == '<' || *src == '=' || *src == '>')) {\n-\t\t\tint i;\n-\t\t\tch = *src;\n-\t\t\tfor (i = 0; i < marker_size; i++)\n-\t\t\t\tif (src[i] != ch)\n-\t\t\t\t\tgoto not_a_marker;\n-\t\t\tif (src[marker_size] != '\\n')\n-\t\t\t\tgoto not_a_marker;\n-\t\t\tsrc += marker_size + 1;\n-\t\t\tsize -= marker_size + 1;\n-\t\t\tcontinue;\n-\t\t}\n-\tnot_a_marker:\n-\t\tdo {\n-\t\t\tch = *src++;\n-\t\t\t*dst++ = ch;\n-\t\t\tsize--;\n-\t\t} while (ch != '\\n' && size);\n-\t}\n-\tresult->size = dst - result->ptr;\n+\t/* Use union favor */\n+\tflag = (flag & 1) | (XDL_MERGE_FAVOR_UNION << 1);\n+\treturn ll_xdl_merge(drv_unused, result, path_unused,\n+\t\t\t    orig, src1, NULL, src2, NULL,\n+\t\t\t    flag, marker_size);\n \treturn 0;\n }\n \ndiff --git a/xdiff/xdiff.h b/xdiff/xdiff.h\nindex 3f6229e..22614d5 100644\n--- a/xdiff/xdiff.h\n+++ b/xdiff/xdiff.h\n@@ -61,6 +61,7 @@ extern \"C\" {\n /* merge favor modes */\n #define XDL_MERGE_FAVOR_OURS 1\n #define XDL_MERGE_FAVOR_THEIRS 2\n+#define XDL_MERGE_FAVOR_UNION 3\n #define XDL_MERGE_FAVOR(flags) (((flags)>>4) & 3)\n #define XDL_MERGE_FLAGS(level, style, favor) ((level)|(style)|((favor)<<4))\n \ndiff --git a/xdiff/xmerge.c b/xdiff/xmerge.c\nindex 8cbe45e..c901ecb 100644\n--- a/xdiff/xmerge.c\n+++ b/xdiff/xmerge.c\n@@ -28,6 +28,7 @@ typedef struct s_xdmerge {\n \t * 0 = conflict,\n \t * 1 = no conflict, take first,\n \t * 2 = no conflict, take second.\n+\t * 3 = no conflict, take both.\n \t */\n \tint mode;\n \t/*\n@@ -230,14 +231,19 @@ static int xdl_fill_merge_buffer(xdfenv_t *xe1, const char *name1,\n \t\t\tsize = fill_conflict_hunk(xe1, name1, xe2, name2,\n \t\t\t\t\t\t  size, i, style, m, dest,\n \t\t\t\t\t\t  marker_size);\n-\t\telse if (m->mode == 1)\n-\t\t\tsize += xdl_recs_copy(xe1, i, m->i1 + m->chg1 - i, 0,\n+\t\telse if (m->mode & 3) {\n+\t\t\t/* Before conflicting part */\n+\t\t\tsize += xdl_recs_copy(xe1, i, m->i1 - i, 0,\n \t\t\t\t\t      dest ? dest + size : NULL);\n-\t\telse if (m->mode == 2)\n-\t\t\tsize += xdl_recs_copy(xe2, m->i2 - m->i1 + i,\n-\t\t\t\t\t      m->i1 + m->chg2 - i, 0,\n-\t\t\t\t\t      dest ? dest + size : NULL);\n-\t\telse\n+\t\t\t/* Postimage from side #1 */\n+\t\t\tif (m->mode & 1)\n+\t\t\t\tsize += xdl_recs_copy(xe1, m->i1, m->chg1, 1,\n+\t\t\t\t\t\t      dest ? dest + size : NULL);\n+\t\t\t/* Postimage from side #2 */\n+\t\t\tif (m->mode & 2)\n+\t\t\t\tsize += xdl_recs_copy(xe2, m->i2, m->chg2, 1,\n+\t\t\t\t\t\t      dest ? dest + size : NULL);\n+\t\t} else\n \t\t\tcontinue;\n \t\ti = m->i1 + m->chg1;\n \t}\n-- \n1.7.0.584.g2da2b\n"},{"id":"135889","messageId":"4fe659d606583d5de11179eff62d6d834b78ed7d.1267385538.git.bert.wesarg@googlemail.com","threadId":"22856","inReplyTo":"972adf380be481b5e8d031481586e9c34da2cbb7.1267385538.git.bert.wesarg@googlemail.com","subject":"[PATCH 3/3] refactor merge flags into xmparam_t","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-02-28T19:56:21Z","receivedAt":"2010-02-28T19:56:21Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"Include the merge level, favor, and style flags into the xmparam_t struct.\nThis removes the bit twiddling with these three values into the one flags\nparameter.\n\nSigned-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n---\n builtin-merge-file.c |   18 ++++++++++--------\n ll-merge.c           |   12 ++++--------\n xdiff/xdiff.h        |   11 +++++------\n xdiff/xmerge.c       |   12 ++++++------\n 4 files changed, 25 insertions(+), 28 deletions(-)\n\ndiff --git a/builtin-merge-file.c b/builtin-merge-file.c\nindex f69dad6..8a70d0e 100644\n--- a/builtin-merge-file.c\n+++ b/builtin-merge-file.c\n@@ -27,17 +27,19 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)\n \tmmbuffer_t result = {NULL, 0};\n \txmparam_t xmp = {{XDF_NEED_MINIMAL}};\n \tint ret = 0, i = 0, to_stdout = 0;\n-\tint level = XDL_MERGE_ZEALOUS_ALNUM;\n-\tint style = 0, quiet = 0;\n-\tint favor = 0;\n+\tint quiet = 0;\n \tint nongit;\n \n+\txmp.level = XDL_MERGE_ZEALOUS_ALNUM;\n+\txmp.style = 0;\n+\txmp.favor = 0;\n+\n \tstruct option options[] = {\n \t\tOPT_BOOLEAN('p', \"stdout\", &to_stdout, \"send results to standard output\"),\n-\t\tOPT_SET_INT(0, \"diff3\", &style, \"use a diff3 based merge\", XDL_MERGE_DIFF3),\n-\t\tOPT_SET_INT(0, \"ours\", &favor, \"for conflicts, use our version\",\n+\t\tOPT_SET_INT(0, \"diff3\", &xmp.style, \"use a diff3 based merge\", XDL_MERGE_DIFF3),\n+\t\tOPT_SET_INT(0, \"ours\", &xmp.favor, \"for conflicts, use our version\",\n \t\t\t    XDL_MERGE_FAVOR_OURS),\n-\t\tOPT_SET_INT(0, \"theirs\", &favor, \"for conflicts, use their version\",\n+\t\tOPT_SET_INT(0, \"theirs\", &xmp.favor, \"for conflicts, use their version\",\n \t\t\t    XDL_MERGE_FAVOR_THEIRS),\n \t\tOPT_SET_INT(0, \"union\", &xmp.favor, \"for conflicts, use a union version\",\n \t\t\t    XDL_MERGE_FAVOR_UNION),\n@@ -53,7 +55,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)\n \t\t/* Read the configuration file */\n \t\tgit_config(git_xmerge_config, NULL);\n \t\tif (0 <= git_xmerge_style)\n-\t\t\tstyle = git_xmerge_style;\n+\t\t\txmp.style = git_xmerge_style;\n \t}\n \n \targc = parse_options(argc, argv, prefix, options, merge_file_usage, 0);\n@@ -76,7 +78,7 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)\n \t}\n \n \tret = xdl_merge(mmfs + 1, mmfs + 0, names[0], mmfs + 2, names[2],\n-\t\t\t&xmp, XDL_MERGE_FLAGS(level, style, favor), &result);\n+\t\t\t&xmp, &result);\n \n \tfor (i = 0; i < 3; i++)\n \t\tfree(mmfs[i].ptr);\ndiff --git a/ll-merge.c b/ll-merge.c\nindex a4b2f4c..82c7742 100644\n--- a/ll-merge.c\n+++ b/ll-merge.c\n@@ -63,8 +63,6 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,\n \t\t\tint flag, int marker_size)\n {\n \txmparam_t xmp;\n-\tint style = 0;\n-\tint favor = (flag >> 1) & 03;\n \n \tif (buffer_is_binary(orig->ptr, orig->size) ||\n \t    buffer_is_binary(src1->ptr, src1->size) ||\n@@ -79,15 +77,13 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,\n \t}\n \n \tmemset(&xmp, 0, sizeof(xmp));\n+\txmp.level = XDL_MERGE_ZEALOUS;\n+\txmp.favor= (flag >> 1) & 03;\n \tif (git_xmerge_style >= 0)\n-\t\tstyle = git_xmerge_style;\n+\t\txmp.style = git_xmerge_style;\n \tif (marker_size > 0)\n \t\txmp.marker_size = marker_size;\n-\treturn xdl_merge(orig,\n-\t\t\t src1, name1,\n-\t\t\t src2, name2,\n-\t\t\t &xmp, XDL_MERGE_FLAGS(XDL_MERGE_ZEALOUS, style, favor),\n-\t\t\t result);\n+\treturn xdl_merge(orig, src1, name1, src2, name2, &xmp, result);\n }\n \n static int ll_union_merge(const struct ll_merge_driver *drv_unused,\ndiff --git a/xdiff/xdiff.h b/xdiff/xdiff.h\nindex 22614d5..a71763a 100644\n--- a/xdiff/xdiff.h\n+++ b/xdiff/xdiff.h\n@@ -56,18 +56,14 @@ extern \"C\" {\n #define XDL_MERGE_EAGER 1\n #define XDL_MERGE_ZEALOUS 2\n #define XDL_MERGE_ZEALOUS_ALNUM 3\n-#define XDL_MERGE_LEVEL_MASK 0x0f\n \n /* merge favor modes */\n #define XDL_MERGE_FAVOR_OURS 1\n #define XDL_MERGE_FAVOR_THEIRS 2\n #define XDL_MERGE_FAVOR_UNION 3\n-#define XDL_MERGE_FAVOR(flags) (((flags)>>4) & 3)\n-#define XDL_MERGE_FLAGS(level, style, favor) ((level)|(style)|((favor)<<4))\n \n /* merge output styles */\n-#define XDL_MERGE_DIFF3 0x8000\n-#define XDL_MERGE_STYLE_MASK 0x8000\n+#define XDL_MERGE_DIFF3 1\n \n typedef struct s_mmfile {\n \tchar *ptr;\n@@ -118,13 +114,16 @@ int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,\n typedef struct s_xmparam {\n \txpparam_t xpp;\n \tint marker_size;\n+\tint level;\n+\tint favor;\n+\tint style;\n } xmparam_t;\n \n #define DEFAULT_CONFLICT_MARKER_SIZE 7\n \n int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,\n \t\tmmfile_t *mf2, const char *name2,\n-\t\txmparam_t const *xmp, int flags, mmbuffer_t *result);\n+\t\txmparam_t const *xmp, mmbuffer_t *result);\n \n #ifdef __cplusplus\n }\ndiff --git a/xdiff/xmerge.c b/xdiff/xmerge.c\nindex c901ecb..87cafa7 100644\n--- a/xdiff/xmerge.c\n+++ b/xdiff/xmerge.c\n@@ -400,13 +400,13 @@ static int xdl_simplify_non_conflicts(xdfenv_t *xe1, xdmerge_t *m,\n  */\n static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1,\n \t\txdfenv_t *xe2, xdchange_t *xscr2, const char *name2,\n-\t\tint flags, xmparam_t const *xmp, mmbuffer_t *result) {\n+\t\txmparam_t const *xmp, mmbuffer_t *result) {\n \txdmerge_t *changes, *c;\n \txpparam_t const *xpp = &xmp->xpp;\n \tint i0, i1, i2, chg0, chg1, chg2;\n-\tint level = flags & XDL_MERGE_LEVEL_MASK;\n-\tint style = flags & XDL_MERGE_STYLE_MASK;\n-\tint favor = XDL_MERGE_FAVOR(flags);\n+\tint level = xmp->level;\n+\tint style = xmp->style;\n+\tint favor = xmp->favor;\n \n \tif (style == XDL_MERGE_DIFF3) {\n \t\t/*\n@@ -556,7 +556,7 @@ static int xdl_do_merge(xdfenv_t *xe1, xdchange_t *xscr1, const char *name1,\n \n int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,\n \t\tmmfile_t *mf2, const char *name2,\n-\t\txmparam_t const *xmp, int flags, mmbuffer_t *result) {\n+\t\txmparam_t const *xmp, mmbuffer_t *result) {\n \txdchange_t *xscr1, *xscr2;\n \txdfenv_t xe1, xe2;\n \tint status;\n@@ -593,7 +593,7 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, const char *name1,\n \t} else {\n \t\tstatus = xdl_do_merge(&xe1, xscr1, name1,\n \t\t\t\t      &xe2, xscr2, name2,\n-\t\t\t\t      flags, xmp, result);\n+\t\t\t\t      xmp, result);\n \t}\n \txdl_free_script(xscr1);\n \txdl_free_script(xscr2);\n-- \n1.7.0.584.g2da2b\n"},{"id":"135890","messageId":"7viq9h3yql.fsf@alter.siamese.dyndns.org","threadId":"22856","inReplyTo":"972adf380be481b5e8d031481586e9c34da2cbb7.1267385538.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH 1/3] merge-file: add option to specify the marker size","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-28T20:13:22Z","receivedAt":"2010-02-28T20:13:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>\n> ---\n>\n> This can probably improved in a way, that the marker size will be taken\n> from attributes. This could be done by an explicit --marker-size-by-path\n> option or an option which names one of the three input files as a git\n> path.\n\nYou don't want any option that is specifically about \"marker size\".  An\noption to specify the path to take attributes for would be the right way\nto go.  You might want to see \"hash-object --path\" for an inspiration.\n"},{"id":"135892","messageId":"7vwrxx2k29.fsf@alter.siamese.dyndns.org","threadId":"22856","inReplyTo":"17999fdb3ff374156acb7fc670426265fa27b94b.1267385538.git.bert.wesarg@googlemail.com","subject":"Re: [PATCH 2/3] make union merge an xdl merge favor","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-02-28T20:15:42Z","receivedAt":"2010-02-28T20:15:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n> The current union merge driver is implemented as an post process.  But the\n> xdl_merge code is quite capable to produce the result by itself.  Therefore\n> move to it there and teach git-merge-file a new --union option.\n\nI like the idea of patch 2 and 3 but they are independent of what we do\n(or don't do) to merge-file.  Could you flip the order of the patches so\nthat 2 and 3 can go first?\n"},{"id":"135925","messageId":"36ca99e91002282257i7f07f035o15d8d64e062ee94e@mail.gmail.com","threadId":"22856","inReplyTo":"7vwrxx2k29.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/3] make union merge an xdl merge favor","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-03-01T06:57:40Z","receivedAt":"2010-03-01T06:57:40Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Sun, Feb 28, 2010 at 21:15, Junio C Hamano <gitster@pobox.com> wrote:\n> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>\n>> The current union merge driver is implemented as an post process.  But the\n>> xdl_merge code is quite capable to produce the result by itself.  Therefore\n>> move to it there and teach git-merge-file a new --union option.\n>\n> I like the idea of patch 2 and 3 but they are independent of what we do\n> (or don't do) to merge-file.  Could you flip the order of the patches so\n> that 2 and 3 can go first?\n\nWIll do. On a side note: I plan to support the --union option also for\ngit-checkout. Would that be a good idea?\n\nBert\n\n>\n>\n>\n"},{"id":"135932","messageId":"7vaausza8v.fsf@alter.siamese.dyndns.org","threadId":"22856","inReplyTo":"36ca99e91002282257i7f07f035o15d8d64e062ee94e@mail.gmail.com","subject":"Re: [PATCH 2/3] make union merge an xdl merge favor","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-01T09:01:20Z","receivedAt":"2010-03-01T09:01:20Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Bert Wesarg <bert.wesarg@googlemail.com> writes:\n\n> WIll do. On a side note: I plan to support the --union option also for\n> git-checkout. Would that be a good idea?\n\nWhat does it do?  Resolve conflicted paths using union merge at checkout\ntime?  That somehow feels like a dirty \"because we can, and I only care\nabout union\" hack to me.\n\nI am mildly against \"merge-file --union\" in the first place.  The part I\nactually liked in [2/3] was the removal of postprocessing.\n"},{"id":"135935","messageId":"36ca99e91003010118m77b26675j63ed983fcb702ace@mail.gmail.com","threadId":"22856","inReplyTo":"36ca99e91002282315m6c3caf1el61755c0d96d21cf2@mail.gmail.com","subject":"Re: [PATCH 1/3] merge-file: add option to specify the marker size","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-03-01T09:18:25Z","receivedAt":"2010-03-01T09:18:25Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"[ Sorry again, I removed the list again ]\n\nOn Mon, Mar 1, 2010 at 08:15, Bert Wesarg <bert.wesarg@googlemail.com> wrote:\n> On Sun, Feb 28, 2010 at 21:13, Junio C Hamano <gitster@pobox.com> wrote:\n>> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>>\n>>> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>\n>>>\n>>> ---\n>>>\n>>> This can probably improved in a way, that the marker size will be taken\n>>> from attributes. This could be done by an explicit --marker-size-by-path\n>>> option or an option which names one of the three input files as a git\n>>> path.\n>>\n>> You don't want any option that is specifically about \"marker size\".  An\n>> option to specify the path to take attributes for would be the right way\n>> to go.  You might want to see \"hash-object --path\" for an inspiration.\n>>\n> So you suggest that it is only possible to set the conflict marker\n> size for merges inside a git directory? I don't think this is a good\n> idea, for a tool which is designed to work also outside of a git\n> directory.\n>\n> In any case, if we add a --path option, merge-file should use ll_merge\n> in this case, right?\n>\n> Bert\n"},{"id":"135939","messageId":"36ca99e91003010255h5784f29dq81737a736639cac8@mail.gmail.com","threadId":"22856","inReplyTo":"7vaausza8v.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/3] make union merge an xdl merge favor","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2010-03-01T10:55:36Z","receivedAt":"2010-03-01T10:55:36Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Mon, Mar 1, 2010 at 10:01, Junio C Hamano <gitster@pobox.com> wrote:\n> Bert Wesarg <bert.wesarg@googlemail.com> writes:\n>\n>> WIll do. On a side note: I plan to support the --union option also for\n>> git-checkout. Would that be a good idea?\n>\n> What does it do?  Resolve conflicted paths using union merge at checkout\n> time?  That somehow feels like a dirty \"because we can, and I only care\n> about union\" hack to me.\n\nPoint taken, I does not have a usecase by myself.\n"},{"id":"135961","messageId":"7veik4t0i7.fsf@alter.siamese.dyndns.org","threadId":"22856","inReplyTo":"7vaausza8v.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 2/3] make union merge an xdl merge favor","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-01T17:28:16Z","receivedAt":"2010-03-01T17:28:16Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> I am mildly against \"merge-file --union\" in the first place.  The part I\n> actually liked in [2/3] was the removal of postprocessing.\n\nActually I take the first sentence back.  The --union option given to\nmerge-file is comparable to --ours/--theirs that let you (a Porcelain\nwriter using the command) access the ll-merge machinery to resolve\nconflicts in favor of one side on contents stored in an arbitrary\ntemporary filename (or even outside a git repository).  So as a feature\nI think addition of \"union\" is in line with what we already have.\n\nBut I at the same time I think that we could add the feature while making\nexisting --ours/--theirs options redundant (and deprecatable if we want to\nin the longer term), if the attributes mechanism is made available to us\n(e.g. add \"--attribute-path=<use attributes for this path>\" option, and/or\nperhaps add \"--attributes=<use this set of attributes>\" option) directly\nfrom the command line.\n\nI doubt \"checkout --union\" is a good idea, though.  Its --ours/--theirs\noptions do not have anything to do with merge (it specifies _what_ to\ncheckout, not _how_), and the comparison I made in the previous paragraph\nfor merge-file does not apply.\n\nIt however is plausible that in a scenario where:\n\n (1) you ran \"git merge\" (or anything that results in conflicts) and got a\n     conflict; and\n\n (2) you know using other ll-merge backend, perhaps a custom one you have\n     that is accessible via ll-merge, would have produced a better result.\n\nit might be useful if you can say \"forget this failed auto-merge; attempt\nthe same merge for the path but using this different ll-merge backend\".\nI don't think that feature belongs to \"checkout\", though.\n"}]}