summaryrefslogtreecommitdiff
path: root/checkout-index.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-06-06 14:31:29 -0700
committerLibravatar Junio C Hamano <junkio@cox.net>2006-06-06 14:31:29 -0700
commit68a40e5096add9a4d8f2dc0fecce19e9438eaba1 (patch)
treeee8b10943b4f5275903f0b18a6b01090fe5bd60c /checkout-index.c
parentMerge branch 'vb/sendemail' into next (diff)
parentref-log: style fixes. (diff)
downloadtgif-68a40e5096add9a4d8f2dc0fecce19e9438eaba1.tar.xz
Merge branch 'jc/lockfile' into next
* jc/lockfile: ref-log: style fixes. refs.c: convert it to use lockfile interface. Make index file locking code reusable to others. HTTP cleanup HTTP cleanup git-format-patch: add --output-directory long option again
Diffstat (limited to 'checkout-index.c')
-rw-r--r--checkout-index.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/checkout-index.c b/checkout-index.c
index 9876af6fd6..ea40bc29be 100644
--- a/checkout-index.c
+++ b/checkout-index.c
@@ -168,7 +168,7 @@ static int checkout_all(void)
static const char checkout_cache_usage[] =
"git-checkout-index [-u] [-q] [-a] [-f] [-n] [--stage=[123]|all] [--prefix=<string>] [--temp] [--] <file>...";
-static struct cache_file cache_file;
+static struct lock_file lock_file;
int main(int argc, char **argv)
{
@@ -211,9 +211,8 @@ int main(int argc, char **argv)
if (!strcmp(arg, "-u") || !strcmp(arg, "--index")) {
state.refresh_cache = 1;
if (newfd < 0)
- newfd = hold_index_file_for_update
- (&cache_file,
- get_index_file());
+ newfd = hold_lock_file_for_update
+ (&lock_file, get_index_file());
if (newfd < 0)
die("cannot open index.lock file.");
continue;
@@ -262,7 +261,7 @@ int main(int argc, char **argv)
*/
if (state.refresh_cache) {
close(newfd); newfd = -1;
- rollback_index_file(&cache_file);
+ rollback_lock_file(&lock_file);
}
state.refresh_cache = 0;
}
@@ -312,7 +311,7 @@ int main(int argc, char **argv)
if (0 <= newfd &&
(write_cache(newfd, active_cache, active_nr) ||
- commit_index_file(&cache_file)))
- die("Unable to write new cachefile");
+ commit_lock_file(&lock_file)))
+ die("Unable to write new index file");
return 0;
}