summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2014-10-01 12:28:41 +0200
committerJunio C Hamano <gitster@pobox.com>2014-10-01 13:54:31 -0700
commit216aab1e3d8eef088dc9785febce24a110e9f835 (patch)
tree36986d0850dabe51c519fbdb0c130e608fc6c573 /read-cache.c
parent4d423a3e62c7ab0b04c4bd84995c32daff3b24c3 (diff)
downloadgit-216aab1e3d8eef088dc9785febce24a110e9f835.tar.gz
hold_locked_index(): move from lockfile.c to read-cache.c
lockfile.c contains the general API for locking any file. Code specifically about the index file doesn't belong here. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index e887e23fb6..9f137e7f27 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1367,6 +1367,14 @@ static int read_index_extension(struct index_state *istate,
return 0;
}
+int hold_locked_index(struct lock_file *lk, int die_on_error)
+{
+ return hold_lock_file_for_update(lk, get_index_file(),
+ die_on_error
+ ? LOCK_DIE_ON_ERROR
+ : 0);
+}
+
int read_index(struct index_state *istate)
{
return read_index_from(istate, get_index_file());