index b097c888a0da044d6dc78c9747eb18e45b46709d..8460f97b6637127d78b58caf2e29d25f3ad0b5a0 100644 (file)
--- a/builtin-checkout-index.c
+++ b/builtin-checkout-index.c
if (!strcmp(arg, "-u") || !strcmp(arg, "--index")) {
state.refresh_cache = 1;
if (newfd < 0)
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")) {
continue;
}
if (!strcmp(arg, "-z")) {
to_tempfile = 1;
continue;
}
to_tempfile = 1;
continue;
}
- if (!strncmp(arg, "--prefix=", 9)) {
+ if (!prefixcmp(arg, "--prefix=")) {
state.base_dir = arg+9;
state.base_dir_len = strlen(state.base_dir);
continue;
}
state.base_dir = arg+9;
state.base_dir_len = strlen(state.base_dir);
continue;
}
- if (!strncmp(arg, "--stage=", 8)) {
+ if (!prefixcmp(arg, "--stage=")) {
if (!strcmp(arg + 8, "all")) {
to_tempfile = 1;
checkout_stage = CHECKOUT_ALL;
if (!strcmp(arg + 8, "all")) {
to_tempfile = 1;
checkout_stage = CHECKOUT_ALL;
if (0 <= newfd &&
(write_cache(newfd, active_cache, active_nr) ||
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;
}
die("Unable to write new index file");
return 0;
}