jesseduffield.lazygit/pkg/gui/filetree
Stefan Haller bc9fafff02 Make the conflict marker size a parameter of our marker matching
Git doesn't always write conflict markers of seven characters: the
conflict-marker-size gitattribute overrides that per file, and it is set
for good reasons — for file types whose regular content tends to contain
marker-looking lines, such as documentation about merging, or test
scripts. We hard-code seven characters everywhere we look for markers,
so none of that works.

Prepare for honoring the attribute by threading the marker size through
everything that recognizes a marker, carried on the file model. Nothing
fills it in yet, so we still use git's default size of seven everywhere,
and matching is unchanged: a marker consists of exactly that many marker
characters, and all but the "=======" one are followed by a space and a
label.
2026-08-08 12:43:42 +02:00
..
build_tree.go Make file sort order and case sensitivity configurable 2026-03-30 17:53:25 +02:00
build_tree_test.go Make file sort order and case sensitivity configurable 2026-03-30 17:53:25 +02:00
collapsed_paths.go Collapse/expand all files in tree 2025-01-13 21:13:11 +01:00
commit_file_node.go handle nil properly with file nodes 2022-08-01 20:32:01 +10:00
commit_file_tree.go Make file sort order and case sensitivity configurable 2026-03-30 17:53:25 +02:00
commit_file_tree_view_model.go Clamp the commit-file tree selection when the tree is rebuilt 2026-07-07 18:09:33 +02:00
commit_file_tree_view_model_test.go Clamp the commit-file tree selection when the tree is rebuilt 2026-07-07 18:09:33 +02:00
file_filter.go Filter file views rather than search 2026-03-07 20:04:31 +01:00
file_node.go Make the conflict marker size a parameter of our marker matching 2026-08-08 12:43:42 +02:00
file_node_test.go Make Node.path private 2025-03-20 12:31:34 +01:00
file_tree.go Make file sort order and case sensitivity configurable 2026-03-30 17:53:25 +02:00
file_tree_test.go Make file sort order and case sensitivity configurable 2026-03-30 17:53:25 +02:00
file_tree_view_model.go Remove RefreshingFilesMutex/FileTreeViewModel.RWMutex, dead code 2026-07-07 18:09:33 +02:00
node.go Make file sort order and case sensitivity configurable 2026-03-30 17:53:25 +02:00
node_test.go Make file sort order and case sensitivity configurable 2026-03-30 17:53:25 +02:00
README.md properly resolve cyclic dependency 2022-01-22 10:48:51 +11:00

FileTree Package

This package handles the representation of file trees. There are two ways to render files: one is to render them flat, so something like this:

dir1/file1
dir1/file2
file3

And the other is to render them as a tree

dir1/
  file1
  file2
file3

Internally we represent each of the above as a tree, but with the flat approach there's just a single root node and every path is a direct child of that root. Viewing in 'tree' mode (as opposed to 'flat' mode) allows for collapsing and expanding directories, and lets you perform actions on directories e.g. staging a whole directory. But it takes up more vertical space and sometimes you just want to have a flat view where you can go flick through your files one by one to see the diff.

This package is not concerned about rendering the tree: only representing its internal state.