This repository was archived by the owner on Sep 11, 2020. It is now read-only.
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Closed
Description
Issuing git.Repository.Push
actually pushes the commits as expected, however, some internal state of the repository remains unset because issuing git status
afterwards reports that the local branch is ahead of remote. The following example is put together using the geat tool based on go-git
. It uses the following command to push the changes:
...
err = repo.Push(&git.PushOptions{
RemoteName: remote,
RefSpecs: []config.RefSpec{config.RefSpec(refspec)},
Auth: auth,
})
if err == nil {
defer fmt.Fprintf(w, "\r\033[K=> in %s pushed branch %s to %s\n", target, branch, remote)
}
return err
Here is what happens:
=> in . the state is modified on branch master
staged:
M cmd/common.go
M cmd/pull.go
➜ geat git:(master) ✗ geat commit -m "Minor option changes in the CLI API"
=> in . commited staged changes to hash acde7c3c209b1a18c4c962a195f06de5296573b4
➜ geat git:(master) geat push
=> in . pushed branch master to origin
➜ geat git:(master) geat status
=> in . the state is clean on branch master
➜ geat git:(master) git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
➜ geat git:(master) git push
Everything up-to-date
➜ geat git:(master) git status
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working tree clean