summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Turner <dturner@twopensource.com>2016-07-04 02:05:23 -0400
committerJunio C Hamano <gitster@pobox.com>2016-07-06 11:22:40 -0700
commitfcb57acdb1404f8891fd71fa18b74a34fdd6dac9 (patch)
tree67293df4b277f6188120d930778493c3089dfcfe
parent06e6c17a46d8866c84c62e14bb48456c6b212cff (diff)
downloadgit-dt/index-helper.tar.gz
index-helper: indexhelper.exitAfter configdt/index-helper
Add a configuration variable, indexhelper.exitAfter, which provides a default time to keep the index-helper alive. This is useful with indexhelper.autorun; some users will want to keep the automatically-run index-helper alive across their lunch break and will thus set indexhelper.exitAfter to a high value. Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--Documentation/config.txt4
-rw-r--r--index-helper.c2
-rwxr-xr-xt/t7900-index-helper.sh8
3 files changed, 14 insertions, 0 deletions
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 385ea664fc..a6330b1773 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -1860,6 +1860,10 @@ indexhelper.autorun::
Automatically run git index-helper when any builtin git
command is run inside a repository.
+indexhelper.exitAfter::
+ When no exit-after argument is given, git index-helper defaults
+ to this number of seconds. Specify 0 to wait forever. Default is 600.
+
init.templateDir::
Specify the directory from which templates will be copied.
(See the "TEMPLATE DIRECTORY" section of linkgit:git-init[1].)
diff --git a/index-helper.c b/index-helper.c
index af354856b8..7e6242516a 100644
--- a/index-helper.c
+++ b/index-helper.c
@@ -399,6 +399,8 @@ int main(int argc, char **argv)
git_extract_argv0_path(argv[0]);
git_setup_gettext();
+ git_config_get_int("indexhelper.exitafter", &idle_in_seconds);
+
if (argc == 2 && !strcmp(argv[1], "-h"))
usage_with_options(usage_text, options);
diff --git a/t/t7900-index-helper.sh b/t/t7900-index-helper.sh
index 15ba612d2e..12b5bf73b0 100755
--- a/t/t7900-index-helper.sh
+++ b/t/t7900-index-helper.sh
@@ -68,4 +68,12 @@ test_expect_success 'index-helper autorun works' '
test_path_is_missing .git/index-helper.sock
'
+test_expect_success 'indexhelper.exitafter config works' '
+ test_when_finished "git index-helper --kill" &&
+ test_config indexhelper.exitafter 1 &&
+ git index-helper --detach &&
+ sleep 3 &&
+ test_path_is_missing .git/index-helper.sock
+'
+
test_done