Skip to content

Commit ea8ecc9

Browse files
committed
src/cli(refactor[add]): remove conditional normalization for path-first adds
why: normalize_workspace_roots was only needed for legacy name+URL flow cleanup; path-first adds derive correct labels directly. what: - Remove normalize_workspace_roots call from merge path - Remove in-place label normalization from no-merge path - Remove unused normalize_workspace_roots import (ruff auto-fix) - Simplify config_was_relabelled tracking refs: Eliminate legacy normalization machinery
1 parent 0cf47ae commit ea8ecc9

File tree

1 file changed

+2
-37
lines changed

1 file changed

+2
-37
lines changed

src/vcspull/cli/add.py

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
expand_dir,
1818
find_home_config_files,
1919
merge_duplicate_workspace_roots,
20-
normalize_workspace_roots,
2120
save_config_yaml,
2221
save_config_yaml_with_items,
2322
workspace_root_label,
@@ -539,23 +538,8 @@ def _prepare_no_merge_items(
539538
Style.RESET_ALL,
540539
)
541540

542-
normalization_changes = 0
543-
if path is None:
544-
(
545-
raw_config,
546-
_normalization_map,
547-
normalization_conflicts,
548-
normalization_changes,
549-
) = normalize_workspace_roots(
550-
raw_config,
551-
cwd=cwd,
552-
home=home,
553-
)
554-
for message in normalization_conflicts:
555-
log.warning(message)
556-
557541
workspace_label, relabelled = _ensure_workspace_label_for_merge(raw_config)
558-
config_was_relabelled = relabelled or (normalization_changes > 0)
542+
config_was_relabelled = relabelled
559543
workspace_section = raw_config.get(workspace_label)
560544
if not isinstance(workspace_section, dict):
561545
log.error(
@@ -657,28 +641,9 @@ def _prepare_no_merge_items(
657641
return
658642

659643
ordered_items = _build_ordered_items(top_level_items, raw_config)
660-
normalization_applied = False
661-
if path is None:
662-
for entry in ordered_items:
663-
section = entry["section"]
664-
if not isinstance(section, dict):
665-
continue
666-
try:
667-
path_key = canonicalize_workspace_path(entry["label"], cwd=cwd)
668-
except Exception:
669-
continue
670-
normalized_label = workspace_root_label(
671-
path_key,
672-
cwd=cwd,
673-
home=home,
674-
preserve_cwd_label=True,
675-
)
676-
if normalized_label != entry["label"]:
677-
entry["label"] = normalized_label
678-
normalization_applied = True
679644

680645
workspace_label, target_index, relabelled = _prepare_no_merge_items(ordered_items)
681-
config_was_relabelled = relabelled or normalization_applied
646+
config_was_relabelled = relabelled
682647

683648
duplicate_sections = _collect_duplicate_sections(ordered_items)
684649
for label, sections in duplicate_sections.items():

0 commit comments

Comments
 (0)