summaryrefslogtreecommitdiff
path: root/builtin/gc.c
diff options
context:
space:
mode:
authorElia Pinto <gitter.spiros@gmail.com>2014-01-29 16:59:37 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-01-31 18:44:05 (GMT)
commit4f1c0b21e9045ff12e1880b5724a032031716a24 (patch)
tree7b7bc26d8ddd660dc7d762dc2fe335882e77a8c2 /builtin/gc.c
parentbf7e645c90e08f0d3391502c888453033e446372 (diff)
downloadgit-4f1c0b21e9045ff12e1880b5724a032031716a24.zip
git-4f1c0b21e9045ff12e1880b5724a032031716a24.tar.gz
git-4f1c0b21e9045ff12e1880b5724a032031716a24.tar.bz2
builtin/gc.c: reduce scope of variables
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/gc.c')
-rw-r--r--builtin/gc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/gc.c b/builtin/gc.c
index 25f2237..5369012 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -187,13 +187,12 @@ static int need_to_gc(void)
static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
{
static struct lock_file lock;
- static char locking_host[128];
char my_host[128];
struct strbuf sb = STRBUF_INIT;
struct stat st;
uintmax_t pid;
FILE *fp;
- int fd, should_exit;
+ int fd;
if (pidfile)
/* already locked */
@@ -205,6 +204,8 @@ static const char *lock_repo_for_gc(int force, pid_t* ret_pid)
fd = hold_lock_file_for_update(&lock, git_path("gc.pid"),
LOCK_DIE_ON_ERROR);
if (!force) {
+ static char locking_host[128];
+ int should_exit;
fp = fopen(git_path("gc.pid"), "r");
memset(locking_host, 0, sizeof(locking_host));
should_exit =