fix(updating): run tasks in Git repository with subproject's Git config#2541
fix(updating): run tasks in Git repository with subproject's Git config#2541sisp wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## master #2541 +/- ##
===========================================
- Coverage 97.23% 82.55% -14.69%
===========================================
Files 60 60
Lines 7282 7296 +14
===========================================
- Hits 7081 6023 -1058
- Misses 201 1273 +1072
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| dst_path=tmp_path, | ||
| defaults=True, | ||
| unsafe=True, | ||
| skip_tasks=True, |
There was a problem hiding this comment.
I decided to disable tasks here (and also below) because the generated project of this archived template uses a pre-commit hook from https://gitlab.com/pycqa/flake8 which doesn't exist anymore. When trying to clone a non-existing Git repository on gitlab.com, Git prompts for credentials which blocks the test case. The pre-commit hooks are installed via a task and thus executed on git commit run internally by the update algorithm. Before the changes of this PR, there was no problem because the temporary locations managed by the update algorithm were no Git repositories at the time of project generation, so the pre-commit hooks were not installed by the task.
|
I don't mean to create noise here but is this PR abandoned? I'm also hit by the same issue as #2478 in python-package-template#39 |
eb7a9e2 to
f8a58e6
Compare
|
Thanks for the reminder, @Gara-Dorta! 👍 No, it isn't abandoned, just never got merged because I was hoping for a sanity check. But I believe this should be a safe change after re-thinking it again. I just resolved a merge conflict, will merge once CI passes. |
I've fixed the update algorithm to Git-initialize the temporary locations wherein the fresh copies of old and new template versions are generated such that tasks are run inside Git repositories. Also, these temporary Git repositories now reuse the subproject's Git config, so settings like Git remotes are accessible by tasks and custom Jinja extensions.
I think it's a valid assumption that temporary locations are Git repositories because the update algorithm requires Git to be installed and the subproject to be a Git repository, too. Hence, it may come as a surprise to template authors when tasks or Jinja extensions are run in the temporary locations, managed by the update algorithm, that aren't Git repositories. After all, having temporary locations is an implementation detail of the update algorithm, I think we should avoid leaking internals to template authors as much as possible.
Just to be sure I'm not missing anything, would the @copier-org/maintainers mind double-checking this idea?
Closes #2478.