X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=refs.c;h=86ef91661400376f6bdc2af37fac7982f8872df9;hb=3899e7a329aabfc22eca9beb82599e1bb214b3d2;hp=b01835f634603f2f89c188bd56aae6fb45983ba3;hpb=ca9e3b124f6313187da641b5cd55100c4ade6a9a;p=git.git diff --git a/refs.c b/refs.c index b01835f63..86ef91661 100644 --- a/refs.c +++ b/refs.c @@ -147,7 +147,7 @@ static int do_for_each_ref(const char *base, int (*fn)(const char *path, const u namelen = strlen(de->d_name); if (namelen > 255) continue; - if (has_extension(de->d_name, namelen, ".lock")) + if (has_extension(de->d_name, ".lock")) continue; memcpy(path + baselen, de->d_name, namelen+1); if (stat(git_path("%s", path), &st) < 0) @@ -319,13 +319,7 @@ static struct ref_lock *lock_ref_sha1_basic(const char *path, if (safe_create_leading_directories(lock->ref_file)) die("unable to create directory for %s", lock->ref_file); - lock->lock_fd = hold_lock_file_for_update(lock->lk, lock->ref_file); - if (lock->lock_fd < 0) { - error("Couldn't open lock file %s: %s", - lock->lk->filename, strerror(errno)); - unlock_ref(lock); - return NULL; - } + lock->lock_fd = hold_lock_file_for_update(lock->lk, lock->ref_file, 1); return old_sha1 ? verify_lock(lock, old_sha1, mustexist) : lock; }