mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-07 05:16:33 +00:00
git: check reserved remote name while diffing
As I'm going to add separate lists of changed git_refs/remote_refs, it'll become a bit unclear which one we should check for reserved remotes. The diff might also be reorganized as a list of (remote, name, kind, old_target, new_target) where remote == "git" means the git-tracking branch. In this data structure, the notion of reserved remote name would be lost.
This commit is contained in:
parent
f062df6da7
commit
5bd2ab76f4
1 changed files with 3 additions and 3 deletions
|
@ -193,9 +193,6 @@ pub fn import_some_refs(
|
|||
old_git_head.is_present().then(RefTarget::absent)
|
||||
};
|
||||
let changed_remote_refs = diff_refs_to_import(mut_repo.view(), git_repo, git_ref_filter)?;
|
||||
if changed_remote_refs.keys().any(is_reserved_git_remote_ref) {
|
||||
return Err(GitImportError::RemoteReservedForLocalGitRepo);
|
||||
}
|
||||
|
||||
// Import new heads
|
||||
let store = mut_repo.store();
|
||||
|
@ -341,6 +338,9 @@ fn diff_refs_to_import(
|
|||
if !git_ref_filter(&ref_name) {
|
||||
continue;
|
||||
}
|
||||
if is_reserved_git_remote_ref(&ref_name) {
|
||||
return Err(GitImportError::RemoteReservedForLocalGitRepo);
|
||||
}
|
||||
let old_target = known_remote_refs.get(&ref_name).copied().flatten();
|
||||
let Some(id) = resolve_git_ref_to_commit_id(&git_ref, old_target) else {
|
||||
// Skip (or remove existing) invalid refs.
|
||||
|
|
Loading…
Reference in a new issue