Skip to content

Commit 0848508

Browse files
authored
Merge pull request #3279 from mirpedrol/fix_3263
General: Add hint to solve git errors with a synced repo
2 parents 24e2dc2 + db11da5 commit 0848508

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
- handle new schema structure in `nf-core pipelines create-params-file` ([#3276](https://github.com/nf-core/tools/pull/3276))
3939
- Update Gitpod image to use Miniforge instead of Miniconda([#3274](https://github.com/nf-core/tools/pull/3274))
4040
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.7.3 ([#3275](https://github.com/nf-core/tools/pull/3275))
41+
- Add hint to solve git errors with a synced repo ([#3279](https://github.com/nf-core/tools/pull/3279))
4142

4243
## [v3.0.2 - Titanium Tapir Patch](https://github.com/nf-core/tools/releases/tag/3.0.2) - [2024-10-11]
4344

nf_core/synced_repo.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,16 @@ def get_component_git_log(
395395
old_component_path = Path("modules", component_name)
396396
commits_old_iter = self.repo.iter_commits(max_count=depth, paths=old_component_path)
397397

398-
commits_old = [{"git_sha": commit.hexsha, "trunc_message": commit.message} for commit in commits_old_iter]
399-
commits_new = [{"git_sha": commit.hexsha, "trunc_message": commit.message} for commit in commits_new_iter]
398+
try:
399+
commits_old = [{"git_sha": commit.hexsha, "trunc_message": commit.message} for commit in commits_old_iter]
400+
commits_new = [{"git_sha": commit.hexsha, "trunc_message": commit.message} for commit in commits_new_iter]
401+
except git.GitCommandError as e:
402+
log.error(
403+
f"Git error: {e}\n"
404+
"To solve this, you can try to remove the cloned rempository and run the command again.\n"
405+
f"This repository is typically found at `{self.local_repo_dir}`"
406+
)
407+
raise UserWarning
400408
commits = iter(commits_new + commits_old)
401409

402410
return commits

0 commit comments

Comments
 (0)