builtin-branch: use strbuf in delete_branches()
[gitweb.git] / builtin-branch.c
index 8d634ff571ce34ce21a5519628d6f66a7e52aa93..b9149b78f406e950295e1df31d686e1d74bfebd6 100644 (file)
@@ -97,7 +97,6 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
        unsigned char sha1[20];
        char *name = NULL;
        const char *fmt, *remote;
-       char section[PATH_MAX];
        int i;
        int ret = 0;
 
@@ -160,16 +159,17 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
                        continue;
                }
 
-               if (delete_ref(name, sha1)) {
+               if (delete_ref(name, sha1, 0)) {
                        error("Error deleting %sbranch '%s'", remote,
                               argv[i]);
                        ret = 1;
                } else {
+                       struct strbuf buf = STRBUF_INIT;
                        printf("Deleted %sbranch %s.\n", remote, argv[i]);
-                       snprintf(section, sizeof(section), "branch.%s",
-                                argv[i]);
-                       if (git_config_rename_section(section, NULL) < 0)
+                       strbuf_addf(&buf, "branch.%s", argv[i]);
+                       if (git_config_rename_section(buf.buf, NULL) < 0)
                                warning("Update of config-file failed");
+                       strbuf_release(&buf);
                }
        }