Skip to content

GitInput: Determine default branch for repository#1657

Merged
Ericson2314 merged 1 commit intomasterfrom
git-default-branch
May 3, 2026
Merged

GitInput: Determine default branch for repository#1657
Ericson2314 merged 1 commit intomasterfrom
git-default-branch

Conversation

@mweinelt
Copy link
Copy Markdown
Member

@mweinelt mweinelt commented Apr 12, 2026

Up until now when no branch was defined the Git Plugin hardcoded the master branch.

Now we try resolving the default branch with git ls-remote and allow a configurable fallback branch, that can be master or anything else.

Tested!

Closes: #325

Comment thread subprojects/hydra/lib/Hydra/Plugin/GitInput.pm Outdated
@mweinelt mweinelt force-pushed the git-default-branch branch from 7be311a to cb021ed Compare April 21, 2026 15:23
Up until now when no branch was defined the Git Plugin hardcoded the
master branch.

Now we try resolving the default branch with git ls-remote and allow
a configurable fallback branch, that can be master or anything else.
@mweinelt
Copy link
Copy Markdown
Member Author

mweinelt commented Apr 21, 2026

starting evaluation of jobset ‘nixos-mailserver:.jobsets (jobset#43)’ (last checked 39 s ago)
(nixos-mailserver:.jobsets) Fetching input `decl` (git) https://gitlab.com/simple-nixos-mailserver/nixos-mailserver
checking out Git branch main from https://gitlab.com/simple-nixos-mailserver/nixos-mailserver
Initialized empty Git repository in /tmp/git-checkout-tmp-pvfWa3Qd/source/.git/
From /var/lib/hydra/scm/git/e772881f93683bcbbf09c2f3678b8c329ac0aa377ec18540e20cf8cdf013a6e6
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main
Switched to a new branch 'fetchgit'
removing `.git'...
hash is 20059ba4f6ebd93275667aa2db2d6452fd183762713f060a57ad55b330af5a9a
path is /nix/store/2vdfq8d0awib7sqqbya0vmmcfdcimdic-source

Tested and successfully pulls main (the default branch on nixos-mailserver) without any branch specified or any specific configuration.

Comment thread subprojects/hydra/lib/Hydra/Plugin/GitInput.pm
Comment thread subprojects/hydra/lib/Hydra/Plugin/GitInput.pm
@Ericson2314 Ericson2314 added this pull request to the merge queue May 3, 2026
Merged via the queue into master with commit 64192fa May 3, 2026
3 of 4 checks passed
@Ericson2314 Ericson2314 deleted the git-default-branch branch May 3, 2026 22:48
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.

Git repository input should fetch the default branch by default

3 participants