Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fall back gracefully if user.{name,email} not set #22

Merged
merged 1 commit into from
Jul 18, 2019

Conversation

alyssais
Copy link
Contributor

Git has defaults for if the user.name and user.email configuration options aren't set, but these aren't implemented by libgit2. They make the case that these are an implementation detail of Git, which is entirely correct. Fortunately, git-absorb doesn't really need signatures in order to function. We just lose the author check, and create our temporary commits using a dummy signature. Since they're temporary anyway, this doesn't matter.

Now, since git-absorb is intended to be used as a subcommand of the Git CLI, think it would actually make more sense for it to use Git's default signature implementation, rather than libgit2's. This would make it more consistent with every other git command. Git provides a nice plumbing API to get this value: git var GIT_AUTHOR_IDENT. So, in my mind the more correct fix would actually be to use that, but that would require spawning a git process, which git-absorb doesn't currently do. Hence this more conservative patch. I don't think it would be a big problem though -- it's very unlikely git-absorb would ever be used without git being available.

Git has defaults for if the user.name and user.email configuration
options aren't set, but these aren't implemented by libgit2[1]. They
make the case that these are an implementation detail of Git, which is
entirely correct. Fortunately, git-absorb doesn't really need signatures
in order to function. We just lose the author check, and create our
temporary commits using a dummy signature. Since they're temporary
anyway, this doesn't matter.

Now, since git-absorb is intended to be used as a subcommand of the Git
CLI, think it would actually make more sense for it to use Git's default
signature implementation, rather than libgit2's. This would make it more
consistent with every other git command. Git provides a nice plumbing
API to get this value: git var GIT_AUTHOR_IDENT. So, in my mind the more
correct fix would actually be to use that, but that would require
spawning a git process, which git-absorb doesn't currently do. Hence
this more conservative patch. I don't think it would be a big problem
though -- it's very unlikely git-absorb would ever be used without git
being available.

[1]: libgit2/libgit2#1528
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants