Skip to content

Commit

Permalink
Fix subrepo init failing if defaultbranch not set
Browse files Browse the repository at this point in the history
subrepo uses -e to ensure that all commands succeed, and fails
immediately if they do not. git config reports a failure if a
setting is not found causing subrepo init to silently fail if
the setting did not exist on the system. Updated to use --default
which returns a default value if the setting does not exist.

Fixes #631
  • Loading branch information
admorgan committed Sep 9, 2024
1 parent ea10886 commit 55a050a
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/git-subrepo
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,7 @@ command:clone() {
# `git subrepo init <subdir>` command:
command:init() {
command-setup +subdir
local default_branch=
default_branch=$(git config init.defaultbranch)
default_branch=${default_branch:=master}
local default_branch=$(git config get --default=master init.defaultbranch)
local remote=${subrepo_remote:=none}
local branch=${subrepo_branch:=$default_branch}

Expand Down

0 comments on commit 55a050a

Please sign in to comment.