@matheusbsbs / matheus-bagliano / commits / 6a1f79c1f1
Fork 0

Allow diff and index commands to be interrupted

So far, e.g. git-update-index --refresh was basically uninterruptable by ctrl-c, since it hooked the SIGINT handler, but that handler would only unlink the lockfile but not actually quit. This makes it propagate the signal to the default handler. Note that I expected it to work without resetting the signal handler to SIG_DFL, but without that it ended in an infinite loop of tgkill()s - is my glibc violating SUS or what? Signed-off-by: Petr Baudis <pasky@suse.cz> Signed-off-by: Junio C Hamano <junkio@cox.net>

Petr Baudis committed Feb 1, 2006 at 00:40 UTC 6a1f79c1f1a54f97f122a86c71837fb1f1408b67
2 files changed +4
diff.c
+2
@@ -555,6 +555,8 @@ static void remove_tempfile(void)
555 static void remove_tempfile_on_signal(int signo)
556 {
557 remove_tempfile();
558 + signal(SIGINT, SIG_DFL);
559 + raise(signo);
560 }
561
562 /* An external diff command takes:
index.c
+2
@@ -18,6 +18,8 @@ static void remove_lock_file(void)
18 static void remove_lock_file_on_signal(int signo)
19 {
20 remove_lock_file();
21 + signal(SIGINT, SIG_DFL);
22 + raise(signo);
23 }
24
25 int hold_index_file_for_update(struct cache_file *cf, const char *path)