Merge branch 'ma/lockfile-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Wed, 30 May 2018 05:04:05 +0000 (14:04 +0900)
committerJunio C Hamano <gitster@pobox.com>
Wed, 30 May 2018 05:04:05 +0000 (14:04 +0900)
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

16 files changed:
1  2 
apply.c
builtin/add.c
builtin/describe.c
builtin/difftool.c
builtin/gc.c
builtin/merge.c
builtin/mv.c
builtin/receive-pack.c
builtin/rm.c
bundle.c
fast-import.c
refs.c
refs/files-backend.c
rerere.c
t/helper/test-scrap-cache-tree.c
t/helper/test-write-cache.c
diff --cc apply.c
Simple merge
diff --cc builtin/add.c
Simple merge
Simple merge
Simple merge
diff --cc builtin/gc.c
Simple merge
diff --cc builtin/merge.c
Simple merge
diff --cc builtin/mv.c
Simple merge
Simple merge
diff --cc builtin/rm.c
Simple merge
diff --cc bundle.c
Simple merge
diff --cc fast-import.c
Simple merge
diff --cc refs.c
Simple merge
Simple merge
diff --cc rerere.c
Simple merge
index d26d3e7c8b1a407e2cf40ce20750495f500d5170,34596201d4af7b956494bfe3fda2a95d67471fba..393f1604ff954703a2a5e075fbda1e14d0827dc0
@@@ -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)
index 017dc303800d9ba385a9836d85f81445c6b7e8b7,3d78c728a5dabe27931f6664f5b6675021f059b9..8837717d36a77c04346279b570e1a0a4506fe838
@@@ -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();