Skip to content

Commit

Permalink
Merge pull request #64 from ESMCI/fix/newremote
Browse files Browse the repository at this point in the history
fix issues with sparse config
  • Loading branch information
jedwards4b authored Sep 18, 2024
2 parents b85ce7b + e850ebe commit 8be4e76
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
# reference the matrixe python version here.
- uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: '3.12'

# Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow
# from installing Poetry every time, which can be slow. Note the use of the Poetry version
Expand All @@ -29,7 +29,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.local
key: poetry-1.7.1
key: poetry-1.8.2

# Install Poetry. You could do this manually, or there are several actions that do this.
# `snok/install-poetry` seems to be minimal yet complete, and really just calls out to
Expand All @@ -42,7 +42,7 @@ jobs:
# cache it.
- uses: snok/install-poetry@v1
with:
version: 1.7.1
version: 1.8.2
virtualenvs-create: true
virtualenvs-in-project: true

Expand Down Expand Up @@ -74,4 +74,7 @@ jobs:
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
poetry run pytest
- name: Setup tmate session
if: ${{ failure() }}
uses: mxschmitt/action-tmate@v3

2 changes: 2 additions & 0 deletions git_fleximod/gitinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ def config_get_value(self, section, name):
def config_set_value(self, section, name, value):
if self._use_module:
with self.repo.config_writer() as writer:
if "." in section:
section = section.replace("."," \"")+'"'
writer.set_value(section, name, value)
writer.release() # Ensure changes are saved
else:
Expand Down
8 changes: 4 additions & 4 deletions git_fleximod/submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def _add_remote(self, git):
return newremote
else:
i = 0
while "newremote" in remotes:
while newremote in remotes:
i = i + 1
newremote = f"newremote.{i:02d}"
else:
Expand Down Expand Up @@ -303,9 +303,9 @@ def sparse_checkout(self):
print(f"Error checking out {self.name:>20} at {self.fxtag}")
else:
print(f"Successfully checked out {self.name:>20} at {self.fxtag}")
rgit.config_set_value(f'submodule "{self.name}"', "active", "true")
rgit.config_set_value(f'submodule "{self.name}"', "url", self.url)
rgit.config_set_value(f'submodule "{self.name}"', "path", self.path)
rgit.config_set_value('submodule.' + self.name, "active", "true")
rgit.config_set_value('submodule.' + self.name, "url", self.url)
rgit.config_set_value('submodule.' + self.name, "path", self.path)

def update(self):
"""
Expand Down
5 changes: 1 addition & 4 deletions git_fleximod/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,7 @@ def execute_subprocess(commands, status_to_caller=False, output_to_caller=False)
"returned status {0}".format(error.returncode)
)
msg = failed_command_msg(msg_context, commands, output=error.output)
if return_to_caller:
logging.warning(error)
logging.warning(msg)
else:
if not return_to_caller:
logging.error(error)
logging.error(msg)
log_process_output(error.output)
Expand Down

0 comments on commit 8be4e76

Please sign in to comment.