summaryrefslogtreecommitdiff
path: root/merge.go
diff options
context:
space:
mode:
Diffstat (limited to 'merge.go')
-rw-r--r--merge.go19
1 files changed, 13 insertions, 6 deletions
diff --git a/merge.go b/merge.go
index 272bf6a..0b0a8f1 100644
--- a/merge.go
+++ b/merge.go
@@ -81,12 +81,19 @@ func (r *Repository) AnnotatedCommitFromRef(ref *Reference) (*AnnotatedCommit, e
type MergeTreeFlag int
const (
+ // Detect renames that occur between the common ancestor and the "ours"
+ // side or the common ancestor and the "theirs" side. This will enable
+ // the ability to merge between a modified and renamed file.
MergeTreeFindRenames MergeTreeFlag = C.GIT_MERGE_TREE_FIND_RENAMES
+ // If a conflict occurs, exit immediately instead of attempting to
+ // continue resolving conflicts. The merge operation will fail with
+ // GIT_EMERGECONFLICT and no index will be returned.
+ MergeTreeFailOnConflict MergeTreeFlag = C.GIT_MERGE_TREE_FAIL_ON_CONFLICT
)
type MergeOptions struct {
- Version uint
- TreeFlags MergeTreeFlag
+ Version uint
+ TreeFlags MergeTreeFlag
RenameThreshold uint
TargetLimit uint
@@ -98,7 +105,7 @@ type MergeOptions struct {
func mergeOptionsFromC(opts *C.git_merge_options) MergeOptions {
return MergeOptions{
Version: uint(opts.version),
- TreeFlags: MergeTreeFlag(opts.tree_flags),
+ TreeFlags: MergeTreeFlag(opts.tree_flags),
RenameThreshold: uint(opts.rename_threshold),
TargetLimit: uint(opts.target_limit),
FileFavor: MergeFileFavor(opts.file_favor),
@@ -262,10 +269,10 @@ func (r *Repository) MergeBases(one, two *Oid) ([]*Oid, error) {
}
oids := make([]*Oid, coids.count)
- hdr := reflect.SliceHeader {
+ hdr := reflect.SliceHeader{
Data: uintptr(unsafe.Pointer(coids.ids)),
- Len: int(coids.count),
- Cap: int(coids.count),
+ Len: int(coids.count),
+ Cap: int(coids.count),
}
goSlice := *(*[]C.git_oid)(unsafe.Pointer(&hdr))