git branch -D: give a better error message when lockfile creation fails

Previously the old error message just told the user that it was not
possible to delete the ref from the packed-refs file. Give instructions
on how to resolve the problem.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
This commit is contained in:
Miklos Vajna
2009-09-27 01:15:09 +02:00
committed by Shawn O. Pearce
parent 6bbfd1fa98
commit 1b018fd9be
3 changed files with 24 additions and 7 deletions

4
refs.c
View File

@ -972,8 +972,10 @@ static int repack_without_ref(const char *refname)
if (!found)
return 0;
fd = hold_lock_file_for_update(&packlock, git_path("packed-refs"), 0);
if (fd < 0)
if (fd < 0) {
unable_to_lock_error(git_path("packed-refs"), errno);
return error("cannot delete '%s' from packed refs", refname);
}
for (list = packed_ref_list; list; list = list->next) {
char line[PATH_MAX + 100];