diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-10-26 17:35:12 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-11-01 22:47:06 +0100 |
commit | 968c7d072ae61852564a831706ca5e969a2eb62c (patch) | |
tree | 2308772f56bad9f12d5bf68736ded00a23de2f4f /src/fetchhead.c | |
parent | a7382aa28c8a24a4f718eb01574d744330f7a5a9 (diff) | |
download | libgit2-968c7d072ae61852564a831706ca5e969a2eb62c.tar.gz |
remote: create FETCH_HEAD with a refspecless remote
When downloading the default branch due to lack of refspecs, we still
need to write out FETCH_HEAD with the tip we downloaded, unfortunately
with a format that doesn't match what we already have.
Diffstat (limited to 'src/fetchhead.c')
-rw-r--r-- | src/fetchhead.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/fetchhead.c b/src/fetchhead.c index 4dcebb857..77aafc8f3 100644 --- a/src/fetchhead.c +++ b/src/fetchhead.c @@ -74,6 +74,7 @@ static int fetchhead_ref_write( { char oid[GIT_OID_HEXSZ + 1]; const char *type, *name; + int head = 0; assert(file && fetchhead_ref); @@ -87,11 +88,16 @@ static int fetchhead_ref_write( GIT_REFS_TAGS_DIR) == 0) { type = "tag "; name = fetchhead_ref->ref_name + strlen(GIT_REFS_TAGS_DIR); + } else if (!git__strcmp(fetchhead_ref->ref_name, GIT_HEAD_FILE)) { + head = 1; } else { type = ""; name = fetchhead_ref->ref_name; } + if (head) + return git_filebuf_printf(file, "%s\t\t%s\n", oid, fetchhead_ref->remote_url); + return git_filebuf_printf(file, "%s\t%s\t%s'%s' of %s\n", oid, (fetchhead_ref->is_merge) ? "" : "not-for-merge", |