diff --git a/CHANGELOG.md b/CHANGELOG.md index dac1598d91..6b93768805 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - switch to uv and pyproject.toml ([#3925](https://github.com/nf-core/tools/pull/3925)) - Pin j178/prek-action action to 91fd7d7 ([#3931](https://github.com/nf-core/tools/pull/3931)) - add pre-commit hook to keep uv.lock in sync ([#3933](https://github.com/nf-core/tools/pull/3933)) +- sync: don't overwrite the defaultBranch if already set in nextflow.config ([#3939](https://github.com/nf-core/tools/pull/3939)) ### Template diff --git a/nf_core/pipelines/create/create.py b/nf_core/pipelines/create/create.py index bfc8a97efb..73885f2e21 100644 --- a/nf_core/pipelines/create/create.py +++ b/nf_core/pipelines/create/create.py @@ -94,8 +94,9 @@ def __init__( if self.config.outdir is None: self.config.outdir = str(Path.cwd()) - # Get the default branch name from the Git configuration - self.get_default_branch() + # Get the default branch name from the Git configuration if it was not parsed from nextflow.config previously + if self.default_branch == "master": + self.get_default_branch() self.jinja_params, self.skip_areas = self.obtain_jinja_params_dict( self.config.skip_features or [], str(self.config.outdir) diff --git a/nf_core/pipelines/sync.py b/nf_core/pipelines/sync.py index 7ce358cd07..f54dbe2d56 100644 --- a/nf_core/pipelines/sync.py +++ b/nf_core/pipelines/sync.py @@ -202,7 +202,7 @@ def inspect_sync_dir(self): # Track ignored files to avoid processing them self.ignored_files = self._get_ignored_files() - def get_wf_config(self): + def get_wf_config(self) -> None: """Check out the target branch if requested and fetch the nextflow config. Check that we have the required config variables. """ @@ -290,7 +290,7 @@ def _clean_up_empty_dirs(self): raise SyncExceptionError(e) deleted.add(Path(curr_dir)) - def make_template_pipeline(self): + def make_template_pipeline(self) -> None: """ Delete all files and make a fresh template using the workflow variables """ @@ -315,6 +315,7 @@ def make_template_pipeline(self): from_config_file=True, no_git=True, force=True, + default_branch=self.wf_config.get("manifest.defaultBranch") or "master", ) pipeline_create_obj.init_pipeline()