merge-recursive: options to ignore whitespace changes · wolfpython/git@4e5dd04 · GitHub
Skip to content

Commit 4e5dd04

Browse files
justinfrankelgitster
authored andcommitted
merge-recursive: options to ignore whitespace changes
Add support for merging with ignoring line endings (specifically --ignore-space-at-eol) when using recursive merging. This is as a strategy-option, so that you can do: git merge --strategy-option=ignore-space-at-eol <branch> and git rebase --strategy-option=ignore-space-at-eol <branch> This can be useful for coping with line-ending damage (Xcode 3.1 has a nasty habit of converting all CRLFs to LFs, and VC6 tends to just use CRLFs for inserted lines). The only option I need is ignore-space-at-eol, but while at it, include the other xdiff whitespace options (ignore-space-change, ignore-all-space), too. [jn: with documentation] Signed-off-by: Justin Frankel <justin@cockos.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 58a1ece commit 4e5dd04

3 files changed

Lines changed: 207 additions & 0 deletions

File tree

Documentation/merge-strategies.txt

Lines changed: 15 additions & 0 deletions

merge-recursive.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1515,6 +1515,12 @@ int parse_merge_opt(struct merge_options *o, const char *s)
15151515
o->subtree_shift = s + strlen("subtree=");
15161516
else if (!strcmp(s, "patience"))
15171517
o->xdl_opts |= XDF_PATIENCE_DIFF;
1518+
else if (!strcmp(s, "ignore-space-change"))
1519+
o->xdl_opts |= XDF_IGNORE_WHITESPACE_CHANGE;
1520+
else if (!strcmp(s, "ignore-all-space"))
1521+
o->xdl_opts |= XDF_IGNORE_WHITESPACE;
1522+
else if (!strcmp(s, "ignore-space-at-eol"))
1523+
o->xdl_opts |= XDF_IGNORE_WHITESPACE_AT_EOL;
15181524
else if (!strcmp(s, "renormalize"))
15191525
o->renormalize = 1;
15201526
else if (!strcmp(s, "no-renormalize"))

t/t3032-merge-recursive-options.sh

Lines changed: 186 additions & 0 deletions

0 commit comments

Comments
 (0)