summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2009-05-25 19:01:50 -0700
committerJunio C Hamano <gitster@pobox.com>2009-05-25 19:01:50 -0700
commit2c5942dbae01e5c23d2b68aced019702eb256ad9 (patch)
tree38b103a22d51dc22835a06d375bab806c513acdb /refs.c
parent43f8f560c03f6942cad1f12dd8ae5cfa045c8e84 (diff)
parentf6a5f1bb509a3af182fe568135398f1f2be15e5d (diff)
downloadgit-2c5942dbae01e5c23d2b68aced019702eb256ad9.tar.gz
Merge branch 'ar/unlink-err' into maint
* ar/unlink-err: print unlink(2) errno in copy_or_link_directory replace direct calls to unlink(2) with unlink_or_warn Introduce an unlink(2) wrapper which gives warning if unlink failed
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/refs.c b/refs.c
index 8679c17e0d..90163bdc56 100644
--- a/refs.c
+++ b/refs.c
@@ -1004,12 +1004,10 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
} else {
path = git_path("%s", refname);
}
- err = unlink(path);
- if (err && errno != ENOENT) {
+ err = unlink_or_warn(path);
+ if (err && errno != ENOENT)
ret = 1;
- error("unlink(%s) failed: %s",
- path, strerror(errno));
- }
+
if (!(delopt & REF_NODEREF))
lock->lk->filename[i] = '.';
}
@@ -1019,10 +1017,7 @@ int delete_ref(const char *refname, const unsigned char *sha1, int delopt)
*/
ret |= repack_without_ref(refname);
- err = unlink(git_path("logs/%s", lock->ref_name));
- if (err && errno != ENOENT)
- warning("unlink(%s) failed: %s",
- git_path("logs/%s", lock->ref_name), strerror(errno));
+ unlink_or_warn(git_path("logs/%s", lock->ref_name));
invalidate_cached_refs();
unlock_ref(lock);
return ret;
@@ -1383,7 +1378,7 @@ int create_symref(const char *ref_target, const char *refs_heads_master,
if (adjust_shared_perm(git_HEAD)) {
error("Unable to fix permissions on %s", lockpath);
error_unlink_return:
- unlink(lockpath);
+ unlink_or_warn(lockpath);
error_free_return:
free(git_HEAD);
return -1;