X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-checkout-index.c;h=8460f97b6637127d78b58caf2e29d25f3ad0b5a0;hb=892c41b98ae2e6baf3aa13901cb10db9ac67d2f3;hp=afe4b0e4520f47f1dace1383bfc2b364b1b1def0;hpb=77b50ab009deab7f8eb703843a71ac7253b977c8;p=git.git diff --git a/builtin-checkout-index.c b/builtin-checkout-index.c index afe4b0e45..8460f97b6 100644 --- a/builtin-checkout-index.c +++ b/builtin-checkout-index.c @@ -202,10 +202,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) if (!strcmp(arg, "-u") || !strcmp(arg, "--index")) { state.refresh_cache = 1; if (newfd < 0) - newfd = hold_lock_file_for_update - (&lock_file, get_index_file(), 1); - if (newfd < 0) - die("cannot open index.lock file."); + newfd = hold_locked_index(&lock_file, 1); continue; } if (!strcmp(arg, "-z")) { @@ -302,7 +299,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix) if (0 <= newfd && (write_cache(newfd, active_cache, active_nr) || - close(newfd) || commit_lock_file(&lock_file))) + close(newfd) || commit_locked_index(&lock_file))) die("Unable to write new index file"); return 0; }