Skip to content

Commit

Permalink
git: update comment about remote-tracking branches to be exported
Browse files Browse the repository at this point in the history
Spotted while porting it to per-remote views. Undone fetch/push is tricky. If
we want to detect git/jj conflicts in that scenario, we would need to track
both "known" and "current" remote targets. It's probably okay to export jj's
remote targets as we do the reverse for import_refs(), but I need to think
that a bit more.
  • Loading branch information
yuja committed Sep 23, 2023
1 parent 4894636 commit 4974065
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,9 @@ fn diff_refs_to_export(
let new_target = match &ref_name {
RefName::LocalBranch(branch) => view.get_local_branch(branch),
RefName::RemoteBranch { remote, branch } => {
// Currently, the only situation where this case occurs *and* new_target !=
// old_target is after a `jj branch forget`. So, in practice, for
// remote-tracking branches either `new_target == old_target` or
// `new_target == None`.
// There are two situations where remote-tracking branches get out of sync:
// 1. `jj branch forget`
// 2. `jj op undo`/`restore` in colocated repo
view.get_remote_branch(branch, remote)
}
_ => continue,
Expand Down

0 comments on commit 4974065

Please sign in to comment.