Skip to content

Commit ad6b9b6

Browse files
authored
Merge pull request #1734 from EliahKagan/nonfiles
Clarify and expand descriptions of `NonFile`s
2 parents 29cb775 + 154b21f commit ad6b9b6

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

gitoxide-core/src/repository/clean.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ pub(crate) mod function {
188188
}
189189

190190
match disk_kind {
191-
Kind::NonFile => {
191+
Kind::Untrackable => {
192192
if debug {
193-
writeln!(err, "DBG: skipped non-file at '{}'", entry.rela_path).ok();
193+
writeln!(err, "DBG: skipped untrackable entry at '{}'", entry.rela_path).ok();
194194
}
195195
continue;
196196
}
@@ -265,7 +265,7 @@ pub(crate) mod function {
265265
"WOULD remove"
266266
},
267267
suffix = match disk_kind {
268-
Kind::NonFile => unreachable!("always skipped earlier"),
268+
Kind::Untrackable => unreachable!("always skipped earlier"),
269269
Kind::Directory if entry.property == Some(gix::dir::entry::Property::EmptyDirectory) => {
270270
" empty"
271271
}

gix-dir/src/entry.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,14 @@ pub enum Property {
2626
/// The kind of the entry, seated in their kinds available on disk.
2727
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd)]
2828
pub enum Kind {
29-
/// Something that is not a file, like a named pipe or character device.
29+
/// Something that is not a regular file, directory, or symbolic link.
3030
///
31-
/// These can only exist in the filesystem.
32-
NonFile,
33-
/// The entry is a blob, executable or not.
31+
/// These can only exist in the filesystem,
32+
/// because Git repositories do not support them, thus they cannot be tracked.
33+
/// Hence, they do not appear as blobs in a repository, and their type is not specifiable in a tree object.
34+
/// Examples include named pipes (FIFOs), character devices, block devices, and sockets.
35+
Untrackable,
36+
/// The entry is a blob, representing a regular file, executable or not.
3437
File,
3538
/// The entry is a symlink.
3639
Symlink,
@@ -161,7 +164,7 @@ impl From<std::fs::FileType> for Kind {
161164
} else if value.is_file() {
162165
Kind::File
163166
} else {
164-
Kind::NonFile
167+
Kind::Untrackable
165168
}
166169
}
167170
}

gix-dir/tests/dir/walk.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ fn one_top_level_fifo() {
6868

6969
assert_eq!(
7070
entries,
71-
&[entry("top", Untracked, NonFile),],
72-
"Non-files are like normal files, but with a different state"
71+
&[entry("top", Untracked, Untrackable),],
72+
"Untrackable entries are like normal files, but with a different state"
7373
);
7474
}
7575

@@ -103,11 +103,11 @@ fn fifo_in_traversal() {
103103
&[
104104
entry_nokind(".git", Pruned).with_property(DotGit).with_match(Always),
105105
entry("dir-with-file/nested-file", Untracked, File),
106-
entry("dir/nested", Untracked, NonFile),
106+
entry("dir/nested", Untracked, Untrackable),
107107
entry("file", Untracked, File),
108-
entry("top", Untracked, NonFile),
108+
entry("top", Untracked, Untrackable),
109109
],
110-
"Non-files only differ by their disk-kind"
110+
"Untrackable entries only differ by their disk-kind"
111111
);
112112
}
113113

gix-status/src/index_as_worktree/types.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ impl Outcome {
103103
pub enum Change<T = (), U = ()> {
104104
/// This corresponding file does not exist in the worktree anymore.
105105
Removed,
106-
/// The type of file changed compared to the worktree, i.e. a symlink is now a file, or a file was replaced with a named pipe.
106+
/// The type of file changed compared to the worktree.
107+
///
108+
/// Examples include when a symlink is now a regular file, or a regular file was replaced with a named pipe.
107109
///
108110
/// ### Deviation
109111
///

gix-status/src/index_as_worktree_with_renames/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -387,8 +387,8 @@ pub(super) mod function {
387387

388388
impl<T, U> gix_dir::walk::Delegate for Delegate<'_, '_, T, U> {
389389
fn emit(&mut self, entry: EntryRef<'_>, collapsed_directory_status: Option<Status>) -> Action {
390-
// Status never shows untracked non-files
391-
if entry.disk_kind != Some(gix_dir::entry::Kind::NonFile) {
390+
// Status never shows untracked entries of untrackable type
391+
if entry.disk_kind != Some(gix_dir::entry::Kind::Untrackable) {
392392
let entry = entry.to_owned();
393393
self.tx.send(Event::DirEntry(entry, collapsed_directory_status)).ok();
394394
}
@@ -469,7 +469,7 @@ pub(super) mod function {
469469
ModificationOrDirwalkEntry::Modification(c) => c.entry.mode.to_tree_entry_mode(),
470470
ModificationOrDirwalkEntry::DirwalkEntry { entry, .. } => entry.disk_kind.map(|kind| {
471471
match kind {
472-
Kind::NonFile => {
472+
Kind::Untrackable => {
473473
// Trees are never tracked for rewrites, so we 'pretend'.
474474
gix_object::tree::EntryKind::Tree
475475
}
@@ -507,7 +507,7 @@ pub(super) mod function {
507507
};
508508

509509
Ok(match kind {
510-
Kind::NonFile => {
510+
Kind::Untrackable => {
511511
// Go along with unreadable files, they are passed along without rename tracking.
512512
return Ok(object_hash.null());
513513
}

0 commit comments

Comments
 (0)