Skip to content

Fix bug: tests overwrites git local config#53

Merged
josecelano merged 2 commits into
mainfrom
issue-52-do-not-overwrite-git-local-config
Feb 21, 2022
Merged

Fix bug: tests overwrites git local config#53
josecelano merged 2 commits into
mainfrom
issue-52-do-not-overwrite-git-local-config

Conversation

@josecelano

Copy link
Copy Markdown
Member

Issue: #52

@github-actions

github-actions Bot commented Feb 17, 2022

Copy link
Copy Markdown

MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ ACTION actionlint 4 0 0.12s
✅ COPYPASTE jscpd yes no 1.69s
✅ CREDENTIALS secretlint yes no 0.98s
✅ GIT git_diff yes no 0.02s
✅ JAVASCRIPT standard 1 0 0 1.5s
✅ JSON eslint-plugin-jsonc 7 0 0 1.01s
✅ JSON jsonlint 7 0 2.03s
✅ JSON prettier 7 0 0 1.46s
✅ JSON v8r 7 0 8.33s
✅ MARKDOWN markdownlint 2 0 0 0.36s
✅ MARKDOWN markdown-link-check 2 0 1.05s
✅ MARKDOWN markdown-table-formatter 2 0 0 0.36s
✅ SPELL cspell 77 0 3.5s
✅ SPELL misspell 77 0 0 0.19s
✅ TYPESCRIPT eslint 51 0 0 14.68s
✅ YAML prettier 7 0 0 1.69s
✅ YAML v8r 7 0 8.04s
✅ YAML yamllint 7 0 0.5s

See errors details in artifact MegaLinter reports on CI Job page

@josecelano

josecelano commented Feb 17, 2022

Copy link
Copy Markdown
Member Author

I've just removed the git.addConfig() in tests to go back to the error I had:

image

It seems the git child process can't use the git global user configuration. As I explained in the issue I thought the git.addConfig() did not change the configuration on the disk, but it's not the case.

I think the easy solution would be to use the env vars:

GIT_COMMITTER_NAME
GIT_COMMITTER_EMAIL

WE pass those vars to the child process here. But first I want to understand why the git child process cannot access the global git configuration.

@josecelano josecelano linked an issue Feb 17, 2022 that may be closed by this pull request
@josecelano

Copy link
Copy Markdown
Member Author

IT seems you can also supply config options to the commit command: https://github.com/steveukx/git-js#per-command-configuration

@josecelano josecelano force-pushed the issue-52-do-not-overwrite-git-local-config branch from 546d927 to 525f169 Compare February 21, 2022 12:05
@josecelano josecelano marked this pull request as ready for review February 21, 2022 12:06
@josecelano josecelano added the bug Something isn't working label Feb 21, 2022
@josecelano josecelano merged commit 77a0037 into main Feb 21, 2022
@josecelano josecelano deleted the issue-52-do-not-overwrite-git-local-config branch February 21, 2022 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix bug: tests overwrites git local config

1 participant