git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] allow user aliases for the --author parameter

From
Michael J Gruber <michaeljgruber+gmane@fastmail.fm>
Date
Aug 27, 2008, 09:36 UTC
Message-ID
<48B52037.7030405@fastmail.fm>
In-Reply-To
<7v7ia3rnnq.fsf@gitster.siamese.dyndns.org>
Junio C Hamano venit, vidit, dixit 27.08.2008 08:13:
Show 17 quoted lines
> Jeff King <peff@peff.net> writes:
> 
>> On Tue, Aug 26, 2008 at 04:31:30PM -0700, Junio C Hamano wrote:
>>
>>>> This allows the use of author abbreviations when specifying commit
>>>> authors via the --author option to git commit. "--author=$key" is
>>>> resolved by looking up "user.$key.name" and "user.$key.email" in the
>>>> config.
>>> Maybe it is just me, but I am hesitant about the contamination of user.*
>>> configuration namespace.  This patch as a general solution does not scale
>>> well, once you start working with more than a few dozen people.
>> It is not just you. I think this version of the patch is much improved,
>> but I am still against user.$key.*. At the very least, it needs its own
>> namespace.
> 
> It's not just that.  Having many of these in .git/config will slow down
> any unrelated thing that needs to read from config.

I don't see a namespace problem as long as nobody uses "name" or "email" as $key. That said I'd suggest useralias.$key.{name,email} then which gives a cleaner separation and leaves the possibility to

- use the alias for other cases than --author
- use other fields than name, email
at a later time.
> I am not married to the "reuse existing information" idea, but doing it
> the way this sample patch does at least makes only people who uses this
> feature to pay the price and only when they use it.

People who don't use this feature don't have any entries and don't pay anything. People who use this feature and have a moderate number of entries don't pay a recognizable price. People who use this feature and have a vast amount of entries should be told to implement an alias file parser ;)

> Not extensively tested, beyond the usual test suite, and using it for real
> only once to commit this with "git commit --author=Jeff".  I wanted to say
> "Michael J" instead, but there is this little chicken-and-egg problem ;-)
[patch snipped]

I'd be happy with that approach as well for my use case. In general it may suffer from the uniqueness problem: If there's a recent commit authored by "Michael@Jeff.com" your "--author=Jeff" will resolve differently from yesterday, and you won't even notice (not even commit -v tells you). [ A typo is punished by a search through all commits; that's fine.]

But I won't compete with an alternative patch from The Man, of course ;)

+ die("No existing author found with '%s'", name); Minor suggestion: "...or malformed --author parameter" I foresee questions like "Huh? What does it mean not existing" when people don't get the A U Thor <author@example.com> format right.

Michael
Previous: Junio C HamanoNext: Jeff King
Message 16 of 32 in “allow user aliases for the --author parameter”
  1. allow user aliases for the --author parameterMichael J Gruber, Aug 21, 2008
  2. Miklos VajnaAug 21, 2008
  3. Michael J GruberAug 21, 2008
  4. Alex RiesenAug 21, 2008
  5. Alex RiesenAug 21, 2008
  6. Jeff KingAug 21, 2008
  7. Junio C HamanoAug 22, 2008
  8. Michael J GruberAug 22, 2008
  9. Jeff KingAug 22, 2008
  10. Junio C HamanoAug 22, 2008
  11. Jeff KingAug 22, 2008
  12. allow user aliases for the --author parameterMichael J Gruber, Aug 26, 2008
  13. Junio C HamanoAug 26, 2008
  14. Jeff KingAug 27, 2008
  15. Junio C HamanoAug 27, 2008
  16. Michael J GruberAug 27, 2008
  17. Jeff KingAug 27, 2008
  18. Jeff KingAug 27, 2008
  19. Junio C HamanoAug 27, 2008
  20. Pedro MeloAug 24, 2008
  21. Jeff KingAug 24, 2008
  22. fix "git log -i --grep"Jeff King, Aug 25, 2008
  23. format-patch: use default diff format even with patch optionsJeff King, Aug 25, 2008
  24. Junio C HamanoAug 25, 2008
  25. Junio C HamanoAug 25, 2008
  26. Jeff KingAug 25, 2008
  27. Jeff KingAug 25, 2008
  28. Junio C HamanoAug 25, 2008
  29. Jeff KingAug 27, 2008
  30. Michael J GruberAug 28, 2008
  31. Jeff KingAug 28, 2008
  32. Jeff KingAug 28, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.