Support git_repository_message, git_repository_message_remove
This commit is contained in:
parent
4b2ac7c998
commit
99c5305166
|
@ -43,6 +43,14 @@ func TestMergeWithSelf(t *testing.T) {
|
||||||
mergeHeads[0] = mergeHead
|
mergeHeads[0] = mergeHead
|
||||||
err = repo.Merge(mergeHeads, nil, nil)
|
err = repo.Merge(mergeHeads, nil, nil)
|
||||||
checkFatal(t, err)
|
checkFatal(t, err)
|
||||||
|
|
||||||
|
mergeMessage, err := repo.Message()
|
||||||
|
checkFatal(t, err)
|
||||||
|
|
||||||
|
expectedMessage := "Merge branch 'master'\n"
|
||||||
|
if mergeMessage != expectedMessage {
|
||||||
|
t.Errorf("mege Meesage = %v, want %v", mergeMessage, expectedMessage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMergeAnalysisWithSelf(t *testing.T) {
|
func TestMergeAnalysisWithSelf(t *testing.T) {
|
||||||
|
|
|
@ -688,3 +688,30 @@ func (r *Repository) ClearGitIgnoreRules() error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (r *Repository) Message() (string, error) {
|
||||||
|
buf := C.git_buf{}
|
||||||
|
defer C.git_buf_dispose(&buf)
|
||||||
|
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
cErr := C.git_repository_message(&buf, r.ptr)
|
||||||
|
runtime.KeepAlive(r)
|
||||||
|
if cErr < 0 {
|
||||||
|
return "", MakeGitError(cErr)
|
||||||
|
}
|
||||||
|
return C.GoString(buf.ptr), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *Repository) RemoveMessage() error {
|
||||||
|
runtime.LockOSThread()
|
||||||
|
defer runtime.UnlockOSThread()
|
||||||
|
|
||||||
|
cErr := C.git_repository_message_remove(r.ptr)
|
||||||
|
runtime.KeepAlive(r)
|
||||||
|
if cErr < 0 {
|
||||||
|
return MakeGitError(cErr)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue