Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

plumbing: fix signature with > before < parsing #204

Merged
merged 1 commit into from
Jan 9, 2017
Merged

plumbing: fix signature with > before < parsing #204

merged 1 commit into from
Jan 9, 2017

Conversation

mcuadros
Copy link
Contributor

@mcuadros mcuadros commented Jan 9, 2017

This is a fix for issue: #202

Since the fullname is free text, given a foo> the result was a panic, now this is handled properly returning foo> as the fullname. Another extra security guards was added to protect the function against malformed signatures.

@mcuadros mcuadros merged commit 92d3de7 into src-d:master Jan 9, 2017
@ajnavarro
Copy link
Contributor

If the email address is crap, this crap will be extended to the committer name:

`Foo Bar <foo>@bar.com>`: {
	Name:  "Foo Bar",
	Email: "foo>@bar.com",
	When:  time.Time{},
},
// ... obtained string = "Foo Bar <foo"
// ... expected string = "Foo Bar"
`Foo Bar <foo<@bar.com>`: {
	Name:  "Foo Bar",
	Email: "foo<@bar.com",
	When:  time.Time{},
},
// ... obtained string = "Foo Bar <foo"
// ... expected string = "Foo Bar"

@smola
Copy link
Collaborator

smola commented Jan 9, 2017

We've checked the behavior of git and it's as follows:

  • When generating commits, < and > symbols are removed (no matter their position). Both for name and email.
  • When reading, different operations have slightly different behaviours For example, git log prints almost the original output (no normalization), but git log --pretty='%an|%ae', which actually fully parses the signature has the following behaviour:
    • foo <my<@email.com> is parsed as name foo and email my<@email.com.
    • foo <my>@email.com> is parsed as name foo and email my.

Here's the original source in git: https://github.com/git/git/blob/3ef7618e616e023cf04180e30d77c9fa5310f964/ident.c#L250
we might want to replicate the same or similar logic for name splitting.

mcuadros added a commit that referenced this pull request Jan 31, 2017
gsalingu-ovhus pushed a commit to gsalingu-ovhus/go-git that referenced this pull request Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants