1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-25 00:46:32 +02:00

update-cache: remove index lock file on SIGINT

This makes it a lot more pleasant to use when you
interrupt a long-running operation.
This commit is contained in:
Linus Torvalds 2005-04-26 11:55:42 -07:00
parent 5697ecc7be
commit f2a19340ad

View File

@ -3,6 +3,7 @@
*
* Copyright (C) Linus Torvalds, 2005
*/
#include <signal.h>
#include "cache.h"
/*
@ -299,6 +300,11 @@ static void remove_lock_file(void)
unlink(lockfile_name);
}
static void remove_lock_file_on_signal(int signo)
{
remove_lock_file();
}
int main(int argc, char **argv)
{
int i, newfd, entries;
@ -312,6 +318,7 @@ int main(int argc, char **argv)
if (newfd < 0)
die("unable to create new cachefile");
signal(SIGINT, remove_lock_file_on_signal);
atexit(remove_lock_file);
lockfile_name = lockfile;