aboutsummaryrefslogtreecommitdiffstats
path: root/repository/git.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-12 12:44:46 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-12 12:44:46 +0200
commitc498674718608a1171a4fcef6f26184df7d5fa7b (patch)
tree9cc53ea07b61d52b12cd5fa3367b25d04bebc150 /repository/git.go
parentd0443659123f912e9385e27efebe4b7da65aa2f6 (diff)
downloadgit-bug-c498674718608a1171a4fcef6f26184df7d5fa7b.tar.gz
add the new bug command with a very primitive bug datastructure
Diffstat (limited to 'repository/git.go')
-rw-r--r--repository/git.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/repository/git.go b/repository/git.go
index 8e957523..309641f6 100644
--- a/repository/git.go
+++ b/repository/git.go
@@ -78,6 +78,11 @@ func (repo *GitRepo) GetRepoStateHash() (string, error) {
return fmt.Sprintf("%x", sha1.Sum([]byte(stateSummary))), err
}
+// GetUserName returns the name the the user has used to configure git
+func (repo *GitRepo) GetUserName() (string, error) {
+ return repo.runGitCommand("config", "user.name")
+}
+
// GetUserEmail returns the email address that the user has used to configure git.
func (repo *GitRepo) GetUserEmail() (string, error) {
return repo.runGitCommand("config", "user.email")
@@ -88,30 +93,25 @@ func (repo *GitRepo) GetCoreEditor() (string, error) {
return repo.runGitCommand("var", "GIT_EDITOR")
}
-
// PullRefs pull git refs from a remote
func (repo *GitRepo) PullRefs(remote string, refPattern string) error {
- refspec := fmt.Sprintf("%s:%s", refPattern, refPattern)
+ fetchRefSpec := fmt.Sprintf("+%s:%s", refPattern, refPattern)
+ err := repo.runGitCommandInline("fetch", remote, fetchRefSpec)
- // The push is liable to fail if the user forgot to do a pull first, so
- // we treat errors as user errors rather than fatal errors.
- err := repo.runGitCommandInline("push", remote, refspec)
- if err != nil {
- return fmt.Errorf("failed to push to the remote '%s': %v", remote, err)
- }
- return nil
+ // TODO: merge new data
+
+ return err
}
// PushRefs push git refs to a remote
func (repo *GitRepo) PushRefs(remote string, refPattern string) error {
- remoteNotesRefPattern := getRemoteNotesRef(remote, refPattern)
- fetchRefSpec := fmt.Sprintf("+%s:%s", refPattern, remoteNotesRefPattern)
- err := repo.runGitCommandInline("fetch", remote, fetchRefSpec)
+ // The push is liable to fail if the user forgot to do a pull first, so
+ // we treat errors as user errors rather than fatal errors.
+ err := repo.runGitCommandInline("push", remote, refPattern)
if err != nil {
- return err
+ return fmt.Errorf("failed to push to the remote '%s': %v", remote, err)
}
-
- return repo.mergeRemoteNotes(remote, notesRefPattern)
+ return nil
}
/*