@matheusbsbs / matheus-bagliano / commits / 11f3aa2305
Fork 0

merge-file: add option to specify the marker size

This adds the abbility to specify the conflict marker size for merges outside a git repository. Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Bert Wesarg committed Mar 1, 2010 at 22:46 UTC 11f3aa2305426d11945c72479d24a15d30768d50
3 files changed +42 -2
Documentation/git-merge-file.txt
+3 -2
@@ -10,7 +10,7 @@ SYNOPSIS
10 --------
11 [verse]
12 'git merge-file' [-L <current-name> [-L <base-name> [-L <other-name>]]]
13 - [--ours|--theirs] [-p|--stdout] [-q|--quiet]
13 + [--ours|--theirs] [-p|--stdout] [-q|--quiet] [--marker-size=<n>]
14 <current-file> <base-file> <other-file>
15
16
@@ -37,7 +37,8 @@ normally outputs a warning and brackets the conflict with lines containing
37 If there are conflicts, the user should edit the result and delete one of
38 the alternatives. When `--ours` or `--theirs` option is in effect, however,
39 these conflicts are resolved favouring lines from `<current-file>` or
40 -lines from `<other-file>` respectively.
40 +lines from `<other-file>` respectively. The length of the conflict markers
41 +can be given with the `--marker-size` option.
42
43 The exit value of this program is negative on error, and the number of
44 conflicts otherwise. If the merge was clean, the exit value is 0.
builtin-merge-file.c
+2
@@ -36,6 +36,8 @@ int cmd_merge_file(int argc, const char **argv, const char *prefix)
36 XDL_MERGE_FAVOR_OURS),
37 OPT_SET_INT(0, "theirs", &xmp.favor, "for conflicts, use their version",
38 XDL_MERGE_FAVOR_THEIRS),
39 + OPT_INTEGER(0, "marker-size", &xmp.marker_size,
40 + "for conflicts, use this marker size"),
41 OPT__QUIET(&quiet),
42 OPT_CALLBACK('L', NULL, names, "name",
43 "set labels for file1/orig_file/file2", &label_cb),
t/t6023-merge-file.sh
+37
@@ -211,4 +211,41 @@ test_expect_success '"diff3 -m" style output (2)' '
211 test_cmp expect actual
212 '
213
214 +cat >expect <<\EOF
215 +Dominus regit me,
216 +<<<<<<<<<< new8.txt
217 +et nihil mihi deerit;
218 +
219 +
220 +
221 +
222 +In loco pascuae ibi me collocavit;
223 +super aquam refectionis educavit me.
224 +||||||||||
225 +et nihil mihi deerit.
226 +In loco pascuae ibi me collocavit,
227 +super aquam refectionis educavit me;
228 +==========
229 +et nihil mihi deerit,
230 +
231 +
232 +
233 +
234 +In loco pascuae ibi me collocavit --
235 +super aquam refectionis educavit me,
236 +>>>>>>>>>> new9.txt
237 +animam meam convertit,
238 +deduxit me super semitas jusitiae,
239 +propter nomen suum.
240 +Nam et si ambulavero in medio umbrae mortis,
241 +non timebo mala, quoniam TU mecum es:
242 +virga tua et baculus tuus ipsa me consolata sunt.
243 +EOF
244 +
245 +test_expect_success 'marker size' '
246 + test_must_fail git merge-file -p --marker-size=10 \
247 + new8.txt new5.txt new9.txt >actual &&
248 + test_cmp expect actual
249 +'
250 +
251 test_done