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

repository: fix pull when fetch returns up-to-date #207

Merged
merged 1 commit into from
Jan 16, 2017
Merged

repository: fix pull when fetch returns up-to-date #207

merged 1 commit into from
Jan 16, 2017

Conversation

mcuadros
Copy link
Contributor

@mcuadros mcuadros commented Jan 12, 2017

After perform a Repository.Fetch if a Repository.Pull was done, the references weren't updated.

The reason was because Repository.Fetch returns NoErrAlreadyUpToDate and the internal Repository.updateReferences was not called

Fixes: #198

@smola
Copy link
Collaborator

smola commented Jan 12, 2017

This does not seem the standard git behavior:

➜  go-git.v4 git:(master) ✗ git fetch origin
Enter passphrase for key '/home/smola/.ssh/id_rsa': 
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 18 (delta 4), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (18/18), done.
From github.com:src-d/go-git
   92d3de7..c5f1056  master     -> origin/master

➜  go-git.v4 git:(master) ✗ git pull origin master
Enter passphrase for key '/home/smola/.ssh/id_rsa': 
From github.com:src-d/go-git
 * branch            master     -> FETCH_HEAD
Updating c9c043c..c5f1056
[...]

➜  go-git.v4 git:(master) ✗ git pull origin master
Enter passphrase for key '/home/smola/.ssh/id_rsa': 
From github.com:src-d/go-git
 * branch            master     -> FETCH_HEAD
Already up-to-date.

First I fetch, then pull, and pull again. First pull does not return "Already up-to-date" because it updates a reference, second pull returns "Already up-to-date" because it doesn't.

@codecov-io
Copy link

codecov-io commented Jan 12, 2017

Current coverage is 76.26% (diff: 76.31%)

Merging #207 into master will decrease coverage by 0.57%

@@             master       #207   diff @@
==========================================
  Files            96         96          
  Lines          6278       6298    +20   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits           4824       4803    -21   
- Misses          925        973    +48   
+ Partials        529        522     -7   

Powered by Codecov. Last update c5f1056...2b7286e

@mcuadros mcuadros merged commit ce78ccb into src-d:master Jan 16, 2017
gsalingu-ovhus pushed a commit to gsalingu-ovhus/go-git that referenced this pull request Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants