notes: add notes.mergeStrategy option to select default strategy
Teach git-notes about "notes.mergeStrategy" to select a general strategy for all notes merges. This enables a user to always get expected merge strategy such as "cat_sort_uniq" without having to pass the "-s" option manually. Signed-off-by: Jacob Keller <jacob.keller@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
11dd2b2e9a
commit
d2d68d9975
@ -298,6 +298,13 @@ test_expect_success 'merge z into y with invalid strategy => Fail/No changes' '
|
||||
verify_notes y y
|
||||
'
|
||||
|
||||
test_expect_success 'merge z into y with invalid configuration option => Fail/No changes' '
|
||||
git config core.notesRef refs/notes/y &&
|
||||
test_must_fail git -c notes.mergeStrategy="foo" notes merge z &&
|
||||
# Verify no changes (y)
|
||||
verify_notes y y
|
||||
'
|
||||
|
||||
cat <<EOF | sort >expect_notes_ours
|
||||
68b8630d25516028bed862719855b3d6768d7833 $commit_sha15
|
||||
5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
|
||||
@ -365,6 +372,17 @@ test_expect_success 'reset to pre-merge state (y)' '
|
||||
verify_notes y y
|
||||
'
|
||||
|
||||
test_expect_success 'merge z into y with "ours" configuration option => Non-conflicting 3-way merge' '
|
||||
git -c notes.mergeStrategy="ours" notes merge z &&
|
||||
verify_notes y ours
|
||||
'
|
||||
|
||||
test_expect_success 'reset to pre-merge state (y)' '
|
||||
git update-ref refs/notes/y refs/notes/y^1 &&
|
||||
# Verify pre-merge state
|
||||
verify_notes y y
|
||||
'
|
||||
|
||||
cat <<EOF | sort >expect_notes_theirs
|
||||
9b4b2c61f0615412da3c10f98ff85b57c04ec765 $commit_sha15
|
||||
5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
|
||||
@ -432,6 +450,17 @@ test_expect_success 'reset to pre-merge state (y)' '
|
||||
verify_notes y y
|
||||
'
|
||||
|
||||
test_expect_success 'merge z into y with "theirs" strategy overriding configuration option "ours" => Non-conflicting 3-way merge' '
|
||||
git -c notes.mergeStrategy="ours" notes merge --strategy=theirs z &&
|
||||
verify_notes y theirs
|
||||
'
|
||||
|
||||
test_expect_success 'reset to pre-merge state (y)' '
|
||||
git update-ref refs/notes/y refs/notes/y^1 &&
|
||||
# Verify pre-merge state
|
||||
verify_notes y y
|
||||
'
|
||||
|
||||
cat <<EOF | sort >expect_notes_union
|
||||
7c4e546efd0fe939f876beb262ece02797880b54 $commit_sha15
|
||||
5de7ea7ad4f47e7ff91989fb82234634730f75df $commit_sha14
|
||||
@ -644,4 +673,15 @@ test_expect_success 'merge y into z with "cat_sort_uniq" strategy => Non-conflic
|
||||
verify_notes z cat_sort_uniq
|
||||
'
|
||||
|
||||
test_expect_success 'reset to pre-merge state (z)' '
|
||||
git update-ref refs/notes/z refs/notes/z^1 &&
|
||||
# Verify pre-merge state
|
||||
verify_notes z z
|
||||
'
|
||||
|
||||
test_expect_success 'merge y into z with "cat_sort_uniq" strategy configuration option => Non-conflicting 3-way merge' '
|
||||
git -c notes.mergeStrategy="cat_sort_uniq" notes merge y &&
|
||||
verify_notes z cat_sort_uniq
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user