diff options
author | Jonathan Nieder <jrnieder@gmail.com> | 2013-10-16 16:11:46 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-10-18 12:45:24 -0700 |
commit | 4c5baf0273ae3382dbaca81fee0331cada5899ea (patch) | |
tree | 29831095ae20dd0e97494cdd28ab35dec3dbec3a /t/t6500-gc.sh | |
parent | 64a99eb4760de2ce2f0c04e146c0a55c34f50f20 (diff) | |
download | git-4c5baf0273ae3382dbaca81fee0331cada5899ea.tar.gz |
gc: remove gc.pid file at end of executionnd/gc-lock-against-each-other
This file isn't really harmful, but isn't useful either, and can create
minor annoyance for the user:
* It's confusing, as the presence of a *.pid file often implies that a
process is currently running. A user running "ls .git/" and finding
this file may incorrectly guess that a "git gc" is currently running.
* Leaving this file means that a "git gc" in an already gc-ed repo is
no-longer a no-op. A user running "git gc" in a set of repositories,
and then synchronizing this set (e.g. rsync -av, unison, ...) will see
all the gc.pid files as changed, which creates useless noise.
This patch unlinks the file after the garbage collection is done, so that
gc.pid is actually present only during execution.
Future versions of Git may want to use the information left in the gc.pid
file (e.g. for policies like "don't attempt to run a gc if one has
already been ran less than X hours ago"). If so, this patch can safely be
reverted. For now, let's not bother the users.
Explained-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Improved-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6500-gc.sh')
-rwxr-xr-x | t/t6500-gc.sh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh index b1a63655f9..63194d819e 100755 --- a/t/t6500-gc.sh +++ b/t/t6500-gc.sh @@ -9,6 +9,11 @@ test_expect_success 'gc empty repository' ' git gc ' +test_expect_success 'gc does not leave behind pid file' ' + git gc && + test_path_is_missing .git/gc.pid +' + test_expect_success 'gc --gobbledegook' ' test_expect_code 129 git gc --nonsense 2>err && test_i18ngrep "[Uu]sage: git gc" err |