Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: prevent commit signing in tests#13222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
dannykopping merged 2 commits intocoder:mainfromdannykopping:dk/nosign
May 10, 2024

Conversation

dannykopping
Copy link
Contributor

@dannykoppingdannykopping commentedMay 10, 2024
edited
Loading

In my workspace, my git config contains this alias:

$ git config -l| grep alias.commitalias.commit=commit -s

WhenTestDotfiles is called, it runsgit commit which tries to sign the commits and causes my tests to hang and fail. We need to prevent this behaviour.

I tried usingGIT_CONFIG_NOSYSTEM, but that doesn't prevent the use of the git config in my home directory.
(source)

This feels like the cleanest approach to me; an alternative would be to override theHOME env var, but that could have other side-effects.

Edit:@mafredri suggesting using GIT_CONFIG_GLOBAL=/dev/nullandGIT_CONFIG_SYSTEM=/dev/null` which solves the problem more elegantly than my original solution.

Signed-off-by: Danny Kopping <danny@coder.com>
@dannykoppingdannykopping changed the titleDo not attempt to sign commits in testschore: do not attempt to sign commits in testsMay 10, 2024
@dannykoppingdannykopping changed the titlechore: do not attempt to sign commits in testschore: prevent commit signing in testsMay 10, 2024
Copy link
Member

@mafredrimafredri left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Interesting find! How about we setGIT_CONFIG_GLOBAL=/dev/null (andGIT_CONFIG_SYSTEM=/dev/null?) instead? This seems like it would be a more robust approach vs handling any special cases in user configurations?

@dannykopping
Copy link
ContributorAuthor

Interesting find! How about we setGIT_CONFIG_GLOBAL=/dev/null (andGIT_CONFIG_SYSTEM=/dev/null?) instead? This seems like it would be a more robust approach vs handling any special cases in user configurations?

I believe that it's not using the global config at all, but rather the one from my home dir which it doesn't seem possible to override.

@mafredri
Copy link
Member

I believe that it's not using the global config at all, but rather the one from my home dir which it doesn't seem possible to override.

That's what global is for, to avoid using your home dir config. The system variant is for/etc.

@dannykopping
Copy link
ContributorAuthor

I believe that it's not using the global config at all, but rather the one from my home dir which it doesn't seem possible to override.

That's what global is for, to avoid using your home dir config. The system variant is for/etc.

Oh interesting! I didn't seeGIT_CONFIG_GLOBAL listed in thedocs weirdly, but it appears to work

$ git config -l| grep alias.commitalias.commit=commit -s$ GIT_CONFIG_GLOBAL=/dev/null git config -l| grep alias.commit$

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hmm, interesting. It is described in the man page, though:

   GIT_CONFIG_GLOBAL, GIT_CONFIG_SYSTEM      Take the configuration from the given files instead from global or system-level configuration files. If      GIT_CONFIG_SYSTEM is set, the system config file defined at build time (usually /etc/gitconfig) will not be read.      Likewise, if GIT_CONFIG_GLOBAL is set, neither $HOME/.gitconfig nor $XDG_CONFIG_HOME/git/config will be read. Can be      set to /dev/null to skip reading configuration files of the respective level.

@dannykoppingdannykopping merged commit989575c intocoder:mainMay 10, 2024
@dannykoppingdannykopping deleted the dk/nosign branchMay 10, 2024 14:36
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsMay 10, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

@EmyrkEmyrkAwaiting requested review from Emyrk

@f0sself0sselAwaiting requested review from f0ssel

Assignees

@dannykoppingdannykopping

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@dannykopping@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp