Expand description
What state a merge is really in, for land --onto / --queue.
Two facts land must never guess at:
index.lock. git takes it to write the index and removes it when done. A git process that is killed leaves it behind, and every later index write (a merge, a commit) fails on it. A lock is stale only when no running process has the file open — checked, not assumed, on Linux through/proc/*/fdand elsewhere throughlsof; when neither can tell, the lock counts as held.- Whose merge is in progress.
MERGE_HEADalone does not say that a merge was applied: git 2.39 writesMERGE_HEADeven when it could not write the merge into the index (index.lockheld), leaving the index and the working tree at HEAD. Taken as “the person’s resolution”, that is a merge whose tree is ours — every change only theirs made, gone. So land records each merge it starts in<git-dir>/weave-land-merge(in-flightuntil it is committed;refusedonce land has handed it to the person to resolve). A merge in progress that land started and never finished is aborted and merged again, never judged as a resolution.
Structs§
- Record
- land’s record of the merge it started.
Enums§
- Lock
- Who, if anyone, holds
index.lock.
Functions§
- clear_
record - clear_
stale_ lock - Make sure no stale
index.lockstands in the way.Ok(None): there is none now (a stale one was removed, and that said inout).Ok(Some(why)): a lock is held, or its holder could not be told — the caller refuses. - index_
lock - The
index.lockof the git dirgd. - lock_
state - Look at
index.lockingd: three looks 150 ms apart, all of them with no holder and the same file, before it counts as stale. - merge_
not_ written - Whether git’s output from
git mergesays it could not write the merge (the index, the working tree): such a merge was not applied, whateverMERGE_HEADsays. - read_
record - write_
record