summaryrefslogtreecommitdiff
path: root/src/fetchhead.c
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2017-11-19 09:47:07 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2017-12-26 17:32:38 +0000
commit1b4fbf2e4167c958b7358423e1ee53aa26921eba (patch)
treeecb0150e59f27f734597b3db5e35a51a73db37b1 /src/fetchhead.c
parent3ccc1a4deb67212a3e3c69e91fb7a04975819b31 (diff)
downloadlibgit2-1b4fbf2e4167c958b7358423e1ee53aa26921eba.tar.gz
remote: append to FETCH_HEAD rather than overwrite for each refspec
We treat each refspec on its own, but the code currently overwrites the contents of FETCH_HEAD so we end up with the entries for the last refspec we processed. Instead, truncate it before performing the updates and append to it when updating the references.
Diffstat (limited to 'src/fetchhead.c')
-rw-r--r--src/fetchhead.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fetchhead.c b/src/fetchhead.c
index ac25723d3..e55e7c85b 100644
--- a/src/fetchhead.c
+++ b/src/fetchhead.c
@@ -118,7 +118,7 @@ int git_fetchhead_write(git_repository *repo, git_vector *fetchhead_refs)
if (git_buf_joinpath(&path, repo->gitdir, GIT_FETCH_HEAD_FILE) < 0)
return -1;
- if (git_filebuf_open(&file, path.ptr, GIT_FILEBUF_FORCE, GIT_REFS_FILE_MODE) < 0) {
+ if (git_filebuf_open(&file, path.ptr, GIT_FILEBUF_APPEND, GIT_REFS_FILE_MODE) < 0) {
git_buf_free(&path);
return -1;
}