gitmail icon indicating copy to clipboard operation
gitmail copied to clipboard

Only gets email addresses from commits reachable from the current head.

Open MrJoy opened this issue 9 years ago • 2 comments

Add --all to the git log command to get a more complete view of things.

There's also --walk-reflogs if you want to find output from commits not currently reachable from any branches (although that's not likely relevant for a clean clone operation) but this is mutually exclusive with other options and so the output needs to be combined with the output of git log --all to be truly comprehensive.

MrJoy avatar Mar 16 '16 02:03 MrJoy

I like this idea, but I've found that it seems to create weird repeated emails sometimes. For example, when I run that on icco/resume, it returns both "Nat Welch [email protected]" and "[email protected] [email protected]". I'm not sure if this is just an isolated example where the user by accident set their name to be their email or if it might apply in other cases as well. Until I've figured out which case it is I'm gonna hold off on adding it (though I suspect it was just user error and it should be fine to add).

levthedev avatar Mar 16 '16 18:03 levthedev

That error is entirely possible even without this change. Any time a user makes a change to one (but not both) of username / email address in their git config and then creates a new commit, you will see output like this.

One solution would be something like the following:

raw = `git log --pretty="%ae %an%n%ce %cn"`
      .strip
      .split("\n")
      .map { |line| line.split(" ", 2) }
      .each_with_object({}) { |(email, name), hsh| (hsh[email] ||= []) << name }
# ... then `.sort.uniq` on each list of names
# ... then remove any name that appears in `raw.keys`
# ... then output email with each possible name.

(Sorry, operating from my email client so don't have a chance to suss this out in more detail at the moment...)

On Mar 16, 2016, at 11:33 AM, Lev Kravinsky [email protected] wrote:

I like this idea, but I've found that it seems to create weird repeated emails sometimes. For example, when I run that on icco/resume, it returns both "Nat Welch [email protected] mailto:[email protected]" and "[email protected] mailto:[email protected] [email protected] mailto:[email protected]". I'm not sure if this is just an isolated example where the user by accident set their name to be their email or if it might apply in other cases as well. Until I've figured out which case it is I'm gonna hold off on adding it (though I suspect it was just user error and it should be fine to add).

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/levthedev/GitMail/issues/5#issuecomment-197476196

MrJoy avatar Mar 16 '16 18:03 MrJoy