From: Junio C Hamano Date: Tue, 07 Feb 2006 03:03:00 GMT Subject: Re: [Cogito] Various bugs Message-ID: <7v8xsn50rf.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <20060207021006.GM31278@pasky.or.cz> Petr Baudis writes: >> > I'm puzzled. GIT should handle this fine. >> > >> > export GIT_AUTHOR_NAME='' >> > git-commit-tree $(cg-object-id -t) >> > >> > works as expected, but for some reason escaping me it does not work >> > inside of cg-commit. Insights welcomed. >> ... > Thanks, I've updated the cg-commit version. Note that the empty > GIT_AUTHOR_NAME problem seems to exist in git-commit as well. It depends on what you expect, but it meets _my_ expectation: $ GIT_AUTHOR_NAME='' git-commit-tree $(git-write-tree) 1139281078 -0800 committer Junio C Hamano 1139281078 -0800 That is, the user said GIT_AUTHOR_NAME is empty, so he gets a commit with an empty author name. get_ident() in ident.c does this. getenv("GIT_AUTHOR_NAME") and friends are passed to it, and git_default_* are takenfrom gecos. It might match some peoples' expectation (but not mine) if we did this instead. diff --git a/ident.c b/ident.c index 0461b8b..7ec7516 100644 --- a/ident.c +++ b/ident.c @@ -163,9 +163,9 @@ static const char *get_ident(const char char date[50]; int i; - if (!name) + if (!name || !*name) name = git_default_name; - if (!email) + if (!email || !*email) email = git_default_email; strcpy(date, git_default_date); if (date_str)