{"thread":{"id":"3197","subject":"[Cogito] Various bugs","startedAt":"2006-01-31T04:13:18Z","lastAt":"2006-02-07T20:49:34Z","messageCount":10,"participants":["Jonas Fonseca","Petr Baudis","Junio C Hamano","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"15282","messageId":"20060131041318.GC30744@diku.dk","threadId":"3197","inReplyTo":null,"subject":"[Cogito] Various bugs","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2006-01-31T04:13:18Z","receivedAt":"2006-01-31T04:13:18Z","isPatch":false,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"A few Cogito bugs I found yesterday.\n\n - cg-fetch between local repos fails when the cloned branch URL does\n   not point to a .git directory and a needed object from the repository\n   being cloned is packed. git-local-fetch expects a .git directory.\n\n - cg-commit -c will do the wrong thing (use the invokers gecos info)\n   when the author name is empty. One workaround is to make\n   pick_author_script append a space at the end of the GIT_* variables.\n   GIT will strip those and no gecos info is used.\n\n - cg-status reports a deleted file both as deleted and as unknown:\n\n\tfonseca@antimatter:~/src/elinks/0.12 > git --version\n\tgit version 1.1.6.g1506\n\tfonseca@antimatter:~/src/elinks/0.12 > cg --version\n\tcogito-0.17pre.GIT (d3aa9a2b3375e36c774ea477492db76baa1db03e)\n\tfonseca@antimatter:~/src/elinks/0.12 > cg rm AUTHORS\n\tRemoving file AUTHORS\n\tfonseca@antimatter:~/src/elinks/0.12 > cg status | grep AUTHORS\n\t? AUTHORS\n\tD AUTHORS\n\n-- \nJonas Fonseca\n"},{"id":"15651","messageId":"20060207003643.GJ31278@pasky.or.cz","threadId":"3197","inReplyTo":"20060131041318.GC30744@diku.dk","subject":"Re: [Cogito] Various bugs","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-02-07T00:36:43Z","receivedAt":"2006-02-07T00:36:43Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Jan 31, 2006 at 05:13:18AM CET, I got a letter\nwhere Jonas Fonseca <fonseca@diku.dk> said that...\n> A few Cogito bugs I found yesterday.\n> \n>  - cg-fetch between local repos fails when the cloned branch URL does\n>    not point to a .git directory and a needed object from the repository\n>    being cloned is packed. git-local-fetch expects a .git directory.\n\nCan't reproduce and I don't buy it. The very first line of local fetch\nhandler is\n\n\t[ -d \"$uri/.git\" ] && uri=\"$uri/.git\"\n\n>  - cg-commit -c will do the wrong thing (use the invokers gecos info)\n>    when the author name is empty. One workaround is to make\n>    pick_author_script append a space at the end of the GIT_* variables.\n>    GIT will strip those and no gecos info is used.\n\nI'd rather fix this in GIT than workaround in Cogito. Will follow up\nwith a patch.\n\n...\nHmm.\n...\n\nI'm puzzled. GIT should handle this fine.\n\n\texport GIT_AUTHOR_NAME=''\n\tgit-commit-tree $(cg-object-id -t)\n\nworks as expected, but for some reason escaping me it does not work\ninside of cg-commit. Insights welcomed.\n\n>  - cg-status reports a deleted file both as deleted and as unknown:\n> \n> \tfonseca@antimatter:~/src/elinks/0.12 > git --version\n> \tgit version 1.1.6.g1506\n> \tfonseca@antimatter:~/src/elinks/0.12 > cg --version\n> \tcogito-0.17pre.GIT (d3aa9a2b3375e36c774ea477492db76baa1db03e)\n> \tfonseca@antimatter:~/src/elinks/0.12 > cg rm AUTHORS\n> \tRemoving file AUTHORS\n> \tfonseca@antimatter:~/src/elinks/0.12 > cg status | grep AUTHORS\n> \t? AUTHORS\n> \tD AUTHORS\n\nThis is fine, I'd say. The file was not deleted from the tree, either do\nthat manually by rm or say cg-rm -f.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nOf the 3 great composers Mozart tells us what it's like to be human,\nBeethoven tells us what it's like to be Beethoven and Bach tells us\nwhat it's like to be the universe.  -- Douglas Adams\n"},{"id":"15653","messageId":"7vfymw3oym.fsf@assigned-by-dhcp.cox.net","threadId":"3197","inReplyTo":"20060207003643.GJ31278@pasky.or.cz","subject":"Re: [Cogito] Various bugs","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-07T02:03:13Z","receivedAt":"2006-02-07T02:03:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> I'm puzzled. GIT should handle this fine.\n>\n> \texport GIT_AUTHOR_NAME=''\n> \tgit-commit-tree $(cg-object-id -t)\n>\n> works as expected, but for some reason escaping me it does not work\n> inside of cg-commit. Insights welcomed.\n\nThey probably do not have anything to do with the problem at\nhand, but I just noticed your version of pick-author code in\ncg-commit lacks two changes I added to git-commit:\n\n (1) the pick_author_script you have in cg-commit lacks the\n     support for names with single-quotes in them\n     (aa66c7ec77d474b737da607d6cb2d07f56628def).\n\n (2) I run the sed script with LANG and LC_ALL set to C locale.\n     I think I had some trouble without them with high-bit\n     names, (e3e291fc07b49b74bb655ca854bdb19e849e044c) but the\n     detail escapes me.\n"},{"id":"15654","messageId":"20060207021006.GM31278@pasky.or.cz","threadId":"3197","inReplyTo":"7vfymw3oym.fsf@assigned-by-dhcp.cox.net","subject":"Re: [Cogito] Various bugs","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-02-07T02:10:06Z","receivedAt":"2006-02-07T02:10:06Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Feb 07, 2006 at 03:03:13AM CET, I got a letter\nwhere Junio C Hamano <junkio@cox.net> said that...\n> Petr Baudis <pasky@suse.cz> writes:\n> \n> > I'm puzzled. GIT should handle this fine.\n> >\n> > \texport GIT_AUTHOR_NAME=''\n> > \tgit-commit-tree $(cg-object-id -t)\n> >\n> > works as expected, but for some reason escaping me it does not work\n> > inside of cg-commit. Insights welcomed.\n> \n> They probably do not have anything to do with the problem at\n> hand, but I just noticed your version of pick-author code in\n> cg-commit lacks two changes I added to git-commit:\n> \n>  (1) the pick_author_script you have in cg-commit lacks the\n>      support for names with single-quotes in them\n>      (aa66c7ec77d474b737da607d6cb2d07f56628def).\n> \n>  (2) I run the sed script with LANG and LC_ALL set to C locale.\n>      I think I had some trouble without them with high-bit\n>      names, (e3e291fc07b49b74bb655ca854bdb19e849e044c) but the\n>      detail escapes me.\n\nThanks, I've updated the cg-commit version. Note that the empty\nGIT_AUTHOR_NAME problem seems to exist in git-commit as well.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nOf the 3 great composers Mozart tells us what it's like to be human,\nBeethoven tells us what it's like to be Beethoven and Bach tells us\nwhat it's like to be the universe.  -- Douglas Adams\n"},{"id":"15656","messageId":"7v8xsn50rf.fsf@assigned-by-dhcp.cox.net","threadId":"3197","inReplyTo":"20060207021006.GM31278@pasky.or.cz","subject":"Re: [Cogito] Various bugs","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-07T03:03:00Z","receivedAt":"2006-02-07T03:03:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n>> > I'm puzzled. GIT should handle this fine.\n>> >\n>> > \texport GIT_AUTHOR_NAME=''\n>> > \tgit-commit-tree $(cg-object-id -t)\n>> >\n>> > works as expected, but for some reason escaping me it does not work\n>> > inside of cg-commit. Insights welcomed.\n>> ...\n> Thanks, I've updated the cg-commit version. Note that the empty\n> GIT_AUTHOR_NAME problem seems to exist in git-commit as well.\n\nIt depends on what you expect, but it meets _my_ expectation:\n\n    $ GIT_AUTHOR_NAME='' git-commit-tree $(git-write-tree) </dev/null\n    Committing initial tree a2b59c3848164a2c9c3c75fbaadccaed9485da92\n    ef90563fa278735af367e7606ea7eb2559121ca7\n    $ git-cat-file commit ef90563fa278735af367e7606ea7eb2559121ca7\n    tree a2b59c3848164a2c9c3c75fbaadccaed9485da92\n    author  <junkio@cox.net> 1139281078 -0800\n    committer Junio C Hamano <junkio@cox.net> 1139281078 -0800\n\nThat is, the user said GIT_AUTHOR_NAME is empty, so he gets a\ncommit with an empty author name.\n\nget_ident() in ident.c does this. getenv(\"GIT_AUTHOR_NAME\") and\nfriends are passed to it, and git_default_* are takenfrom gecos.\nIt might match some peoples' expectation (but not mine) if we\ndid this instead.\n\n\ndiff --git a/ident.c b/ident.c\nindex 0461b8b..7ec7516 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -163,9 +163,9 @@ static const char *get_ident(const char \n \tchar date[50];\n \tint i;\n \n-\tif (!name)\n+\tif (!name || !*name)\n \t\tname = git_default_name;\n-\tif (!email)\n+\tif (!email || !*email)\n \t\temail = git_default_email;\n \tstrcpy(date, git_default_date);\n \tif (date_str)\n"},{"id":"15672","messageId":"20060207135537.GB9462@diku.dk","threadId":"3197","inReplyTo":"20060207003643.GJ31278@pasky.or.cz","subject":"Re: [Cogito] Various bugs","fromName":"Jonas Fonseca","fromEmail":"fonseca@diku.dk","sentAt":"2006-02-07T13:55:37Z","receivedAt":"2006-02-07T13:55:37Z","isPatch":false,"sender":{"key":"fonseca@diku.dk","avatar":"https://gravatar.com/avatar/f82f3ad698717c51873b020c750a92438c820a24056dc39fe4d07baa10a92264?d=mp&s=160"},"body":"Petr Baudis <pasky@suse.cz> wrote Tue, Feb 07, 2006:\n> Dear diary, on Tue, Jan 31, 2006 at 05:13:18AM CET, I got a letter\n> where Jonas Fonseca <fonseca@diku.dk> said that...\n> > A few Cogito bugs I found yesterday.\n> > \n> >  - cg-fetch between local repos fails when the cloned branch URL does\n> >    not point to a .git directory and a needed object from the repository\n> >    being cloned is packed. git-local-fetch expects a .git directory.\n> \n> Can't reproduce and I don't buy it. The very first line of local fetch\n> handler is\n> \n> \t[ -d \"$uri/.git\" ] && uri=\"$uri/.git\"\n\nI cannot reproduce it either and my strace file is long gone thanks to\ncg-clean. Come to think of it it might have been caused by a pack file\nnot following the more strict name rules which recently was introduced\nin GIT.\n\n> >  - cg-status reports a deleted file both as deleted and as unknown:\n> > \n> > \tfonseca@antimatter:~/src/elinks/0.12 > git --version\n> > \tgit version 1.1.6.g1506\n> > \tfonseca@antimatter:~/src/elinks/0.12 > cg --version\n> > \tcogito-0.17pre.GIT (d3aa9a2b3375e36c774ea477492db76baa1db03e)\n> > \tfonseca@antimatter:~/src/elinks/0.12 > cg rm AUTHORS\n> > \tRemoving file AUTHORS\n> > \tfonseca@antimatter:~/src/elinks/0.12 > cg status | grep AUTHORS\n> > \t? AUTHORS\n> > \tD AUTHORS\n> \n> This is fine, I'd say. The file was not deleted from the tree, either do\n> that manually by rm or say cg-rm -f.\n\nYes, I guess you are right, this is a special case. But I think it needs\nto be noted that this is 'normal'. Something like this vague patch\nsigned-off-by me.\n\ndiff --git a/cg-status b/cg-status\nindex 6abc52f..d38c61f 100755\n--- a/cg-status\n+++ b/cg-status\n@@ -21,12 +21,12 @@\n # D::\n #\t'<file>' has been deleted.\n # !::\n-#\t'<file>' is gone from your working copy but not deleted by cg-rm.\n+#\t'<file>' is gone from your working copy but not deleted by `cg-rm`.\n # M::\n #\t'<file>' has been touched or modified.\n # m::\n #\t'<file>' has been touched or modified, but will not be automatically\n-#\tcommitted the next time you call cg-commit. This is used during a\n+#\tcommitted the next time you call `cg-commit`. This is used during a\n #\tmerge to mark files which contained local changes before the merge.\n #\n # OPTIONS\n@@ -55,6 +55,14 @@\n #\tPath to the directory to use as the base for the working tree\n #\tfile list (instead of the current directory).\n #\n+# NOTES\n+# -----\n+# If a file has been removed with `cg-rm` without using the `-f` option\n+# to remove it physically from the tree it will be reported as both being\n+# deleted and unknown. The reason for this is that the file is internally\n+# marked as deleted and thus also untracked. After next commit it will only\n+# be reported as being untracked.\n+#\n # FILES\n # -----\n # $GIT_DIR/info/exclude::\n\n-- \nJonas Fonseca\n"},{"id":"15674","messageId":"Pine.LNX.4.64.0602070751410.3854@g5.osdl.org","threadId":"3197","inReplyTo":"7v8xsn50rf.fsf@assigned-by-dhcp.cox.net","subject":"Re: [Cogito] Various bugs","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-07T15:53:57Z","receivedAt":"2006-02-07T15:53:57Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 6 Feb 2006, Junio C Hamano wrote:\n> \n> It depends on what you expect, but it meets _my_ expectation:\n> \n>     $ GIT_AUTHOR_NAME='' git-commit-tree $(git-write-tree) </dev/null\n>     Committing initial tree a2b59c3848164a2c9c3c75fbaadccaed9485da92\n>     ef90563fa278735af367e7606ea7eb2559121ca7\n>     $ git-cat-file commit ef90563fa278735af367e7606ea7eb2559121ca7\n>     tree a2b59c3848164a2c9c3c75fbaadccaed9485da92\n>     author  <junkio@cox.net> 1139281078 -0800\n>     committer Junio C Hamano <junkio@cox.net> 1139281078 -0800\n> \n> That is, the user said GIT_AUTHOR_NAME is empty, so he gets a\n> commit with an empty author name.\n\nYes. That said, we should probably disallow that in git-commit-tree (and \nlet the user fix it up some way).\n\n> get_ident() in ident.c does this. getenv(\"GIT_AUTHOR_NAME\") and\n> friends are passed to it, and git_default_* are takenfrom gecos.\n> It might match some peoples' expectation (but not mine) if we\n> did this instead.\n\nNo, don't use the default name.\n\nAn empty GIT_AUTHOR_NAME should _not_ mean that we use the default name \n(which is usually the committer), because rather than meaning \"default\", \nit most likely means \"buggy import script\". \n\nI'd rather have an email import of mine say that it cannot commit, than \nhave it put \"Linus Torvalds\" in the author line (and some random email).\n\n\t\t\tLinus\n"},{"id":"15675","messageId":"20060207164946.GN31278@pasky.or.cz","threadId":"3197","inReplyTo":"Pine.LNX.4.64.0602070751410.3854@g5.osdl.org","subject":"Re: [Cogito] Various bugs","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-02-07T16:49:46Z","receivedAt":"2006-02-07T16:49:46Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Tue, Feb 07, 2006 at 04:53:57PM CET, I got a letter\nwhere Linus Torvalds <torvalds@osdl.org> said that...\n> \n> \n> On Mon, 6 Feb 2006, Junio C Hamano wrote:\n> > \n> > It depends on what you expect, but it meets _my_ expectation:\n> > \n> >     $ GIT_AUTHOR_NAME='' git-commit-tree $(git-write-tree) </dev/null\n> >     Committing initial tree a2b59c3848164a2c9c3c75fbaadccaed9485da92\n> >     ef90563fa278735af367e7606ea7eb2559121ca7\n> >     $ git-cat-file commit ef90563fa278735af367e7606ea7eb2559121ca7\n> >     tree a2b59c3848164a2c9c3c75fbaadccaed9485da92\n> >     author  <junkio@cox.net> 1139281078 -0800\n> >     committer Junio C Hamano <junkio@cox.net> 1139281078 -0800\n> > \n> > That is, the user said GIT_AUTHOR_NAME is empty, so he gets a\n> > commit with an empty author name.\n\nThat is what I expect and I must have done something wrong the last\nnight since it works for me now as well. Sorry. So I'm all alone at\nthis bug again. ;-)\n\n> Yes. That said, we should probably disallow that in git-commit-tree (and \n> let the user fix it up some way).\n\nWhat way? Sometimes you just receive mails from people who have only\nemail addy in the from line, or you can be importing from some other VCS\nwhere the mapping does not exist and the importers may not deem it\nnecessary to have it in GIT. Sure, it may be kernel policy to disallow\nthis, but I wouldn't enforce this for all projects in GIT.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nOf the 3 great composers Mozart tells us what it's like to be human,\nBeethoven tells us what it's like to be Beethoven and Bach tells us\nwhat it's like to be the universe.  -- Douglas Adams\n"},{"id":"15676","messageId":"Pine.LNX.4.64.0602070854380.3854@g5.osdl.org","threadId":"3197","inReplyTo":"20060207164946.GN31278@pasky.or.cz","subject":"Re: [Cogito] Various bugs","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-02-07T16:56:38Z","receivedAt":"2006-02-07T16:56:38Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 7 Feb 2006, Petr Baudis wrote:\n> \n> > Yes. That said, we should probably disallow that in git-commit-tree (and \n> > let the user fix it up some way).\n> \n> What way? Sometimes you just receive mails from people who have only\n> email addy in the from line, or you can be importing from some other VCS\n> where the mapping does not exist and the importers may not deem it\n> necessary to have it in GIT. Sure, it may be kernel policy to disallow\n> this, but I wouldn't enforce this for all projects in GIT.\n\nUmm. Having an empty name is _wrong_. It makes things like the shortlogs \nbreak.\n\nYes, it has happened in the kernel a few times, but those were bugs, and \nI'd have been very happy if git-write-tree had just aborted on me.\n\nIf you don't have any better name than the email/user-name, just use that \n(but at least for the kernel, I'd much prefer a round of \"google\" first to \nsee if something better is available). An _empty_ name is never \nacceptable.\n\n\t\tLinus\n"},{"id":"15691","messageId":"7v8xsmvqqp.fsf@assigned-by-dhcp.cox.net","threadId":"3197","inReplyTo":"Pine.LNX.4.64.0602070751410.3854@g5.osdl.org","subject":"Re: [Cogito] Various bugs","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-07T20:49:34Z","receivedAt":"2006-02-07T20:49:34Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> An empty GIT_AUTHOR_NAME should _not_ mean that we use the default name \n> (which is usually the committer), because rather than meaning \"default\", \n> it most likely means \"buggy import script\". \n>\n> I'd rather have an email import of mine say that it cannot commit, than \n> have it put \"Linus Torvalds\" in the author line (and some random email).\n\nI am inclined to agree.  Something like this?\n\nThis would also make 'git-var GIT_COMMITTER_IDENT' to barf,\nwhich I think is a good thing.\n\n---\ndiff --git a/ident.c b/ident.c\nindex 0461b8b..23b8cfc 100644\n--- a/ident.c\n+++ b/ident.c\n@@ -167,6 +167,11 @@ static const char *get_ident(const char \n \t\tname = git_default_name;\n \tif (!email)\n \t\temail = git_default_email;\n+\n+\tif (!*name || !*email)\n+\t\tdie(\"empty ident %s <%s> not allowed\",\n+\t\t    name, email);\n+\n \tstrcpy(date, git_default_date);\n \tif (date_str)\n \t\tparse_date(date_str, date, sizeof(date));\n"}]}