{"thread":{"id":"60874","subject":"Bug: Commit fails when no global email address is set even though --author is used","startedAt":"2024-02-08T15:26:04Z","lastAt":"2024-02-11T18:16:38Z","messageCount":13,"participants":["Marcus Tillmanns","Phillip Wood","Konstantin Khomoutov","Kristoffer Haugsbakk","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"488232","messageId":"F7D40DCD-2331-44D8-B4BF-8E6CD9EE64A6@qt.io","threadId":"60874","inReplyTo":null,"subject":"Bug: Commit fails when no global email address is set even though --author is used","fromName":"Marcus Tillmanns","fromEmail":"marcus.tillmanns@qt.io","sentAt":"2024-02-08T15:26:00Z","receivedAt":"2024-02-08T15:26:04Z","isPatch":false,"sender":{"key":"marcus.tillmanns@qt.io","avatar":"https://gravatar.com/avatar/d19e9fa7ed0177b097a7238733dad885474c1d7e17e81bd3ef92ad6443e12421?d=mp&s=160"},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\n\n* Set your machines hostname to a name that does not contain \".\" (e.g. \"ihavenodotinmyhostname\")\n* Make sure you have no name or email configured in your global git config\n* Create a new repository and \"git add\" a file\n* Run: git commit -m \"Test\" --author \"My Name <my@email.com>\"\n\nWhat did you expect to happen? (Expected behavior)\n\nA commit should be created with author name \"My Name\", and author email \"my@email.com\"\n\nWhat happened instead? (Actual behavior)\n\nAn error is thrown, complaining about not being able to determine the email address\n\nWhat's different between what you expected and what actually happened?\n\nThe email should have been taken from the \"--author\" argument, but instead the commit failed.\n\nAnything else you want to add:\n\nThis does not happen if your hostname contains a \".\", e.g. \"myhostname.local\"\n\n[System Info]\ngit version:\ngit version 2.40.1\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 6.5.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan  9 17:03:36 UTC 2024 x86_64\ncompiler info: gnuc: 12.3\nlibc info: glibc: 2.38\n$SHELL (typically, interactive shell): /bin/bash"},{"id":"488233","messageId":"51599394-3f75-4b75-a4c0-f13f117e73bc@gmail.com","threadId":"60874","inReplyTo":"F7D40DCD-2331-44D8-B4BF-8E6CD9EE64A6@qt.io","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2024-02-08T15:50:21Z","receivedAt":"2024-02-08T15:50:25Z","isPatch":false,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Marcus\n\nOn 08/02/2024 15:26, Marcus Tillmanns wrote:\n> What did you do before the bug happened? (Steps to reproduce your issue)\n> \n> * Set your machines hostname to a name that does not contain \".\" (e.g. \"ihavenodotinmyhostname\")\n> * Make sure you have no name or email configured in your global git config\n> * Create a new repository and \"git add\" a file\n> * Run: git commit -m \"Test\" --author \"My Name <my@email.com>\"\n> \n> What did you expect to happen? (Expected behavior)\n> \n> A commit should be created with author name \"My Name\", and author email \"my@email.com\"\n> \n> What happened instead? (Actual behavior)\n> \n> An error is thrown, complaining about not being able to determine the email address\n\nThis is expected as \"git commit\" needs an identity to use for the \ncommitter as well as for the author. To set the committer you can use \nthe GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL environment variables if \nyou don't have the relevant config set and git cannot extract a domain \nfrom your hostname.\n\nBest Wishes\n\nPhillip\n"},{"id":"488275","messageId":"60512662-9BE1-4DF7-A4E0-FD2E852E8E76@qt.io","threadId":"60874","inReplyTo":"51599394-3f75-4b75-a4c0-f13f117e73bc@gmail.com","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Marcus Tillmanns","fromEmail":"marcus.tillmanns@qt.io","sentAt":"2024-02-09T07:43:01Z","receivedAt":"2024-02-09T07:43:04Z","isPatch":false,"sender":{"key":"marcus.tillmanns@qt.io","avatar":"https://gravatar.com/avatar/d19e9fa7ed0177b097a7238733dad885474c1d7e17e81bd3ef92ad6443e12421?d=mp&s=160"},"body":"Uff, that’s a mean trap. Especially since there is no “—committer” option as far as I can see.\nAlso the difference between the two error messages is just one (the first) word.\n\nMaybe that could be made more obvious, especially if the user specifies “—author” already.\n\nThanks for the info!\n\n- Marcus \n\n> On 8. Feb 2024, at 16:50, Phillip Wood <phillip.wood123@gmail.com> wrote:\n> \n> [You don't often get email from phillip.wood123@gmail.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]\n> \n> Hi Marcus\n> \n> On 08/02/2024 15:26, Marcus Tillmanns wrote:\n>> What did you do before the bug happened? (Steps to reproduce your issue)\n>> \n>> * Set your machines hostname to a name that does not contain \".\" (e.g. \"ihavenodotinmyhostname\")\n>> * Make sure you have no name or email configured in your global git config\n>> * Create a new repository and \"git add\" a file\n>> * Run: git commit -m \"Test\" --author \"My Name <my@email.com>\"\n>> \n>> What did you expect to happen? (Expected behavior)\n>> \n>> A commit should be created with author name \"My Name\", and author email \"my@email.com\"\n>> \n>> What happened instead? (Actual behavior)\n>> \n>> An error is thrown, complaining about not being able to determine the email address\n> \n> This is expected as \"git commit\" needs an identity to use for the\n> committer as well as for the author. To set the committer you can use\n> the GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL environment variables if\n> you don't have the relevant config set and git cannot extract a domain\n> from your hostname.\n> \n> Best Wishes\n> \n> Phillip\n\n\n"},{"id":"488280","messageId":"20240209082133.jzldo5diog2fd4en@carbon","threadId":"60874","inReplyTo":"60512662-9BE1-4DF7-A4E0-FD2E852E8E76@qt.io","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Konstantin Khomoutov","fromEmail":"kostix@bswap.ru","sentAt":"2024-02-09T08:21:33Z","receivedAt":"2024-02-09T08:21:51Z","isPatch":false,"sender":{"key":"kostix@bswap.ru","avatar":null},"body":"On Fri, Feb 09, 2024 at 07:43:01AM +0000, Marcus Tillmanns wrote:\n\n> Uff, that’s a mean trap. Especially since there is no “--committer” option\n> as far as I can see. Also the difference between the two error messages is\n> just one (the first) word.\n> \n> Maybe that could be made more obvious, especially if the user specifies\n> “--author” already.\n\nThere's a way to specify the author and e-mail on the command-line during a\nsingle invocation:\n\n  git -c user.name=marcus -c user.email=user@example.com commit ...\n\nThis \"-c\" command-line option is explained in the \"root\" Git manual page\n(run `git help git` for instance).\n\nThe reasoning behind having different author and committer is that Git has\nbeen created to handle the development of Linux where most of the code flowed\n(and still does, I presume) in in the form of patches sent to a set of mailing\nlists, so the person creating a Git commit out of such a patch in most cases\nnot the person who has authored the change introduced by the patch (the\nauthor).\n\nAlso note that you do not have to set the name and e-mail globally: Git has\nthree levels of configuration, one of which is \"local\" meaning it's stored in\nthe repository's metadata. So you can basically run\n\n  git config --local --add user.name marcus\n\nto have this setting apply only to the repository which you \"are in\"\ncurrently. This value will override any \"global\" (per-user) settings and any\n\"system\" settings.\n\n"},{"id":"488282","messageId":"3c3db003-1506-47c4-a010-a8b783dff959@app.fastmail.com","threadId":"60874","inReplyTo":"60512662-9BE1-4DF7-A4E0-FD2E852E8E76@qt.io","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-02-09T08:37:12Z","receivedAt":"2024-02-09T08:37:36Z","isPatch":false,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"On Fri, Feb 9, 2024, at 08:43, Marcus Tillmanns wrote:\n> Uff, that’s a mean trap. Especially since there is no “—committer”\n> option as far as I can see.\n\nYour report would have been more clear if you included the error:\n\n```\n$ git commit -m \"Test\" --author \"My Name <my@email.com>\"\nCommitter identity unknown\n\n*** Please tell me who you are.\n\nRun\n\n  git config --global user.email \"you@example.com\"\n  git config --global user.name \"Your Name\"\n\nto set your account's default identity.\nOmit --global to set the identity only in this repository.\n\nfatal: unable to auto-detect email address (got '<machine>')\n```\n\nI guess there is no `--committer` since there are use-cases for\nattributing the commit to someone else (like you just received a\npatch or diff from someone) but there isn’t really a common use-case for\nattributing the committer to someone else—the point of the “committer”\nis to identify who did the commit itself.\n\nAnd the error tells you about something that you would want to do in any\ncase. Because passing in the committer with\n\n```\nGIT_COMMITTER_NAME\nGIT_COMMITTER_EMAIL\n```\n\nevery time is a lot of work.\n\nI guess the most common workflow is to configure your user globally. But\nit’s often the case that you might have a work identity (like the\nemail). What I do is to try to remember to configure it locally in those\nrepositories as well. But in the most recent case I forgot about it and\nhad to rewrite the commits. :) So an alternative is to not set any\nglobal user. And then you will get this complaint every time you start\nwork in a new repository:\n\n```\nCommitter identity unknown\n\n*** Please tell me who you are.\n```\n\nAnd then you can copy–paste one of your identities into the local\nconfig. And be certain that you won’t make any commits with the wrong\nidentity.\n\nThat’s more work but also safer.\n\nSo I guess that “Please tell me who you are” might be a part of some\npeoples’ usual repository setup workflow.\n\n-- \nKristoffer Haugsbakk\n"},{"id":"488283","messageId":"26317088-7020-43EF-8B60-41D719A6D145@qt.io","threadId":"60874","inReplyTo":"3c3db003-1506-47c4-a010-a8b783dff959@app.fastmail.com","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Marcus Tillmanns","fromEmail":"marcus.tillmanns@qt.io","sentAt":"2024-02-09T08:46:21Z","receivedAt":"2024-02-09T08:46:24Z","isPatch":false,"sender":{"key":"marcus.tillmanns@qt.io","avatar":"https://gravatar.com/avatar/d19e9fa7ed0177b097a7238733dad885474c1d7e17e81bd3ef92ad6443e12421?d=mp&s=160"},"body":"Everything you said is true. But it misses the point.\n\nIf I try to commit for the first time, don’t want to set the global config, look at man git-commit and search for “author\", it says “—author” to specify the author.\nSince “comitter” is such a hidden feature that even long time users of git don’t necessarily know about it, when I then specify “—author” and get the “same” error message again, I have no clue what’s going on, since I just specified my user name and email, and still I’m told it cannot be determined.\n\n\n\n> On 9. Feb 2024, at 09:37, Kristoffer Haugsbakk <code@khaugsbakk.name> wrote:\n> \n> On Fri, Feb 9, 2024, at 08:43, Marcus Tillmanns wrote:\n>> Uff, that’s a mean trap. Especially since there is no “—committer”\n>> option as far as I can see.\n> \n> Your report would have been more clear if you included the error:\n\nHad I had any idea that the report was different between with / without —author I probably would have added it, or found out what the issue was.\n\nCheers,\nMarcus\n\n"},{"id":"488285","messageId":"5c25da43-c886-41d2-b057-b95a84b107ba@app.fastmail.com","threadId":"60874","inReplyTo":"26317088-7020-43EF-8B60-41D719A6D145@qt.io","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-02-09T11:02:43Z","receivedAt":"2024-02-09T11:03:34Z","isPatch":false,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"On Fri, Feb 9, 2024, at 09:46, Marcus Tillmanns wrote:\n> Everything you said is true. But it misses the point.\n>\n> If I try to commit for the first time, don’t want to set the global\n> config, look at man git-commit and search for “author\", it says\n> “—author” to specify the author.\n\nThat reminds me of a mistake I once did. I was setting things up on a\ndifferent machine and I set `author.*` in my config. Then I got very\nconfused when `git commit` complained. I totally failed to see that I\nneed to set `user.*`, not `author.*`.\n\nIdeally I think I should have gotten this error:\n\n```\nCommitter identity unknown\n\nThe `author` config is set but not `committer`.\n\nDid you mean to set `user` (author and committer)?\n```\n\n> Since “comitter” is such a hidden feature that even long time users of\n> git don’t necessarily know about it, when I then specify “—author” and\n> get the “same” error message again, I have no clue what’s going on,\n> since I just specified my user name and email, and still I’m told it\n> cannot be determined.\n\nThis is a very good point. The _committer_ is pretty well-hidden in\nnormal workflows. And probably irrelevant.\n\nSo when a user gets this error:\n\n```\nCommitter identity unknown\n\n*** Please tell me who you are.\n```\n\nAnd have never heard of “committer” before… what is she to think? I\nthink it’s very natural to conclude that “author” and “committer” are\nthe same thing. So she thinks:\n\n  “ Okay, so the program is complaining about the author not being\n    set. (It calls it “committer” here for some reason.) But I have set\n    the author…\n\nMaybe this is another case of: it all makes perfect sense if you already\nknow all the concepts.\n\n>> Your report would have been more clear if you included the error:\n>\n> Had I had any idea that the report was different between with / without\n> —author I probably would have added it, or found out what the issue was.\n\nYou don’t know what you don’t know. That’s why it’s best to include all\ncontext.\n\nCheers\n\n-- \nKristoffer Haugsbakk\n"},{"id":"488306","messageId":"xmqqfry1h7ej.fsf@gitster.g","threadId":"60874","inReplyTo":"5c25da43-c886-41d2-b057-b95a84b107ba@app.fastmail.com","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-02-09T17:30:44Z","receivedAt":"2024-02-09T17:30:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Kristoffer Haugsbakk\" <code@khaugsbakk.name> writes:\n\n> So when a user gets this error:\n>\n> ```\n> Committer identity unknown\n>\n> *** Please tell me who you are.\n> ```\n>\n> And have never heard of “committer” before… what is she to think? I\n> think it’s very natural to conclude that “author” and “committer” are\n> the same thing. So she thinks:\n>\n>   “ Okay, so the program is complaining about the author not being\n>     set. (It calls it “committer” here for some reason.) But I have set\n>     the author…\n>\n> Maybe this is another case of: it all makes perfect sense if you already\n> know all the concepts.\n>\n>>> Your report would have been more clear if you included the error:\n>>\n>> Had I had any idea that the report was different between with / without\n>> —author I probably would have added it, or found out what the issue was.\n>\n> You don’t know what you don’t know. That’s why it’s best to include all\n> context.\n\nSo, now, let's be productive.  When somebody who does not know much\nabout Git tries to commit without configuring anything and hits the\nerror, what is a more appropriate message to guide who does not know\nwhat he or she does not know?\n\nThe user claims that \"committer identity unknown, please tell me who\nyou are\" were not helpful enough.  Would it make it more helpful if\nwe append how to \"tell who they are\" after that message, perhaps\nwith \"git config\" on user.email and user.name variables, or\nsomething?\n\nOr do we need three-way switch that does\n\n\tif (neither is known) {\n        \tprintf(\"neither author or committer is known\");\n\t} else if (author is known but committer is not known) {\n\t\tprintf(\"author is known but committer is not\"):\n\t} else if (author is not known but committer is known) {\n\t\tprintf(\"committer is known but author is not\"):\n\t} else {\n\t\treturn happy;\n\t}\n\n\tprintf(\"please tell us who you are...\");\n\nperhaps?\n"},{"id":"488307","messageId":"d59a0e25-81c4-4ecd-826e-ef4b23423575@app.fastmail.com","threadId":"60874","inReplyTo":"xmqqfry1h7ej.fsf@gitster.g","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-02-09T17:38:37Z","receivedAt":"2024-02-09T17:39:00Z","isPatch":false,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"On Fri, Feb 9, 2024, at 18:30, Junio C Hamano wrote:\n> So, now, let's be productive.  When somebody who does not know much\n> about Git tries to commit without configuring anything and hits the\n> error, what is a more appropriate message to guide who does not know\n> what he or she does not know?\n>\n> The user claims that \"committer identity unknown, please tell me who\n> you are\" were not helpful enough.  Would it make it more helpful if\n> we append how to \"tell who they are\" after that message, perhaps\n> with \"git config\" on user.email and user.name variables, or\n> something?\n>\n> Or do we need three-way switch that does\n>\n> \tif (neither is known) {\n>         \tprintf(\"neither author or committer is known\");\n> \t} else if (author is known but committer is not known) {\n> \t\tprintf(\"author is known but committer is not\"):\n> \t} else if (author is not known but committer is known) {\n> \t\tprintf(\"committer is known but author is not\"):\n> \t} else {\n> \t\treturn happy;\n> \t}\n>\n> \tprintf(\"please tell us who you are...\");\n>\n> perhaps?\n\nI think a three-way switch looks good. With the amendment that it steers\nyou towards `user.*` instead of setting both `author.*` and\n`committer.*`.\n\nSomething like\n\n• Author is set, not committer\n  • Message: author is set but not committer: you might want to set\n    *user* instead (prints suggested config)\n\nI can try to make a patch later.\n\n-- \nKristoffer Haugsbakk\n\n"},{"id":"488314","messageId":"xmqqfry1fm2e.fsf@gitster.g","threadId":"60874","inReplyTo":"d59a0e25-81c4-4ecd-826e-ef4b23423575@app.fastmail.com","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-02-09T19:56:57Z","receivedAt":"2024-02-09T19:57:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Kristoffer Haugsbakk\" <code@khaugsbakk.name> writes:\n\n> On Fri, Feb 9, 2024, at 18:30, Junio C Hamano wrote:\n>> So, now, let's be productive.  When somebody who does not know much\n>> about Git tries to commit without configuring anything and hits the\n>> error, what is a more appropriate message to guide who does not know\n>> what he or she does not know?\n>>\n>> The user claims that \"committer identity unknown, please tell me who\n>> you are\" were not helpful enough.  Would it make it more helpful if\n>> we append how to \"tell who they are\" after that message, perhaps\n>> with \"git config\" on user.email and user.name variables, or\n>> something?\n>>\n>> Or do we need three-way switch that does\n>>\n>> \tif (neither is known) {\n>>         \tprintf(\"neither author or committer is known\");\n>> \t} else if (author is known but committer is not known) {\n>> \t\tprintf(\"author is known but committer is not\"):\n>> \t} else if (author is not known but committer is known) {\n>> \t\tprintf(\"committer is known but author is not\"):\n>> \t} else {\n>> \t\treturn happy;\n>> \t}\n>>\n>> \tprintf(\"please tell us who you are...\");\n>>\n>> perhaps?\n>\n> I think a three-way switch looks good. With the amendment that it steers\n> you towards `user.*` instead of setting both `author.*` and\n> `committer.*`.\n>\n> Something like\n>\n> • Author is set, not committer\n>   • Message: author is set but not committer: you might want to set\n>     *user* instead (prints suggested config)\n>\n> I can try to make a patch later.\n\nWait. I didn't realize this when I wrote the message you are\nresponding to, but we *do* already suggest settig user.* variables.\n\nIf the user chose to ignore that, then there isn't much we can do to\nhelp, is there?\n\nPuzzled, but I'll stop here.\n\n"},{"id":"488346","messageId":"8DDFD548-1540-4E41-8AA3-84E273372F01@qt.io","threadId":"60874","inReplyTo":"xmqqfry1fm2e.fsf@gitster.g","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Marcus Tillmanns","fromEmail":"marcus.tillmanns@qt.io","sentAt":"2024-02-10T09:42:25Z","receivedAt":"2024-02-10T09:42:28Z","isPatch":false,"sender":{"key":"marcus.tillmanns@qt.io","avatar":"https://gravatar.com/avatar/d19e9fa7ed0177b097a7238733dad885474c1d7e17e81bd3ef92ad6443e12421?d=mp&s=160"},"body":"For me the issue was that I knew already about the global config setting, but in my case I specifically did not want to set that.\n\nWhat pulled my attention away from the important part was the huge wall of text about how to setup global stuff etc, making the single word in the top left basically invisible to my eye. I was thinking \"I already knew all that, I’ve set the author, so you complaining still with the same error message must be a bug”.\n\nI think, if a user tries to commit with “—author”, and git fails to figure out the comitter, it should have a specific error message about “hey, you’ve set the author, but we still have to figure out whom to set as the committer, or you can use “—authorAndComitter” if they should be the same”.\n\nThat would make it obvious to the user what’s going on.\n\nCheers,\nMarcus\n\n\n> On 9. Feb 2024, at 20:56, Junio C Hamano <gitster@pobox.com> wrote:\n> \n> [You don't often get email from gitster@pobox.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]\n> \n> \"Kristoffer Haugsbakk\" <code@khaugsbakk.name> writes:\n> \n>> On Fri, Feb 9, 2024, at 18:30, Junio C Hamano wrote:\n>>> So, now, let's be productive.  When somebody who does not know much\n>>> about Git tries to commit without configuring anything and hits the\n>>> error, what is a more appropriate message to guide who does not know\n>>> what he or she does not know?\n>>> \n>>> The user claims that \"committer identity unknown, please tell me who\n>>> you are\" were not helpful enough.  Would it make it more helpful if\n>>> we append how to \"tell who they are\" after that message, perhaps\n>>> with \"git config\" on user.email and user.name variables, or\n>>> something?\n>>> \n>>> Or do we need three-way switch that does\n>>> \n>>>     if (neither is known) {\n>>>             printf(\"neither author or committer is known\");\n>>>     } else if (author is known but committer is not known) {\n>>>             printf(\"author is known but committer is not\"):\n>>>     } else if (author is not known but committer is known) {\n>>>             printf(\"committer is known but author is not\"):\n>>>     } else {\n>>>             return happy;\n>>>     }\n>>> \n>>>     printf(\"please tell us who you are...\");\n>>> \n>>> perhaps?\n>> \n>> I think a three-way switch looks good. With the amendment that it steers\n>> you towards `user.*` instead of setting both `author.*` and\n>> `committer.*`.\n>> \n>> Something like\n>> \n>> • Author is set, not committer\n>>  • Message: author is set but not committer: you might want to set\n>>    *user* instead (prints suggested config)\n>> \n>> I can try to make a patch later.\n> \n> Wait. I didn't realize this when I wrote the message you are\n> responding to, but we *do* already suggest settig user.* variables.\n> \n> If the user chose to ignore that, then there isn't much we can do to\n> help, is there?\n> \n> Puzzled, but I'll stop here.\n> \n\n"},{"id":"488359","messageId":"xmqqo7cob5h5.fsf@gitster.g","threadId":"60874","inReplyTo":"8DDFD548-1540-4E41-8AA3-84E273372F01@qt.io","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-02-10T17:21:10Z","receivedAt":"2024-02-10T17:21:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcus Tillmanns <Marcus.Tillmanns@qt.io> writes:\n\n> For me the issue was that I knew already about the global config\n> setting, but in my case I specifically did not want to set that.\n>\n> What pulled my attention away from the important part was the huge\n> wall of text about how to setup global stuff etc, making the\n> single word in the top left basically invisible to my eye. I was\n> thinking \"I already knew all that, I’ve set the author, so you\n> complaining still with the same error message must be a bug”.\n>\n> I think, if a user tries to commit with “—author”, and git\n> fails to figure out the comitter, it should have a specific error\n> message about “hey, you’ve set the author, but we still have to\n> figure out whom to set as the committer, or you can use\n> “—authorAndComitter” if they should be the same”.\n>\n> That would make it obvious to the user what’s going on.\n\nI guess so, provided that such an additional text would not trigger\nthe \"I missed due to the huge wall of text\" again.  So in short, you\nare saying that the three-way message would help?\n\nCan I get you intereseted enough to care to come up with a patch\n;-)?\n\nThanks.\n\n>>>> Or do we need three-way switch that does\n>>>> \n>>>>     if (neither is known) {\n>>>>             printf(\"neither author or committer is known\");\n>>>>     } else if (author is known but committer is not known) {\n>>>>             printf(\"author is known but committer is not\"):\n>>>>     } else if (author is not known but committer is known) {\n>>>>             printf(\"committer is known but author is not\"):\n>>>>     } else {\n>>>>             return happy;\n>>>>     }\n>>>> \n>>>>     printf(\"please tell us who you are...\");\n>>>> \n>>>> perhaps?\n"},{"id":"488407","messageId":"9c22f49a-538b-41eb-bdce-39e547c614ef@app.fastmail.com","threadId":"60874","inReplyTo":"xmqqfry1fm2e.fsf@gitster.g","subject":"Re: Bug: Commit fails when no global email address is set even though --author is used","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2024-02-11T18:16:05Z","receivedAt":"2024-02-11T18:16:38Z","isPatch":false,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"On Fri, Feb 9, 2024, at 20:56, Junio C Hamano wrote:\n>> I think a three-way switch looks good. With the amendment that it steers\n>> you towards `user.*` instead of setting both `author.*` and\n>> `committer.*`.\n>>\n>> Something like\n>>\n>> • Author is set, not committer\n>>   • Message: author is set but not committer: you might want to set\n>>     *user* instead (prints suggested config)\n>>\n>> I can try to make a patch later.\n>\n> Wait. I didn't realize this when I wrote the message you are\n> responding to, but we *do* already suggest settig user.* variables.\n>\n> If the user chose to ignore that, then there isn't much we can do to\n> help, is there?\n>\n> Puzzled, but I'll stop here.\n\nAye, good point. Maybe I misremembered and/or didn’t look carefully\nenough at the error message back when I set `author.*` instead of\n`user.*`.\n\nMaybe the error could say (back to the multi-way switch):\n\n```\nAuthor identity known, but committer identity unknown\n\n*** Please tell me who you are.\n\nRun\n\n  git config --global user.email \"code@khaugsbakk.name\"\n  git config --global user.name \"Kristoffer Haugsbakk\"\n\nto set your account's default identity.\nOmit --global to set the identity only in this repository.\n\nfatal: empty ident name (for <>) not allowed\n```\n\nAnd then (see above) fill in the real information in the proposed config\ncommands if the other identity is known. Maybe that could be\naccomplished with one more parameter to `ident_env_hint`:\n\n```\nstatic void ident_env_hint(enum want_ident whose_ident, char *other_ident)\n```\n\n(turned out to be a bit more tricky than I thought)\n\nBut that’s a slightly longer error message, which (again) can cause the\nalready-discussed glaze-over effect caused by the “wall of text”.\n\n-- \nKristoffer Haugsbakk\n\n"}]}