Skip to content

Commit

Permalink
[wip] Fix config install not working when .git* folder is in the path (
Browse files Browse the repository at this point in the history
…#8605)

* Add config install test with .gitlab folder

* assert

* remove import

* fix test

* Fix for .git folder in conan config install

* review

Co-authored-by: czoido <mrgalleta@gmail.com>
  • Loading branch information
danimtb and czoido committed Mar 17, 2021
1 parent 12fdc0b commit 54c9c8d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 0 additions & 2 deletions conans/client/conf/config_installer.py
Expand Up @@ -130,8 +130,6 @@ def _process_folder(config, folder, cache, output):
folder = os.path.join(folder, config.source_folder)
for root, dirs, files in walk(folder):
dirs[:] = [d for d in dirs if d != ".git"]
if ".git" in root:
continue
for f in files:
_process_file(root, f, config, cache, output, folder)

Expand Down
20 changes: 20 additions & 0 deletions conans/test/functional/command/config_install_test.py
Expand Up @@ -752,3 +752,23 @@ def test_config_install_remove_config_repo(self):
self.assertNotIn("Repo cloned!", self.client.out)
# ... and updates the next schedule
self.assertGreater(os.path.getmtime(self.client.cache.config_install_file), last_change)

def test_config_fails_git_folder(self):
# https://github.com/conan-io/conan/issues/8594
folder = os.path.join(temp_folder(), ".gitlab-conan", ".conan")
client = TestClient(cache_folder=folder)
with client.chdir(self.folder):
client.run_command('git init .')
client.run_command('git add .')
client.run_command('git config user.name myname')
client.run_command('git config user.email myname@mycompany.com')
client.run_command('git commit -m "mymsg"')
assert ".gitlab-conan" in client.cache_folder
assert os.path.basename(client.cache_folder) == ".conan"
conf = load(client.cache.conan_conf_path)
assert "config_install_interval = 5m" not in conf
client.run('config install "%s/.git" --type git' % self.folder)
conf = load(client.cache.conan_conf_path)
assert "config_install_interval = 5m" in conf
dirs = os.listdir(client.cache.cache_folder)
assert ".git" not in dirs

0 comments on commit 54c9c8d

Please sign in to comment.