Support git_repository_message, git_repository_message_remove #734

Merged
bc-lee merged 2 commits from feature/646-git-repository-message into master 2021-02-02 21:42:22 -06:00
2 changed files with 10 additions and 1 deletions
Showing only changes of commit 9b64d2ed6e - Show all commits

View File

@ -49,7 +49,7 @@ func TestMergeWithSelf(t *testing.T) {
expectedMessage := "Merge branch 'master'\n"
if mergeMessage != expectedMessage {
t.Errorf("mege Meesage = %v, want %v", mergeMessage, expectedMessage)
t.Errorf("merge Message = %v, want %v", mergeMessage, expectedMessage)
}
}

View File

@ -689,6 +689,14 @@ func (r *Repository) ClearGitIgnoreRules() error {
return nil
}
// Message retrieves git's prepared message.
// Operations such as git revert/cherry-pick/merge with the -n option stop just
// short of creating a commit with the changes and save their prepared message
// in .git/MERGE_MSG so the next git-commit execution can present it to the
// user for them to amend if they wish.
//
// Use this function to get the contents of this file. Don't forget to remove
// the file after you create the commit.
func (r *Repository) Message() (string, error) {
lhchavez commented 2021-02-02 08:25:35 -06:00 (Migrated from github.com)
Review
// Message retrieves git's prepared message.
// Operations such as git revert/cherry-pick/merge with the -n option stop just
// short of creating a commit with the changes and save their prepared message
// in .git/MERGE_MSG so the next git-commit execution can present it to the
// user for them to amend if they wish.
//
// Use this function to get the contents of this file. Don't forget to remove
// the file after you create the commit.
func (r *Repository) Message() (string, error) {
```suggestion // Message retrieves git's prepared message. // Operations such as git revert/cherry-pick/merge with the -n option stop just // short of creating a commit with the changes and save their prepared message // in .git/MERGE_MSG so the next git-commit execution can present it to the // user for them to amend if they wish. // // Use this function to get the contents of this file. Don't forget to remove // the file after you create the commit. func (r *Repository) Message() (string, error) { ```
buf := C.git_buf{}
defer C.git_buf_dispose(&buf)
@ -704,6 +712,7 @@ func (r *Repository) Message() (string, error) {
return C.GoString(buf.ptr), nil
}
// RemoveMessage removes git's prepared message.
func (r *Repository) RemoveMessage() error {
lhchavez commented 2021-02-02 08:26:12 -06:00 (Migrated from github.com)
Review
// RemoveMessage removes git's prepared message.
func (r *Repository) RemoveMessage() error {
```suggestion // RemoveMessage removes git's prepared message. func (r *Repository) RemoveMessage() error { ```
runtime.LockOSThread()
defer runtime.UnlockOSThread()