Fall back gracefully if user.{name,email} not set #22
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.