strbuf: instate cleanup rule in case of non-memory errors
[gitweb.git] / remote.c
index cbb3e484fe7803f68eae8507c8216ed951d0b54b..570e11286ea295e825a23b1d5ed40c9fbd02be57 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -299,6 +299,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 */
 }