Skip to content

Commit

Permalink
Set default value for command git config --get
Browse files Browse the repository at this point in the history
* Set default value that will be returned if the getting key does not exist

  git config --file .gitmodules --default "" --get submodule.xxx.branch

  It returns code 0 (no error) instead of 1 (error) which is the
  expected behavior.
  • Loading branch information
neutronth committed Sep 1, 2020
1 parent 7d7fb3c commit 27fe50d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/git-sync/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ func submoduleNameFromPath(ctx context.Context, worktreePath, submodulePath stri
}

func submoduleBranchRef(ctx context.Context, worktreePath, submoduleName string) (string, error) {
confGitModulesArgs := []string{"config", "--file", ".gitmodules", "--get"}
confGitModulesArgs := []string{"config", "--file", ".gitmodules", "--default", "", "--get"}
confGitModulesArgs = append(confGitModulesArgs, "submodule."+submoduleName+".branch")
output, err := runCommand(ctx, worktreePath, *flGitCmd, confGitModulesArgs...)
if err != nil {
Expand Down

0 comments on commit 27fe50d

Please sign in to comment.