git-cvsserver: fix breakage when calling git merge-file
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index a02957c399ded94bb9a49c9dc3d8ab5d9411bbec..d911b9e86009aa3d81c6c4d310a26bf057920e8a 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -867,6 +867,16 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)
                goto rollback;
        }
 
+       if (!strncmp(oldref, "refs/heads/", 11) &&
+                       !strncmp(newref, "refs/heads/", 11)) {
+               char oldsection[1024], newsection[1024];
+
+               snprintf(oldsection, 1024, "branch.%s", oldref + 11);
+               snprintf(newsection, 1024, "branch.%s", newref + 11);
+               if (git_config_rename_section(oldsection, newsection) < 0)
+                       return 1;
+       }
+
        return 0;
 
  rollback: