branch: record creation of renamed branch in HEAD's log
[gitweb.git] / remote.c
index 8524135de4286a079519068be17f0fe6fe7632f9..bf1bf2309128bf886eac16959b8162b9990c98d7 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -1724,9 +1724,6 @@ static const char *branch_get_push_1(struct branch *branch, struct strbuf *err)
 {
        struct remote *remote;
 
-       if (!branch)
-               return error_buf(err, _("HEAD does not point to a branch"));
-
        remote = remote_get(pushremote_for_branch(branch, NULL));
        if (!remote)
                return error_buf(err,
@@ -1786,6 +1783,9 @@ static const char *branch_get_push_1(struct branch *branch, struct strbuf *err)
 
 const char *branch_get_push(struct branch *branch, struct strbuf *err)
 {
+       if (!branch)
+               return error_buf(err, _("HEAD does not point to a branch"));
+
        if (!branch->push_tracking_ref)
                branch->push_tracking_ref = branch_get_push_1(branch, err);
        return branch->push_tracking_ref;