Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git default branch #1705

Merged
merged 10 commits into from
Jul 29, 2022
Merged

Git default branch #1705

merged 10 commits into from
Jul 29, 2022

Conversation

mirpedrol
Copy link
Member

Closes #1688

If Git defaultBranch is set to dev or TEMPLATE nf-core commands that create a new pipeline repository fail with nice error message and the pipeline git repository is not initialised.

PR checklist

  • This comment contains a description of changes (with reason)
  • CHANGELOG.md is updated
  • If you've fixed a bug or added code that should be tested, add tests!
  • Documentation in docs is updated

@SamStudio8
Copy link
Contributor

SamStudio8 commented Jul 28, 2022

Hi @mirpedrol. I did not responsibly provide a complete suggestion in #1688. I wondered what would happen if the init.defaultBranch was not in the gitconfig. This code will need to catch configparser.NoSectionError and configparser.NoOptionError (or the base configparser.Error).

No [init] in .gitconfig

Traceback (most recent call last):
...
configparser.NoSectionError: No section: 'init'

[init] but no defaultBranch in .gitconfig

Traceback (most recent call last):
...
configparser.NoOptionError: No option 'defaultBranch' in section: 'init'

Error handling example

import git
import configparser

try:
    default_branch = git.config.GitConfigParser().get_value("init", "defaultBranch")
except configparser.Error:
    log.info("Could not read init.defaultBranch")
    default_branch = None

@codecov
Copy link

codecov bot commented Jul 28, 2022

Codecov Report

Merging #1705 (9833007) into dev (3c22ebb) will increase coverage by 0.02%.
The diff coverage is 87.50%.

@@            Coverage Diff             @@
##              dev    #1705      +/-   ##
==========================================
+ Coverage   68.21%   68.23%   +0.02%     
==========================================
  Files          57       57              
  Lines        6736     6744       +8     
==========================================
+ Hits         4595     4602       +7     
- Misses       2141     2142       +1     
Impacted Files Coverage Δ
nf_core/create.py 63.42% <87.50%> (+0.77%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c22ebb...9833007. Read the comment docs.

@mirpedrol mirpedrol marked this pull request as ready for review July 28, 2022 11:42
@ErikDanielsson ErikDanielsson merged commit 880d627 into nf-core:dev Jul 29, 2022
@mirpedrol mirpedrol deleted the git-default-branch branch July 29, 2022 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants