예제 #1
0
func DeleteRemoteComment(repoPath, remoteName, commentID string) result.Result {
	return gg.WithRemote(repoPath, remoteName, func(remote *git.Remote) result.Result {
		return CreatePerson(gg.ConfiguredCommitter(repoPath)).Analysis(func(val interface{}) result.Result {
			sig := val.(*Person).Signature()
			refspec := fmt.Sprintf(":%v", commentID)
			return gg.Push(repoPath, remoteName, []string{refspec}, sig)
		}, func(err error) result.Result {
			return result.NewFailure(errors.New(noCommitterError))
		})
	})
}
예제 #2
0
// Configure a remote to fetch and push comment changes by default
// @return result.Result<bool, error>
func ConfigureRemoteForComments(repoPath, remoteName string) result.Result {
	return gg.WithRemote(repoPath, remoteName, func(remote *git.Remote) result.Result {
		success := func(values ...interface{}) result.Result {
			return result.NewSuccess(true)
		}
		return gg.WithRepository(repoPath, func(repo *git.Repository) result.Result {
			pushRef := commentDefaultPush
			fetchRef := fmt.Sprintf(commentDefaultFetch, remoteName)
			return result.Combine(success, gg.AddPush(repo, remote, pushRef), gg.AddFetch(repo, remote, fetchRef))
		})
	})
}