git notes merge: Add another auto-resolving strategy: "cat_sort_uniq"

This new strategy is similar to "concatenate", but in addition to
concatenating the two note candidates, this strategy sorts the resulting
lines, and removes duplicate lines from the result. This is equivalent to
applying the "cat | sort | uniq" shell pipeline to the two note candidates.

This strategy is useful if the notes follow a line-based format where one
wants to avoid duplicate lines in the merge result.

Note that if either of the note candidates contain duplicate lines _prior_
to the merge, these will also be removed by this merge strategy.

The patch also contains tests and documentation for the new strategy.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Johan Herland
2010-11-15 00:57:17 +01:00
committed by Junio C Hamano
parent 6cfd6a9dea
commit a6a09095a0
7 changed files with 248 additions and 4 deletions

View File

@@ -17,7 +17,8 @@ struct notes_merge_options {
NOTES_MERGE_RESOLVE_MANUAL = 0,
NOTES_MERGE_RESOLVE_OURS,
NOTES_MERGE_RESOLVE_THEIRS,
NOTES_MERGE_RESOLVE_UNION
NOTES_MERGE_RESOLVE_UNION,
NOTES_MERGE_RESOLVE_CAT_SORT_UNIQ
} strategy;
unsigned has_worktree:1;
};