Skip to content

Commit 6e7f40c

Browse files
authored
Merge pull request #335 from jacebrowning/use-all-configs
Loop through all nested configs
2 parents 3f36f86 + d1c1917 commit 6e7f40c

File tree

5 files changed

+7
-37
lines changed

5 files changed

+7
-37
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 3.5.2 (2024-06-22)
2+
3+
- Fixed logic to included all nested configs.
4+
15
# 3.5.1 (2024-05-19)
26

37
- Updated nested config lookup to ignore build and package directories.

gitman/commands.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
from . import common
99
from .decorators import preserve_cwd
1010
from .models import Config, Source, find_nested_configs, load_config
11-
from .models.config import filter_nested_configs
1211

1312

1413
def init(*, force: bool = False):
@@ -93,7 +92,6 @@ def install(
9392
config = load_config(root)
9493
configs = [config] if config else []
9594
configs.extend(find_nested_configs(root, depth, []))
96-
configs = filter_nested_configs(configs)
9795

9896
if configs:
9997
count = 0
@@ -277,7 +275,7 @@ def lock(*names, depth=None, root=None):
277275
config = load_config(root)
278276
configs = [config] if config else []
279277
configs.extend(find_nested_configs(root, depth, []))
280-
configs = filter_nested_configs(configs)
278+
281279
if configs:
282280
count = 0
283281
common.newline()

gitman/models/config.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import sys
3-
from pathlib import Path
43
from typing import Iterator, List, Optional
54

65
import log
@@ -465,20 +464,3 @@ def _valid_filename(filename):
465464
if name.startswith("."):
466465
name = name[1:]
467466
return name in {"gitman", "gdm"} and ext in {".yml", ".yaml"}
468-
469-
470-
def filter_nested_configs(configs: List[Config]) -> List[Config]:
471-
"""Filter subdirectories inside of parent config."""
472-
filtered_configs = []
473-
for config_a in configs:
474-
is_nested = False
475-
for config_b in configs:
476-
if config_a == config_b:
477-
continue
478-
if Path(config_b.location_path) in Path(config_a.location_path).parents:
479-
is_nested = True
480-
break
481-
if not is_nested:
482-
filtered_configs.append(config_a)
483-
484-
return filtered_configs

gitman/tests/test_models_config.py

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import pytest
66
from expecter import expect
77

8-
from gitman.models import Config, find_nested_configs, load_config
9-
from gitman.models.config import filter_nested_configs
8+
from gitman.models import Config, load_config
109

1110
from .conftest import FILES
1211

@@ -149,16 +148,3 @@ def test_load_from_directory_without_config_file(self, tmpdir):
149148
config = load_config()
150149

151150
assert None is config
152-
153-
@pytest.mark.integration
154-
def test_filter_nested_config(self):
155-
"""Verify that filter_nested_config removes nested configs"""
156-
config = load_config(FILES)
157-
assert None is not config
158-
count = config.install_dependencies(depth=2)
159-
assert 5 == count
160-
configs = [config] if config else []
161-
configs.extend(find_nested_configs(FILES, depth=2, skip_paths=[]))
162-
assert 2 == len(configs)
163-
configs = filter_nested_configs(configs)
164-
assert 1 == len(configs)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22

33
name = "gitman"
4-
version = "3.5.1"
4+
version = "3.5.2"
55
description = "A language-agnostic dependency manager using Git."
66

77
license = "MIT"

0 commit comments

Comments
 (0)