From: Junio C Hamano Date: Wed, 30 May 2018 05:04:05 +0000 (+0900) Subject: Merge branch 'ma/lockfile-cleanup' X-Git-Tag: v2.18.0-rc0~29 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/2f76ebc93ca6bfc2aba1be330aabe391a7d093d2?hp=--cc Merge branch 'ma/lockfile-cleanup' Code clean-up to adjust to a more recent lockfile API convention that allows lockfile instances kept on the stack. * ma/lockfile-cleanup: lock_file: move static locks into functions lock_file: make function-local locks non-static refs.c: do not die if locking fails in `delete_pseudoref()` refs.c: do not die if locking fails in `write_pseudoref()` t/helper/test-write-cache: clean up lock-handling --- 2f76ebc93ca6bfc2aba1be330aabe391a7d093d2 diff --cc t/helper/test-scrap-cache-tree.c index d26d3e7c8b,34596201d4..393f1604ff --- a/t/helper/test-scrap-cache-tree.c +++ b/t/helper/test-scrap-cache-tree.c @@@ -4,10 -3,10 +4,10 @@@ #include "tree.h" #include "cache-tree.h" - static struct lock_file index_lock; - -int cmd_main(int ac, const char **av) +int cmd__scrap_cache_tree(int ac, const char **av) { + struct lock_file index_lock = LOCK_INIT; + setup_git_directory(); hold_locked_index(&index_lock, LOCK_DIE_ON_ERROR); if (read_cache() < 0) diff --cc t/helper/test-write-cache.c index 017dc30380,3d78c728a5..8837717d36 --- a/t/helper/test-write-cache.c +++ b/t/helper/test-write-cache.c @@@ -2,11 -1,10 +2,10 @@@ #include "cache.h" #include "lockfile.h" - static struct lock_file index_lock; - -int cmd_main(int argc, const char **argv) +int cmd__write_cache(int argc, const char **argv) { - int i, cnt = 1, lockfd; + struct lock_file index_lock = LOCK_INIT; + int i, cnt = 1; if (argc == 2) cnt = strtol(argv[1], NULL, 0); setup_git_directory();