Skip to content

Commit

Permalink
- adding git add + commit when packing a module.
Browse files Browse the repository at this point in the history
  • Loading branch information
matang28 committed May 7, 2019
1 parent 173b188 commit 900f887
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions internal/data/github_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,23 @@ func (this *GithubBackend) Push(name string, source string) error {
return err
}

clearRemote := exec.Command("git", "remote", "rm", "origin")
clearRemote.Dir = source
err = clearRemote.Run()
gitListFiles := exec.Command("git", "ls-files")
gitListFiles.Dir = source
changedFiles, err := gitListFiles.Output()
if err != nil {
return err
}

gitCommit := exec.Command("git", "commit", "-m", string(changedFiles))
gitCommit.Dir = source
if err := gitCommit.Run(); err != nil {
return err
}

clearRemote := exec.Command("git", "remote", "rm", "origin")
clearRemote.Dir = source
_ = clearRemote.Run()

addRemote := exec.Command("git", "remote", "add", "origin", githubUrl(name))
addRemote.Dir = source
err = addRemote.Run()
Expand All @@ -64,8 +74,7 @@ func (this *GithubBackend) Push(name string, source string) error {

push := exec.Command("git", "push", "-u", "origin", "master")
push.Dir = source
bytes, err := push.Output()
fmt.Println(bytes)
err = push.Run()
return err
}

Expand Down

0 comments on commit 900f887

Please sign in to comment.