Skip to content

Commit 8ff667d

Browse files
authored
Merge pull request openSUSE#1849 from dirkmueller/pbuild_handling
Fix detection of gitstore
2 parents 5b0a760 + 59fe5e8 commit 8ff667d

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

osc/git_scm/store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def get_project_git_scm_store(self):
117117
subdirs_path = os.path.join(path, "_subdirs")
118118

119119
# we always stop at the top-most directory that contains .git subdir
120-
if not os.path.isfile(config_path) or os.path.isfile(pbuild_path):
120+
if not (os.path.isfile(config_path) or os.path.isfile(pbuild_path)):
121121
# it's not a project, stop traversing and return
122122
return None
123123

tests/test_git_scm_store.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,32 @@ def test_pkg_git_project(self):
146146
self.assertEqual(store.project, "PROJ")
147147
self.assertEqual(store.package, "my-package")
148148

149+
def test_pkg_git_project_with_config_without_pbuild(self):
150+
prj_path = os.path.join(self.tmpdir, "project")
151+
self._git_init(prj_path)
152+
self._write(os.path.join(prj_path, "_config"))
153+
self._write(os.path.join(prj_path, "project.build"), "PROJ")
154+
155+
pkg_path = os.path.join(prj_path, "package")
156+
self._git_init(pkg_path)
157+
158+
store = GitStore(pkg_path)
159+
self.assertEqual(store.project, "PROJ")
160+
self.assertEqual(store.package, "my-package")
161+
162+
def test_pkg_git_project_without_config_with_pbuild(self):
163+
prj_path = os.path.join(self.tmpdir, "project")
164+
self._git_init(prj_path)
165+
self._write(os.path.join(prj_path, "_pbuild"))
166+
self._write(os.path.join(prj_path, "project.build"), "PROJ")
167+
168+
pkg_path = os.path.join(prj_path, "package")
169+
self._git_init(pkg_path)
170+
171+
store = GitStore(pkg_path)
172+
self.assertEqual(store.project, "PROJ")
173+
self.assertEqual(store.package, "my-package")
174+
149175
def test_pkg_separate_git_dir_git_project(self):
150176
prj_path = os.path.join(self.tmpdir, "project")
151177
self._git_init(prj_path)

0 commit comments

Comments
 (0)