Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Upon repo.Push standard git still sees commits as unpushed #443

Closed
osklyar opened this issue Jun 20, 2017 · 1 comment
Closed

Upon repo.Push standard git still sees commits as unpushed #443

osklyar opened this issue Jun 20, 2017 · 1 comment
Labels

Comments

@osklyar
Copy link

osklyar commented Jun 20, 2017

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
@osklyar osklyar changed the title Upon repo.Push standard git still sees as unpushed Upon repo.Push standard git still sees commits as unpushed Jun 20, 2017
@smola
Copy link
Collaborator

smola commented Jun 23, 2017

@osklyar Thanks for reporting this!
Indeed, it looks we're not updating origin references on push when we should.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants