Various bugs
A few Cogito bugs I found yesterday.
- cg-fetch between local repos fails when the cloned branch URL does not point to a .git directory and a needed object from the repository being cloned is packed. git-local-fetch expects a .git directory.
- cg-commit -c will do the wrong thing (use the invokers gecos info) when the author name is empty. One workaround is to make pick_author_script append a space at the end of the GIT_* variables. GIT will strip those and no gecos info is used.
- cg-status reports a deleted file both as deleted and as unknown:
fonseca@antimatter:~/src/elinks/0.12 > git --version git version 1.1.6.g1506 fonseca@antimatter:~/src/elinks/0.12 > cg --version cogito-0.17pre.GIT (d3aa9a2b3375e36c774ea477492db76baa1db03e) fonseca@antimatter:~/src/elinks/0.12 > cg rm AUTHORS Removing file AUTHORS fonseca@antimatter:~/src/elinks/0.12 > cg status | grep AUTHORS ? AUTHORS D AUTHORS
Signature · 1 line
Jonas Fonseca
Dear diary, on Tue, Jan 31, 2006 at 05:13:18AM CET, I got a letter where Jonas Fonseca <[email protected]> said that...
Quoted 5 lines
A few Cogito bugs I found yesterday.
- cg-fetch between local repos fails when the cloned branch URL does not point to a .git directory and a needed object from the repository being cloned is packed. git-local-fetch expects a .git directory.
Can't reproduce and I don't buy it. The very first line of local fetch handler is
[ -d "$uri/.git" ] && uri="$uri/.git"
Quoted 4 lines
- cg-commit -c will do the wrong thing (use the invokers gecos info) when the author name is empty. One workaround is to make
pick_author_scriptappend a space at the end of the GIT_* variables. GIT will strip those and no gecos info is used.
I'd rather fix this in GIT than workaround in Cogito. Will follow up with a patch.
...
Hmm.
...
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.
Quoted 11 lines
- cg-status reports a deleted file both as deleted and as unknown:
fonseca@antimatter:~/src/elinks/0.12 > git --version git version 1.1.6.g1506 fonseca@antimatter:~/src/elinks/0.12 > cg --version cogito-0.17pre.GIT (d3aa9a2b3375e36c774ea477492db76baa1db03e) fonseca@antimatter:~/src/elinks/0.12 > cg rm AUTHORS Removing file AUTHORS fonseca@antimatter:~/src/elinks/0.12 > cg status | grep AUTHORS ? AUTHORS D AUTHORS
This is fine, I'd say. The file was not deleted from the tree, either do that manually by rm or say cg-rm -f.
Signature · 5 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ Of the 3 great composers Mozart tells us what it's like to be human, Beethoven tells us what it's like to be Beethoven and Bach tells us what it's like to be the universe. -- Douglas Adams
Petr Baudis <[email protected]> wrote Tue, Feb 07, 2006:
Quoted 4 lines
Dear diary, on Tue, Jan 31, 2006 at 05:13:18AM CET, I got a letter where Jonas Fonseca <[email protected]> said that...
Quoted 2 lines
A few Cogito bugs I found yesterday.
Quoted 8 lines
Quoted 3 lines
- cg-fetch between local repos fails when the cloned branch URL does not point to a .git directory and a needed object from the repository being cloned is packed. git-local-fetch expects a .git directory.
Can't reproduce and I don't buy it. The very first line of local fetch handler is
[ -d "$uri/.git" ] && uri="$uri/.git"
I cannot reproduce it either and my strace file is long gone thanks to cg-clean. Come to think of it it might have been caused by a pack file not following the more strict name rules which recently was introduced in GIT.
Quoted 12 lines
Quoted 11 lines
- cg-status reports a deleted file both as deleted and as unknown:
fonseca@antimatter:~/src/elinks/0.12 > git --version git version 1.1.6.g1506 fonseca@antimatter:~/src/elinks/0.12 > cg --version cogito-0.17pre.GIT (d3aa9a2b3375e36c774ea477492db76baa1db03e) fonseca@antimatter:~/src/elinks/0.12 > cg rm AUTHORS Removing file AUTHORS fonseca@antimatter:~/src/elinks/0.12 > cg status | grep AUTHORS ? AUTHORS D AUTHORS
Quoted 2 lines
This is fine, I'd say. The file was not deleted from the tree, either do that manually by rm or say cg-rm -f.
Yes, I guess you are right, this is a special case. But I think it needs to be noted that this is 'normal'. Something like this vague patch signed-off-by me.
cg-status +10 -2
@@ -21,12 +21,12 @@ # D:: # '<file>' has been deleted. # !:: -# '<file>' is gone from your working copy but not deleted by cg-rm. +# '<file>' is gone from your working copy but not deleted by `cg-rm`. # M:: # '<file>' has been touched or modified. # m:: # '<file>' has been touched or modified, but will not be automatically -# committed the next time you call cg-commit. This is used during a +# committed the next time you call `cg-commit`. This is used during a # merge to mark files which contained local changes before the merge. # # OPTIONS
@@ -55,6 +55,14 @@ # Path to the directory to use as the base for the working tree # file list (instead of the current directory). # +# NOTES +# ----- +# If a file has been removed with `cg-rm` without using the `-f` option +# to remove it physically from the tree it will be reported as both being +# deleted and unknown. The reason for this is that the file is internally +# marked as deleted and thus also untracked. After next commit it will only +# be reported as being untracked. +# # FILES # ----- # $GIT_DIR/info/exclude::
Signature · 1 line
Jonas Fonseca
Quoted 7 lines · Petr Baudis
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.
They probably do not have anything to do with the problem at hand, but I just noticed your version of pick-author code in cg-commit lacks two changes I added to git-commit:
(1) the pick_author_script you have in cg-commit lacks the support for names with single-quotes in them (aa66c7ec77d474b737da607d6cb2d07f56628def).
(2) I run the sed script with LANG and LC_ALL set to C locale. I think I had some trouble without them with high-bit names, (e3e291fc07b49b74bb655ca854bdb19e849e044c) but the detail escapes me.
Dear diary, on Tue, Feb 07, 2006 at 03:03:13AM CET, I got a letter where Junio C Hamano <[email protected]> said that...
Quoted 14 lines
Quoted 7 lines · Petr Baudis
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.
They probably do not have anything to do with the problem at hand, but I just noticed your version of pick-author code in cg-commit lacks two changes I added to git-commit:
Quoted 8 lines
(1) the
pick_author_scriptyou have in cg-commit lacks the support for names with single-quotes in them (aa66c7ec77d474b737da607d6cb2d07f56628def).(2) I run the sed script with LANG and
LC_ALLset to C locale. I think I had some trouble without them with high-bit names, (e3e291fc07b49b74bb655ca854bdb19e849e044c) but the detail escapes me.
Thanks, I've updated the cg-commit version. Note that the empty GIT_AUTHOR_NAME problem seems to exist in git-commit as well.
Signature · 5 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ Of the 3 great composers Mozart tells us what it's like to be human, Beethoven tells us what it's like to be Beethoven and Bach tells us what it's like to be the universe. -- Douglas Adams
Quoted 10 lines · Petr Baudis
Quoted 8 lines
Quoted 7 lines
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_NAMEproblem 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) </dev/null
Committing initial tree a2b59c3848164a2c9c3c75fbaadccaed9485da92
ef90563fa278735af367e7606ea7eb2559121ca7
$ git-cat-file commit ef90563fa278735af367e7606ea7eb2559121ca7
tree a2b59c3848164a2c9c3c75fbaadccaed9485da92
author <[email protected]> 1139281078 -0800
committer Junio C Hamano <[email protected]> 1139281078 -0800That 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.
ident.c +2 -2
@@ -163,9 +163,9 @@ static const char *get_ident(const charchar 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)
Quoted 11 lines · Junio C Hamano
It depends on what you expect, but it meets _my_ expectation:
$ GIT_AUTHOR_NAME='' git-commit-tree $(git-write-tree) </dev/null Committing initial tree a2b59c3848164a2c9c3c75fbaadccaed9485da92 ef90563fa278735af367e7606ea7eb2559121ca7 $ git-cat-file commit ef90563fa278735af367e7606ea7eb2559121ca7 tree a2b59c3848164a2c9c3c75fbaadccaed9485da92 author <[email protected]> 1139281078 -0800 committer Junio C Hamano <[email protected]> 1139281078 -0800
Quoted 2 lines
That is, the user said
GIT_AUTHOR_NAMEis empty, so he gets a commit with an empty author name.
Yes. That said, we should probably disallow that in git-commit-tree (and let the user fix it up some way).
Quoted 4 lines
get_ident()inident.cdoes 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.
No, don't use the default name.
An empty GIT_AUTHOR_NAME should _not_ mean that we use the default name (which is usually the committer), because rather than meaning "default", it most likely means "buggy import script".
I'd rather have an email import of mine say that it cannot commit, than have it put "Linus Torvalds" in the author line (and some random email).
Linus
Dear diary, on Tue, Feb 07, 2006 at 04:53:57PM CET, I got a letter where Linus Torvalds <[email protected]> said that...
Quoted 14 lines · Junio C Hamano
Quoted 11 lines
It depends on what you expect, but it meets _my_ expectation:
$ GIT_AUTHOR_NAME='' git-commit-tree $(git-write-tree) </dev/null Committing initial tree a2b59c3848164a2c9c3c75fbaadccaed9485da92 ef90563fa278735af367e7606ea7eb2559121ca7 $ git-cat-file commit ef90563fa278735af367e7606ea7eb2559121ca7 tree a2b59c3848164a2c9c3c75fbaadccaed9485da92 author <[email protected]> 1139281078 -0800 committer Junio C Hamano <[email protected]> 1139281078 -0800
Quoted 2 lines
Quoted 2 lines
That is, the user said
GIT_AUTHOR_NAMEis empty, so he gets a commit with an empty author name.
That is what I expect and I must have done something wrong the last night since it works for me now as well. Sorry. So I'm all alone at this bug again. ;-)
Quoted 2 lines
Yes. That said, we should probably disallow that in git-commit-tree (and let the user fix it up some way).
What way? Sometimes you just receive mails from people who have only email addy in the from line, or you can be importing from some other VCS where the mapping does not exist and the importers may not deem it necessary to have it in GIT. Sure, it may be kernel policy to disallow this, but I wouldn't enforce this for all projects in GIT.
Signature · 5 lines
Petr "Pasky" Baudis Stuff: http://pasky.or.cz/ Of the 3 great composers Mozart tells us what it's like to be human, Beethoven tells us what it's like to be Beethoven and Bach tells us what it's like to be the universe. -- Douglas Adams
Quoted 9 lines · Petr Baudis
Quoted 3 lines
Yes. That said, we should probably disallow that in git-commit-tree (and let the user fix it up some way).
What way? Sometimes you just receive mails from people who have only email addy in the from line, or you can be importing from some other VCS where the mapping does not exist and the importers may not deem it necessary to have it in GIT. Sure, it may be kernel policy to disallow this, but I wouldn't enforce this for all projects in GIT.
Umm. Having an empty name is _wrong_. It makes things like the shortlogs break.
Yes, it has happened in the kernel a few times, but those were bugs, and I'd have been very happy if git-write-tree had just aborted on me.
If you don't have any better name than the email/user-name, just use that (but at least for the kernel, I'd much prefer a round of "google" first to see if something better is available). An _empty_ name is never acceptable.
Linus
Quoted 6 lines · Linus Torvalds
An empty
GIT_AUTHOR_NAMEshould _not_ mean that we use the default name (which is usually the committer), because rather than meaning "default", it most likely means "buggy import script".I'd rather have an email import of mine say that it cannot commit, than have it put "Linus Torvalds" in the author line (and some random email).
I am inclined to agree. Something like this?
This would also make 'git-var GIT_COMMITTER_IDENT' to barf, which I think is a good thing.
---
ident.c +5 -0
@@ -167,6 +167,11 @@ static const char *get_ident(const char name = git_default_name;if (!email) email = git_default_email; + +if (!*name || !*email) +die ("empty ident %s <%s> not allowed" , + name, email); +strcpy (date, git_default_date);if (date_str)parse_date (date_str, date,sizeof (date));