Signed-off-by: David Turner <[email protected]>
---
index-helper.c | 7 +++++++
t/t7900-index-helper.sh | 9 +++++++++
2 files changed, 16 insertions(+)
diff --git a/index-helper.c b/index-helper.c
index 3e0990e..dcb2041 100644
--- a/index-helper.c
+++ b/index-helper.c
@@ -480,6 +480,13 @@ int main(int argc, char **argv)
return 0;
}
+ /* check that no other copy is running */
+ fd = connect_to_index_helper();
+ if (fd > 0)
+ die(_("Already running"));
+ if (errno != ECONNREFUSED && errno != ENOENT)
+ die_errno(_("Unexpected error checking socket"));
+
atexit(cleanup);
sigchain_push_common(cleanup_on_signal);
diff --git a/t/t7900-index-helper.sh b/t/t7900-index-helper.sh
index fdb0d7b..32ef6f7 100755
--- a/t/t7900-index-helper.sh
+++ b/t/t7900-index-helper.sh
@@ -32,4 +32,13 @@ test_expect_success 'index-helper creates usable path file
and can be killed' '
test_path_is_missing .git/index-helper.path
'
+test_expect_success 'index-helper will not start if already running' '
+ test_when_finished "git index-helper --kill" &&
+ git index-helper --detach &&
+ test -L .git/index-helper.path &&
+ test_must_fail git index-helper 2>err &&
+ test -L .git/index-helper.path &&
+ grep "Already running" err
+'
+
test_done
--
2.4.2.767.g62658d5-twtrsrc
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html