Michael Haggerty <mhagger@xxxxxxxxxxxx> writes: > Change `commit_packed_refs()` to use `get_locked_file_path()` to find > the path of the file that it should overwrite. Since that path was > properly resolved when the lockfile was created, this restores the > pre-42dfa7ecef behavior. Because when we take a lock hold_lock_file() eventually calls into lock_file() which by default takes the lock on the target of the symbolic link (which is the sensible default, which is triggered in this codepath), so this change to use the name of that file is all that is needed. Makes sense. Makes me wonder why we need a separate .new file (instead of writing into the .lock instead), but that is a different issue. Thanks. I'll do the SYMLINKS thing while queuing. > diff --git a/t/t3210-pack-refs.sh b/t/t3210-pack-refs.sh > index 2bb4b25ed9..0d8a03e2a9 100755 > --- a/t/t3210-pack-refs.sh > +++ b/t/t3210-pack-refs.sh > @@ -238,4 +238,19 @@ test_expect_success 'retry acquiring packed-refs.lock' ' > git -c core.packedrefstimeout=3000 pack-refs --all --prune > ' > > +test_expect_success 'pack symlinked packed-refs' ' > + # First make sure that symlinking works when reading: > + git update-ref refs/heads/loosy refs/heads/master && > + git for-each-ref >all-refs-before && > + mv .git/packed-refs .git/my-deviant-packed-refs && > + ln -s my-deviant-packed-refs .git/packed-refs && > + git for-each-ref >all-refs-linked && > + test_cmp all-refs-before all-refs-linked && > + git pack-refs --all --prune && > + git for-each-ref >all-refs-packed && > + test_cmp all-refs-before all-refs-packed && > + test -h .git/packed-refs && > + test "$(readlink .git/packed-refs)" = "my-deviant-packed-refs" > +' > + > test_done