-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore Git LFS files #5480
base: main
Are you sure you want to change the base?
Ignore Git LFS files #5480
Changes from all commits
ee8b541
8dbced8
05c236f
06d882c
f6e64c5
60867a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.gitignore |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: squash this into the first commit which successfully implements this. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1277,6 +1277,32 @@ to the current parents may contain changes from multiple commits. | |
self.path_converter().parse_file_path(input) | ||
} | ||
|
||
/// Parses the given strings as file patterns, convert it to a matcher and | ||
/// apply GIT LFS exclusions if requested | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: Its Git LFS |
||
pub fn file_matcher( | ||
&self, | ||
ui: &Ui, | ||
values: &[String], | ||
) -> Result<Box<dyn Matcher>, CommandError> { | ||
let mut matcher = self.parse_file_patterns(ui, values)?.to_matcher(); | ||
if self.settings().git_settings()?.ignore_lfs_files { | ||
let root = self.workspace().workspace_root(); | ||
if let Some(wc_commit) = self | ||
.get_wc_commit_id() | ||
.map(|id| self.repo().store().get_commit(id)) | ||
.transpose()? | ||
{ | ||
let tree = wc_commit.tree()?; | ||
matcher = Box::new(jj_lib::matchers::DifferenceMatcher::new( | ||
matcher, | ||
jj_lib::matchers::GitAttributesMatcher::new(tree.as_merge().first(), root) | ||
.expect("gitattributes matcher failed"), | ||
)); | ||
} | ||
} | ||
Ok(matcher) | ||
} | ||
|
||
/// Parses the given strings as file patterns. | ||
pub fn parse_file_patterns( | ||
&self, | ||
|
@@ -1350,6 +1376,7 @@ to the current parents may contain changes from multiple commits. | |
start_tracking_matcher, | ||
max_new_file_size, | ||
conflict_marker_style, | ||
skip_git_lfs_files: self.settings().git_settings()?.ignore_lfs_files, | ||
}) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1258,6 +1258,17 @@ particular binary, you can: | |||||
executable-path = "/path/to/git" | ||||||
``` | ||||||
|
||||||
### Ignore Git LFS Files | ||||||
|
||||||
By default Git LFS files are **not** handled by `jj`. This will result in `jj` showing | ||||||
changes in these files, even if they are unchanged. You can configure `jj` to ignore these | ||||||
files by instructing it to parse the relevant `.gitattributes` files | ||||||
|
||||||
```tom | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
[git] | ||||||
ignore-lfs-files = -rue | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
``` | ||||||
|
||||||
## Filesystem monitor | ||||||
|
||||||
In large repositories, it may be beneficial to use a "filesystem monitor" to | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: remove