-
Notifications
You must be signed in to change notification settings - Fork 1
Description
$ ads-github-repo-create --version
ads-github-repo-create 0.3.5 (built: 2022-10-26 03:00:35)
Copyright (C) 2020, 2022 Alan D. Salewski <[email protected]>
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Alan D. Salewski.Issue description
When creating a new repository using ads-github-repo-create, the verification logic fails when a local Git configuration (such as found in a the system's /etc/gitconfig or a user's ~/.gitconfig) specifies the name to be used for the default branch in newly created repos (via something like defaultBranch = dev in the [init] section of that file), and that name is something other than "main":
$ ads-github-repo-create --verbose -- my-repo
ads-github-repo-create (info): GitHub repo owner is: salewski
ads-github-repo-create (info): GitHub repository does not yet exist: salewski/my-repo
ads-github-repo-create (info): attempting to create new GitHup repo: salewski/my-repo
ads-github-repo-create (info): successfully created new GitHup repo: salewski/my-repo
ads-github-repo-create (info): new repo verification: repo name....ok
ads-github-repo-create (info): new repo verification: 'fork' flag....ok
ads-github-repo-create (info): new repo verification: 'archived' flag....ok
ads-github-repo-create (info): new repo verification: 'disabled' flag....ok
ads-github-repo-create (info): new repo verification: 'created_at' field....ok
ads-github-repo-create (info): new repo verification: 'updated_at' field....ok
ads-github-repo-create (info): new repo verification: 'private' flag....ok
ads-github-repo-create (info): new repo verification: 'visibility' field....ok
ads-github-repo-create (info): new repo verification: 'default_branch' field...
ads-github-repo-create (error): newly repo verification: expected 'default_branch' field to be "main", but have "dev"; bailing out
$I'll note that the repository creation works as expected in this case; it is only the non-working verification of default_branch that causes the failure. The program seems to have an incomplete notion of what to expect from the details reported back by the GitHub API, and incorrectly bails out in this scenario. The effect is that whatever verification was left to perform (after checking default_branch) does not get performed.
Expectation: The verification of the newly created repository should succeed, and no error should be reported.
Speculation: The verification logic is considering expected branch names from command line arguments (-b (--default-branch=NAME)) or from the baked-in default ("main", which is based on the well-known default branch named used by GitHub). That logic should consider Git's "global" options, as well, which are documented in the "FILES" section of git-config(1), and include (amongst others) $(prefix)/etc/gitconfig and ${HOME}/.gitconfig).