summaryrefslogtreecommitdiff
path: root/ext/git
diff options
context:
space:
mode:
authorAlexander Matyushentsev <Alexander_Matyushentsev@intuit.com>2021-01-21 23:10:45 -0800
committerGitHub <noreply@github.com>2021-01-22 08:10:45 +0100
commitc0d7e1d1daa864f1f06917d75fee40ccc0b07687 (patch)
tree02bc4e9252c458611d4df5a7a3608351492e025a /ext/git
parent6269c394d6d6454d08b9a2dd18c6ba24acd1e461 (diff)
fix: run 'git add' for create files before pushing back (#143)
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
Diffstat (limited to 'ext/git')
-rw-r--r--ext/git/client.go5
-rw-r--r--ext/git/mocks/Client.go16
2 files changed, 20 insertions, 1 deletions
diff --git a/ext/git/client.go b/ext/git/client.go
index e9ed558..097ce9e 100644
--- a/ext/git/client.go
+++ b/ext/git/client.go
@@ -62,6 +62,7 @@ type Client interface {
Branch(sourceBranch, targetBranch string) error
Commit(pathSpec string, message string, signingKey string) error
Push(remote string, branch string, force bool) error
+ Add(path string) error
}
// nativeGitClient implements Client interface using git CLI
@@ -567,6 +568,10 @@ func (m *nativeGitClient) Push(remote string, branch string, force bool) error {
return nil
}
+func (m *nativeGitClient) Add(path string) error {
+ return m.runCredentialedCmd("git", "add", path)
+}
+
// runWrapper runs a custom command with all the semantics of running the Git client
func (m *nativeGitClient) runGnuPGWrapper(wrapper string, args ...string) (string, error) {
cmd := exec.Command(wrapper, args...)
diff --git a/ext/git/mocks/Client.go b/ext/git/mocks/Client.go
index 05d4f5d..a65d9ad 100644
--- a/ext/git/mocks/Client.go
+++ b/ext/git/mocks/Client.go
@@ -1,4 +1,4 @@
-// Code generated by mockery v1.1.2. DO NOT EDIT.
+// Code generated by mockery v1.0.0. DO NOT EDIT.
package mocks
@@ -12,6 +12,20 @@ type Client struct {
mock.Mock
}
+// Add provides a mock function with given fields: path
+func (_m *Client) Add(path string) error {
+ ret := _m.Called(path)
+
+ var r0 error
+ if rf, ok := ret.Get(0).(func(string) error); ok {
+ r0 = rf(path)
+ } else {
+ r0 = ret.Error(0)
+ }
+
+ return r0
+}
+
// Branch provides a mock function with given fields: sourceBranch, targetBranch
func (_m *Client) Branch(sourceBranch string, targetBranch string) error {
ret := _m.Called(sourceBranch, targetBranch)