Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* [Diff colors](docs/config.md#diff-colors-and-styles) can now be configured
differently for each format.

* Added `git.ignore-filters` setting to specify what filtered files in
`.gitattributes` are ignored by `jj`. Defaults to `["lfs"]`.

### Fixed bugs

* `.gitignore` with UTF-8 BOM can now be parsed correctly.
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ gix = { version = "0.80.0", default-features = false, features = [
"max-performance-safe",
"zlib-rs",
] }
gix-attributes = "0.31.0"
globset = "0.4.18"
hashbrown = { version = "0.16.1", default-features = false, features = ["inline-more"] }
ignore = "0.4.25"
Expand Down Expand Up @@ -112,7 +113,7 @@ test-case = "3.3.1"
textwrap = "0.16.2"
thiserror = "2.0.17"
timeago = { version = "0.6.0", default-features = false }
tokio = { version = "1.50.0", features = ["io-util"] }
tokio = { version = "1.50.0", features = ["io-util", "sync"] }
toml = "1.0.6"
toml_edit = { version = "0.25.4", features = ["serde"] }
tracing = "0.1.44"
Expand Down
7 changes: 7 additions & 0 deletions cli/src/command_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use jj_lib::fileset::FilePatternParseError;
use jj_lib::fileset::FilesetParseError;
use jj_lib::fileset::FilesetParseErrorKind;
use jj_lib::fix::FixError;
use jj_lib::gitattributes::GitAttributesError;
use jj_lib::gitignore::GitIgnoreError;
use jj_lib::index::IndexError;
use jj_lib::op_heads_store::OpHeadResolutionError;
Expand Down Expand Up @@ -725,6 +726,12 @@ impl From<GitIgnoreError> for CommandError {
}
}

impl From<GitAttributesError> for CommandError {
fn from(err: GitAttributesError) -> Self {
user_error_with_message("Failed to process .gitattributes.", err)
}
}

impl From<ParseBulkEditMessageError> for CommandError {
fn from(err: ParseBulkEditMessageError) -> Self {
user_error(err)
Expand Down
8 changes: 8 additions & 0 deletions cli/src/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,14 @@
"type": "boolean",
"description": "Whether to colocate the working copy with the git repository",
"default": true
},
"ignore-filters": {
"type": "array",
"items": {
"type": "string"
},
"description": "Names of `.gitattributes` filter attributes whose matching files should be excluded from snapshots",
"default": ["lfs"]
}
}
},
Expand Down
1 change: 1 addition & 0 deletions cli/src/config/misc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ disabled-branches = []

[git]
colocate = true
ignore-filters = ["lfs"]
private-commits = "none()"
push-new-bookmarks = false
sign-on-push = false
Expand Down
2 changes: 2 additions & 0 deletions cli/src/merge_tools/diff_working_copies.rs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From description:

git-lfs: access git attributes to ignore filtered files

Can you elaborate? What did we do in the previous patch if we didn't do this?

Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::collections::HashSet;
use std::fs::File;
use std::io;
use std::io::Write as _;
Expand Down Expand Up @@ -156,6 +157,7 @@ pub(crate) async fn check_out_trees(
eol_conversion_mode: EolConversionMode::None,
exec_change_setting: ExecChangeSetting::Auto,
fsmonitor_settings: FsmonitorSettings::None,
ignore_filters: HashSet::new(),
};
let mut state = TreeState::init(store.clone(), wc_path, state_dir, &tree_state_settings)?;
state.set_sparse_patterns(changed_files.clone())?;
Expand Down
1 change: 1 addition & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ either = { workspace = true }
etcetera = { workspace = true }
futures = { workspace = true }
gix = { workspace = true, optional = true }
gix-attributes = { workspace = true }
globset = { workspace = true }
hashbrown = { workspace = true }
ignore = { workspace = true }
Expand Down
6 changes: 6 additions & 0 deletions lib/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ use crate::backend::CommitId;
use crate::backend::TreeValue;
use crate::commit::Commit;
use crate::config::ConfigGetError;
use crate::config::ConfigGetResultExt as _;
use crate::file_util::IoResultExt as _;
use crate::file_util::PathError;
use crate::git_backend::GitBackend;
Expand Down Expand Up @@ -99,6 +100,7 @@ pub struct GitSettings {
pub abandon_unreachable_commits: bool,
pub executable_path: PathBuf,
pub write_change_id_header: bool,
pub ignore_filters: Vec<String>,
}

impl GitSettings {
Expand All @@ -108,6 +110,10 @@ impl GitSettings {
abandon_unreachable_commits: settings.get_bool("git.abandon-unreachable-commits")?,
executable_path: settings.get("git.executable-path")?,
write_change_id_header: settings.get("git.write-change-id-header")?,
ignore_filters: settings
.get("git.ignore-filters")
.optional()?
.unwrap_or_else(|| vec!["lfs".to_string()]),
})
}

Expand Down
Loading
Loading