git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [Cogito] Various bugs
@ 2006-01-31  4:13 Jonas Fonseca
  2006-02-07  0:36 ` Petr Baudis
  0 siblings, 1 reply; 10+ messages in thread
From: Jonas Fonseca @ 2006-01-31  4:13 UTC (permalink / raw)
  To: git; +Cc: Petr Baudis

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

-- 
Jonas Fonseca

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Cogito] Various bugs
  2006-01-31  4:13 [Cogito] Various bugs Jonas Fonseca
@ 2006-02-07  0:36 ` Petr Baudis
  2006-02-07  2:03   ` Junio C Hamano
  2006-02-07 13:55   ` Jonas Fonseca
  0 siblings, 2 replies; 10+ messages in thread
From: Petr Baudis @ 2006-02-07  0:36 UTC (permalink / raw)
  To: Jonas Fonseca; +Cc: git

Dear diary, on Tue, Jan 31, 2006 at 05:13:18AM CET, I got a letter
where Jonas Fonseca <fonseca@diku.dk> said that...
> 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"

>  - 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.

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.

>  - 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.

-- 
				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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Cogito] Various bugs
  2006-02-07  0:36 ` Petr Baudis
@ 2006-02-07  2:03   ` Junio C Hamano
  2006-02-07  2:10     ` Petr Baudis
  2006-02-07 13:55   ` Jonas Fonseca
  1 sibling, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2006-02-07  2:03 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Jonas Fonseca, git

Petr Baudis <pasky@suse.cz> 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.

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.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Cogito] Various bugs
  2006-02-07  2:03   ` Junio C Hamano
@ 2006-02-07  2:10     ` Petr Baudis
  2006-02-07  3:03       ` Junio C Hamano
  0 siblings, 1 reply; 10+ messages in thread
From: Petr Baudis @ 2006-02-07  2:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jonas Fonseca, git

Dear diary, on Tue, Feb 07, 2006 at 03:03:13AM CET, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Petr Baudis <pasky@suse.cz> 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.
> 
> 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.

Thanks, I've updated the cg-commit version. Note that the empty
GIT_AUTHOR_NAME problem seems to exist in git-commit as well.

-- 
				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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Cogito] Various bugs
  2006-02-07  2:10     ` Petr Baudis
@ 2006-02-07  3:03       ` Junio C Hamano
  2006-02-07 15:53         ` Linus Torvalds
  0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2006-02-07  3:03 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> 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) </dev/null
    Committing initial tree a2b59c3848164a2c9c3c75fbaadccaed9485da92
    ef90563fa278735af367e7606ea7eb2559121ca7
    $ git-cat-file commit ef90563fa278735af367e7606ea7eb2559121ca7
    tree a2b59c3848164a2c9c3c75fbaadccaed9485da92
    author  <junkio@cox.net> 1139281078 -0800
    committer Junio C Hamano <junkio@cox.net> 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)

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Cogito] Various bugs
  2006-02-07  0:36 ` Petr Baudis
  2006-02-07  2:03   ` Junio C Hamano
@ 2006-02-07 13:55   ` Jonas Fonseca
  1 sibling, 0 replies; 10+ messages in thread
From: Jonas Fonseca @ 2006-02-07 13:55 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> wrote Tue, Feb 07, 2006:
> Dear diary, on Tue, Jan 31, 2006 at 05:13:18AM CET, I got a letter
> where Jonas Fonseca <fonseca@diku.dk> said that...
> > 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"

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.

> >  - 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.

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.

diff --git a/cg-status b/cg-status
index 6abc52f..d38c61f 100755
--- a/cg-status
+++ b/cg-status
@@ -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::

-- 
Jonas Fonseca

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [Cogito] Various bugs
  2006-02-07  3:03       ` Junio C Hamano
@ 2006-02-07 15:53         ` Linus Torvalds
  2006-02-07 16:49           ` Petr Baudis
  2006-02-07 20:49           ` Junio C Hamano
  0 siblings, 2 replies; 10+ messages in thread
From: Linus Torvalds @ 2006-02-07 15:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git



On Mon, 6 Feb 2006, Junio C Hamano wrote:
> 
> 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  <junkio@cox.net> 1139281078 -0800
>     committer Junio C Hamano <junkio@cox.net> 1139281078 -0800
> 
> That is, the user said GIT_AUTHOR_NAME is 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).

> 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.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Cogito] Various bugs
  2006-02-07 15:53         ` Linus Torvalds
@ 2006-02-07 16:49           ` Petr Baudis
  2006-02-07 16:56             ` Linus Torvalds
  2006-02-07 20:49           ` Junio C Hamano
  1 sibling, 1 reply; 10+ messages in thread
From: Petr Baudis @ 2006-02-07 16:49 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Junio C Hamano, git

Dear diary, on Tue, Feb 07, 2006 at 04:53:57PM CET, I got a letter
where Linus Torvalds <torvalds@osdl.org> said that...
> 
> 
> On Mon, 6 Feb 2006, Junio C Hamano wrote:
> > 
> > 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  <junkio@cox.net> 1139281078 -0800
> >     committer Junio C Hamano <junkio@cox.net> 1139281078 -0800
> > 
> > That is, the user said GIT_AUTHOR_NAME is 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. ;-)

> 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.

-- 
				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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Cogito] Various bugs
  2006-02-07 16:49           ` Petr Baudis
@ 2006-02-07 16:56             ` Linus Torvalds
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Torvalds @ 2006-02-07 16:56 UTC (permalink / raw)
  To: Petr Baudis; +Cc: Junio C Hamano, git



On Tue, 7 Feb 2006, Petr Baudis wrote:
> 
> > 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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Cogito] Various bugs
  2006-02-07 15:53         ` Linus Torvalds
  2006-02-07 16:49           ` Petr Baudis
@ 2006-02-07 20:49           ` Junio C Hamano
  1 sibling, 0 replies; 10+ messages in thread
From: Junio C Hamano @ 2006-02-07 20:49 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Petr Baudis, git

Linus Torvalds <torvalds@osdl.org> writes:

> 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).

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.

---
diff --git a/ident.c b/ident.c
index 0461b8b..23b8cfc 100644
--- a/ident.c
+++ b/ident.c
@@ -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));

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-02-07 20:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-01-31  4:13 [Cogito] Various bugs Jonas Fonseca
2006-02-07  0:36 ` Petr Baudis
2006-02-07  2:03   ` Junio C Hamano
2006-02-07  2:10     ` Petr Baudis
2006-02-07  3:03       ` Junio C Hamano
2006-02-07 15:53         ` Linus Torvalds
2006-02-07 16:49           ` Petr Baudis
2006-02-07 16:56             ` Linus Torvalds
2006-02-07 20:49           ` Junio C Hamano
2006-02-07 13:55   ` Jonas Fonseca

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).