Skip to content

Commit

Permalink
cli: add inline comment about racy Git HEAD updates
Browse files Browse the repository at this point in the history
This is the source of the problem I noticed when debugging jj-vcs#924 and jj-vcs#1608. I
don't think this can be easily fixed, so let's document it.
  • Loading branch information
yuja committed Jan 26, 2024
1 parent f920d66 commit 1c30a40
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cli/src/cli_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,16 @@ impl WorkspaceCommandHelper {
return Ok(());
}

// TODO: There are various ways to get duplicated working-copy
// commits. Some of them could be mitigated by checking the working-copy
// operation id after acquiring the lock, but that isn't enough.
//
// - moved HEAD was observed by multiple jj processes, and new working-copy
// commits are created concurrently.
// - new HEAD was exported by jj, but the operation isn't committed yet.
// - new HEAD was exported by jj, but the new working-copy commit isn't checked
// out yet.

let mut tx = tx.into_inner();
let old_git_head = self.repo().view().git_head().clone();
let new_git_head = tx.mut_repo().view().git_head().clone();
Expand Down

0 comments on commit 1c30a40

Please sign in to comment.