Skip to content

Commit

Permalink
Effectively assure that create_wd_tree() picks up everything.
Browse files Browse the repository at this point in the history
It's not safe to do that while performing hard resets, and we shouldn't
risk it just yet.
  • Loading branch information
Byron committed Jan 6, 2025
1 parent 1af1556 commit d0d803c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion crates/gitbutler-edit-mode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,9 @@ pub(crate) fn save_and_return_to_workspace(
let parents = commit.parents().collect::<Vec<_>>();

// Recommit commit
let tree = repository.create_wd_tree(AUTO_TRACK_LIMIT_BYTES)?;
// While we perform hard resets we should pick up everything to avoid loosing worktree state.
let pick_up_untracked_files_of_any_size = 0;
let tree = repository.create_wd_tree(pick_up_untracked_files_of_any_size)?;

let (_, committer) = repository.signatures()?;
let commit_headers = commit
Expand Down
3 changes: 2 additions & 1 deletion crates/gitbutler-project/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ pub fn configure_git2() {
}

/// The maximum size of files to automatically start tracking, i.e. untracked files we pick up for tree-creation.
pub const AUTO_TRACK_LIMIT_BYTES: u64 = 32 * 1024 * 1024;
/// **Inactive for now** while it's hard to tell if it's safe *not* to pick up everything.
pub const AUTO_TRACK_LIMIT_BYTES: u64 = 0;

0 comments on commit d0d803c

Please sign in to comment.