aboutsummaryrefslogtreecommitdiff
path: root/remote.c
diff options
context:
space:
mode:
authorMartin Koegler <mkoegler@auto.tuwien.ac.at>2008-11-10 22:47:11 +0100
committerJunio C Hamano <gitster@pobox.com>2008-11-11 15:26:40 -0800
commit18afe101eb2c2f68ba58085515f592148128fba3 (patch)
treefb267e9cb07125764ed3481a48194138d5f85f35 /remote.c
parent9db56f71b91153f4076a796c80c61f00edd8b700 (diff)
downloadgit-18afe101eb2c2f68ba58085515f592148128fba3.tar.gz
git-18afe101eb2c2f68ba58085515f592148128fba3.tar.xz
git push: Interpret $GIT_DIR/branches in a Cogito compatible way
Current git versions ignore everything after # (called <head> in the following) when pushing. Older versions (before cf818348f1ab57), interpret #<head> as part of the URL, which make git bail out. As branches origin from Cogito, it is the best to correct this by using the behaviour of cg-push, that is to push HEAD to remote refs/heads/<head>. Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'remote.c')
-rw-r--r--remote.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/remote.c b/remote.c
index 7688f3b04..91f1b7cd8 100644
--- a/remote.c
+++ b/remote.c
@@ -298,6 +298,17 @@ static void read_branches_file(struct remote *remote)
}
add_url_alias(remote, p);
add_fetch_refspec(remote, strbuf_detach(&branch, 0));
+ /*
+ * Cogito compatible push: push current HEAD to remote #branch
+ * (master if missing)
+ */
+ strbuf_init(&branch, 0);
+ strbuf_addstr(&branch, "HEAD");
+ if (frag)
+ strbuf_addf(&branch, ":refs/heads/%s", frag);
+ else
+ strbuf_addstr(&branch, ":refs/heads/master");
+ add_push_refspec(remote, strbuf_detach(&branch, 0));
remote->fetch_tags = 1; /* always auto-follow */
}