Make lock local to fetch_pack
authorMatt Kraai <matt.kraai@amo.abbott.com>
Tue, 18 Dec 2012 22:03:54 +0000 (14:03 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Dec 2012 03:00:00 +0000 (19:00 -0800)
lock is only used by fetch_pack, so move it into that function.

Signed-off-by: Matt Kraai <matt.kraai@amo.abbott.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/fetch-pack.c

index e6443986b81050b01ebd7c57a7afd7abb5c65a45..9bc10b316950f26515030125cbb10cf4d1b9d6a7 100644 (file)
@@ -875,8 +875,6 @@ static int fetch_pack_config(const char *var, const char *value, void *cb)
        return git_default_config(var, value, cb);
 }
 
-static struct lock_file lock;
-
 static void fetch_pack_setup(void)
 {
        static int did_setup;
@@ -1069,6 +1067,7 @@ struct ref *fetch_pack(struct fetch_pack_args *my_args,
        ref_cpy = do_fetch_pack(fd, ref, sought, pack_lockfile);
 
        if (args.depth > 0) {
+               static struct lock_file lock;
                struct cache_time mtime;
                struct strbuf sb = STRBUF_INIT;
                char *shallow = git_path("shallow");