Repos fail to commit with error "author field is required" when using git config includes for [user] section
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start by reproducing the commit step through the git-xargs command with user.name and user.email only in the included ~/.gitconfig.local, comparing git config lookups with and without --includes. Inspect the commit and Git configuration handling, then verify that included identity values are used and that git-xargs warns when the author cannot be identified.
Written by the indexing model from the issue text.
Description
git-xargs version
git-xargs version v0.0.11
Describe the bug
Logs here. When running git-xargs, I get the error "author field is required" during the commit step. This seems to be true of any repo I try with git-xargs.
It looks related to my git config includes. I use a different email addresses for git at work and use includes to specify my user.name and user.email on different machines. My ~/.gitconfig contains:
# ~/.gitconfig
[include]
path = ~/.gitconfig.local
# no [user] section exists
and
# ~/.gitconfig.local
[user]
name = ...
email = ...
I've never had any issue with this before, but notice this in the git-config man pages. It implies that git-config might not honor includes in some cases and that you might have to include an explicit option.
--[no-]includes
Respect include.* directives in config files when looking up values.
Defaults to off when a specific file is given (e.g., using --file,
--global, etc) and on when searching all config files.
Just to make sure the includes are read properly by git:
$ git config --get user.name
Aaron D Borden
$ git config --global --get user.name
# exit 1
$ git config --global --includes --get user.name
Aaron D Borden
To Reproduce
Steps to reproduce the behavior:
- Move your
user.nameanduser.emailfrom your ~/.gitconfig, to ~/.gitconfig.local - Add an
[includes]section as above in ~/.gitconfig to include ~/.gitconfig.local - I'm using a script to generate templates for git-xargs, it looks similar to this:
git-xargs \
--branch-name tts-bot/update-templates \
--loglevel "${LOGLEVEL}" \
--repos "${template_dir}/repo_list" \
--skip-archived-repos \
--pull-request-title "${pull_request_title}" \
--pull-request-description "$(template pull_request_description)" \
--commit-message "$(template commit_message)" \
$(pwd)/bin/ci_update_templates.sh "${canonical_repository}" "${template_dir}/template_files"
repos file contains the single repo 18F/ghad.
Expected behavior
git-xargs respects the git config include and attributes the author correctly AND git-xargs warns when it cannot identify the author for the commit.
Screenshots
Logs https://gist.github.com/adborden/f0000d75107e1971940d48b58bc710be
Additional context
To work-around, I confirmed that you can set the user.name and user.email in the main config and git-xargs works as expected.
- Dominant language
- Go
- Stars
- 1.1k
- Forks
- 75
- Avg merge
- 22h 5m
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from gruntwork-io/git-xargs
-
Able to change commit message depending on repo?May be free again @ZachGoldberg claimed this 429 days ago, and no pull request is open. Openenhancement
gruntwork-io/git-xargs#175 · 1 assignee ·
-
provide an environment variable with the temp directory namePossibly taken @jeff350 claimed this 1025 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
gruntwork-io/git-xargs#146 · 3 comments · 1 reaction ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 38/100
gruntwork-io/git-xargs#145 · 1 comment ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
gruntwork-io/git-xargs#144 · 4 reactions ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 35/100
gruntwork-io/git-xargs#143 ·
All issues in gruntwork-io/git-xargs
Similar issues
-
BasicEventElement `messageBroker` is never returned on read (jsonb decoded into `sql.NullString`)Open
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
eclipse-basyx/basyx-go-components#963 ·
Maintainers usually reply within 1 day
-
Area/Console Aspect/UI Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
wso2/agent-manager#2743 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day