git-sh-setup: Fix scripts whose PWD is a symlink into a git work-dir
[gitweb.git] / builtin-pack-objects.c
index 67eefa2932717bfd4a5daa8ad3a4379af1ef78db..cedef52fd3d62a3dd2e439a46579362b22c69642 100644 (file)
@@ -535,6 +535,7 @@ static void write_pack_file(void)
 
                        snprintf(tmpname, sizeof(tmpname), "%s-%s.pack",
                                 base_name, sha1_to_hex(sha1));
+                       free_pack_by_name(tmpname);
                        if (adjust_perm(pack_tmp_name, mode))
                                die("unable to make temporary pack file readable: %s",
                                    strerror(errno));