Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2019-01-12 05:13:24 +0300
committerJunio C Hamano <gitster@pobox.com>2019-01-14 23:13:04 +0300
commit3a95f31d1cdc93fa4f926c6537f84186edd85ca9 (patch)
tree102d6623808b54f676dcbde75b1ed28705358f60 /sequencer.c
parent1d18d7581cf1ce45314b7ed58e52d5cc73b2e7a7 (diff)
repository.c: replace hold_locked_index() with repo_hold_locked_index()
hold_locked_index() assumes the index path at $GIT_DIR/index. This is not good for places that take an arbitrary index_state instead of the_index, which is basically everywhere except builtin/. Replace it with repo_hold_locked_index(). hold_locked_index() remains as a wrapper around repo_hold_locked_index() to reduce changes in builtin/ Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sequencer.c b/sequencer.c
index 1a92a5d678..668c232b05 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -540,7 +540,7 @@ static int do_recursive_merge(struct repository *r,
char **xopt;
struct lock_file index_lock = LOCK_INIT;
- if (hold_locked_index(&index_lock, LOCK_REPORT_ON_ERROR) < 0)
+ if (repo_hold_locked_index(r, &index_lock, LOCK_REPORT_ON_ERROR) < 0)
return -1;
read_index(r->index);
@@ -1992,8 +1992,8 @@ static int read_and_refresh_cache(struct repository *r,
struct replay_opts *opts)
{
struct lock_file index_lock = LOCK_INIT;
- int index_fd = hold_locked_index(&index_lock, 0);
- if (read_index(r->index) < 0) {
+ int index_fd = repo_hold_locked_index(r, &index_lock, 0);
+ if (repo_read_index(r) < 0) {
rollback_lock_file(&index_lock);
return error(_("git %s: failed to read the index"),
_(action_name(opts)));
@@ -2978,7 +2978,7 @@ static int do_reset(struct repository *r,
struct unpack_trees_options unpack_tree_opts;
int ret = 0;
- if (hold_locked_index(&lock, LOCK_REPORT_ON_ERROR) < 0)
+ if (repo_hold_locked_index(r, &lock, LOCK_REPORT_ON_ERROR) < 0)
return -1;
if (len == 10 && !strncmp("[new root]", name, len)) {
@@ -3096,7 +3096,7 @@ static int do_merge(struct repository *r,
static struct lock_file lock;
const char *p;
- if (hold_locked_index(&lock, LOCK_REPORT_ON_ERROR) < 0) {
+ if (repo_hold_locked_index(r, &lock, LOCK_REPORT_ON_ERROR) < 0) {
ret = -1;
goto leave_merge;
}