From 4974065edb6e72e99b025107965882948dfc6799 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Fri, 22 Sep 2023 20:28:26 +0900 Subject: [PATCH] git: update comment about remote-tracking branches to be exported 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. --- lib/src/git.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/src/git.rs b/lib/src/git.rs index 55caeae1d5..63656fc971 100644 --- a/lib/src/git.rs +++ b/lib/src/git.rs @@ -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,