{"thread":{"id":"35020","subject":"\"git gc\" leaving gc.pid files around","startedAt":"2013-09-25T18:29:50Z","lastAt":"2013-09-25T19:06:59Z","messageCount":2,"participants":["Matthieu Moy","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"228221","messageId":"vpqzjr0rbz5.fsf@anie.imag.fr","threadId":"35020","inReplyTo":null,"subject":"\"git gc\" leaving gc.pid files around","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2013-09-25T18:29:50Z","receivedAt":"2013-09-25T18:29:50Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Hi,\n\nSince 64a99eb47, \"git gc\" creates a lock file gc.pid while running. I\njust noticed that the file is never deleted. The locking mechanism\nworks, but leaving these files around creates a minor annoyance.\n\nFor example, I run \"git gc\" in all my repos from time to time (in a cron\njob). It normally does nothing in repos that have not changed, but now,\nit updates the gc.pid file.\n\nAs a result, all the gc.pid files show up in unison (synchronization\ntool between machines) for example.\n\nIs there any reason not to do something like this:\n\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -316,5 +316,6 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n                warning(_(\"There are too many unreachable loose objects; \"\n                        \"run 'git prune' to remove them.\"));\n \n+       unlink(git_path(\"gc.pid\"));\n        return 0;\n }\n\n?\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"228223","messageId":"CACsJy8D2Amtzv0j1_3tKWyhRBUoKDL+1TiJGuvqFXb6UNDUdvg@mail.gmail.com","threadId":"35020","inReplyTo":"vpqzjr0rbz5.fsf@anie.imag.fr","subject":"Re: \"git gc\" leaving gc.pid files around","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-09-25T19:06:59Z","receivedAt":"2013-09-25T19:06:59Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Sep 26, 2013 at 1:29 AM, Matthieu Moy\n<Matthieu.Moy@grenoble-inp.fr> wrote:\n> Hi,\n>\n> Since 64a99eb47, \"git gc\" creates a lock file gc.pid while running. I\n> just noticed that the file is never deleted. The locking mechanism\n> works, but leaving these files around creates a minor annoyance.\n>\n> For example, I run \"git gc\" in all my repos from time to time (in a cron\n> job). It normally does nothing in repos that have not changed, but now,\n> it updates the gc.pid file.\n>\n> As a result, all the gc.pid files show up in unison (synchronization\n> tool between machines) for example.\n>\n> Is there any reason not to do something like this:\n>\n> --- a/builtin/gc.c\n> +++ b/builtin/gc.c\n> @@ -316,5 +316,6 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n>                 warning(_(\"There are too many unreachable loose objects; \"\n>                         \"run 'git prune' to remove them.\"));\n>\n> +       unlink(git_path(\"gc.pid\"));\n>         return 0;\n>  }\n>\n> ?\n\nI considered this and decided it was not a big problem for another\nfile lying around in .git. Moreover it could provide the last gc time\nto gc itself, so we could avoid running gc too often, for example no\nmore than one gc a day. But if it causes actual annoyance, I think\nunlink() is ok.\n-- \nDuy\n"}]}