Log file system operations to perform reference updates
Log file system operations to perform reference updates
We've been moving towards a physical logging protocol that records the file system operations to perform. This commit migrates reference updates to the new logging protocol.
The reference verification logic remains largely the same. As we are
verifying the references with Git by running the recorded reference
transactions against the current state of the repository, we record
the changes being performed by Git in the refs
directory and include
them in the log entry. This records all of the changes that need to be
performed against the loose references. After the reference transactions
are applied, we check whether there were changes to the packed-refs file.
If so, we stage the changes to it as well.
While we check the logical reference updates for conflicts using Git,
we must manually check whether the packed-refs
file has been modified
by other transactions concurrently. This is done by recording the inode
of the original packed-refs
file that existed before the transaction's
changes were applied, and comparing it to the current packed-refs
file
in the target repository. If they are not the same, the updated packed-refs
file is also staged.
The conflict checking is somewhat spread around and ad-hoc. This is a leftover from the previous logical operations that we're checking for conflicts on a case-by-case basis. Now that we have most operations recording the file changes that are done, we can follow up with a change later to unify the conflict checking to be based on the file changes. This will clean up currently lacking and messy conflict checking with a general approach.
As the conflict checking still needs the references in the log entry, they are left there for now.
Closes #5847 (closed)
Part of #5793 (closed)