pub enum Change<T = (), U = ()> {
Removed,
Type,
Modification {
executable_bit_changed: bool,
content_change: Option<T>,
set_entry_stat_size_zero: bool,
},
SubmoduleModification(U),
}
Expand description
How an index entry needs to be changed to obtain the destination worktree state, i.e. entry.apply(this_change) == worktree-entry
.
Variants§
Removed
This corresponding file does not exist in the worktree anymore.
Type
The type of file changed compared to the worktree, i.e. a symlink s now a file.
Modification
This worktree file was modified in some form, like a permission change or content change or both, as compared to this entry.
Fields
executable_bit_changed: bool
Indicates that one of the stat changes was an executable bit change which is a significant change itself.
content_change: Option<T>
The output of the CompareBlobs
run on this entry.
If there is no content change and only the executable bit
changed then this is None
.
set_entry_stat_size_zero: bool
If true, the caller is expected to set entry.stat.size = 0 to assure this otherwise racily clean entry can still be detected as dirty next time this is called, but this time without reading it from disk to hash it. It’s a performance optimization and not doing so won’t change the correctness of the operation.
SubmoduleModification(U)
A submodule is initialized and checked out, and there was modification to either:
- the
HEAD
as compared to the superproject’s desired commit forHEAD
- the worktree has at least one modified file
- there is at least one untracked file
The exact nature of the modification is handled by the caller which may retain information per submodule or re-compute details as needed when seeing this variant.