X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=builtin-checkout-index.c;h=75377b9cab75ac75c6d5d7f79fdcf64bdb27cff2;hb=ac053c02029d88c7ed4d7e92949a1586eb3f7704;hp=afe4b0e4520f47f1dace1383bfc2b364b1b1def0;hpb=bb95e19c5f1e470d2efe1c0e4e04c291019e4b25;p=git.git diff --git a/builtin-checkout-index.c b/builtin-checkout-index.c index afe4b0e45..75377b9ca 100644 --- a/builtin-checkout-index.c +++ b/builtin-checkout-index.c @@ -36,6 +36,7 @@ * of "-a" causing problems (not possible in the above example, * but get used to it in scripting!). */ +#include "builtin.h" #include "cache.h" #include "strbuf.h" #include "quote.h" @@ -202,10 +203,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 +300,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; }