refs.c: add an err argument to repack_without_refs
[gitweb.git] / builtin / checkout.c
index ff4492162d9543598c1cdc8951f8604a4712516d..f1dc56e55f7b2200412142b10517458ccfda2952 100644 (file)
@@ -651,12 +651,8 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
                        }
                }
                if (old->path && old->name) {
-                       char log_file[PATH_MAX], ref_file[PATH_MAX];
-
-                       git_snpath(log_file, sizeof(log_file), "logs/%s", old->path);
-                       git_snpath(ref_file, sizeof(ref_file), "%s", old->path);
-                       if (!file_exists(ref_file) && file_exists(log_file))
-                               remove_path(log_file);
+                       if (!ref_exists(old->path) && reflog_exists(old->path))
+                               delete_reflog(old->path);
                }
        }
        remove_branch_state();