summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c16570c)
raw | patch | inline | side by side (parent: c16570c)
author | Paolo Bonzini <bonzini@gnu.org> | |
Thu, 29 May 2008 14:55:53 +0000 (16:55 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 31 May 2008 21:33:59 +0000 (14:33 -0700) |
Other signals are also common, for example SIGTERM and SIGHUP.
This patch modifies the lock file mechanism to catch more signals.
It also modifies http-push.c which was missing SIGTERM.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This patch modifies the lock file mechanism to catch more signals.
It also modifies http-push.c which was missing SIGTERM.
Signed-off-by: Paolo Bonzini <bonzini@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
http-push.c | patch | blob | history | |
lockfile.c | patch | blob | history | |
t/t7502-commit.sh | patch | blob | history |
diff --git a/http-push.c b/http-push.c
index f173dcd64f73bddc891808c96c43407533aac1f5..c93e781c3b503bae6ee7c6735fa058aa0a98e026 100644 (file)
--- a/http-push.c
+++ b/http-push.c
signal(SIGINT, remove_locks_on_signal);
signal(SIGHUP, remove_locks_on_signal);
signal(SIGQUIT, remove_locks_on_signal);
+ signal(SIGTERM, remove_locks_on_signal);
/* Check whether the remote has server info files */
remote->can_update_info_refs = 0;
diff --git a/lockfile.c b/lockfile.c
index cfc7335347c4875537d1c45c909921908f3d4f10..4023797b00fe21ecbabe3407ef8a12fca0690607 100644 (file)
--- a/lockfile.c
+++ b/lockfile.c
if (0 <= lk->fd) {
if (!lock_file_list) {
signal(SIGINT, remove_lock_file_on_signal);
+ signal(SIGHUP, remove_lock_file_on_signal);
+ signal(SIGTERM, remove_lock_file_on_signal);
+ signal(SIGQUIT, remove_lock_file_on_signal);
atexit(remove_lock_file);
}
lk->owner = getpid();
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index 3531a992a9a50e25a1585435e024097c7028af27..46ec1ce8aaa0305f6b4569664de041137db137d7 100755 (executable)
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
test "`cat .git/result`" = "editor not started"
'
+pwd=`pwd`
+cat > .git/FAKE_EDITOR << EOF
+#! /bin/sh
+# kill -TERM command added below.
+EOF
+
+test_expect_success 'a SIGTERM should break locks' '
+ echo >>negative &&
+ sh -c '\''
+ echo kill -TERM $$ >> .git/FAKE_EDITOR
+ GIT_EDITOR=.git/FAKE_EDITOR exec git commit -a'\'' && exit 1 # should fail
+ ! test -f .git/index.lock
+'
+
test_done