]> git.ipfire.org Git - thirdparty/git.git/commit - notes-merge.c
git notes merge: Handle real, non-conflicting notes merges
authorJohan Herland <johan@herland.net>
Sun, 14 Nov 2010 23:54:11 +0000 (00:54 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 17 Nov 2010 21:21:34 +0000 (13:21 -0800)
commit2085b16aefdbb1dc081aa40c62eb8110a222731d
tree449621162a4f8ba7d76b393d09b888c5564e7c9f
parent56881843d4d916a166ac4c6ba1803e5ceba9c44d
git notes merge: Handle real, non-conflicting notes merges

This continuation of the 'git notes merge' implementation teaches notes-merge
to properly do real merges between notes trees: Two diffs are performed, one
from $base to $remote, and another from $base to $local. The paths in each
diff are normalized to SHA1 object names. The two diffs are then consolidated
into a single list of change pairs to be evaluated. Each change pair consist
of:

  - The annotated object's SHA1
  - The $base SHA1 (i.e. the common ancestor notes for this object)
  - The $local SHA1 (i.e. the current notes for this object)
  - The $remote SHA1 (i.e. the to-be-merged notes for this object)

From the pair ($base -> $local, $base -> $remote), we can determine the merge
result using regular 3-way rules. If conflicts are encountered in this
process, we fail loudly and exit (conflict handling to be added in a future
patch), If we can complete the merge without conflicts, the resulting
notes tree is committed, and the current notes ref updated.

The patch includes added testcases verifying that we can successfully do real
conflict-less merges.

This patch has been improved by the following contributions:
- Jonathan Nieder: Future-proof by always checking add_note() return value
- Stephen Boyd: Use test_commit
- Jonathan Nieder: Use trace_printf(...) instead of OUTPUT(o, 5, ...)
- Junio C Hamano: fixup minor style issues

Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
Thanks-to: Stephen Boyd <bebarino@gmail.com>
Thanks-to: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/notes.c
notes-merge.c
notes-merge.h
t/t3308-notes-merge.sh