git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-log produces no output
@ 2006-04-21 17:20 Bob Portmann
  2006-04-21 18:11 ` Linus Torvalds
  0 siblings, 1 reply; 10+ messages in thread
From: Bob Portmann @ 2006-04-21 17:20 UTC (permalink / raw)
  To: Git Mailing List

I am just starting out with git and have a noob question about got-log.
 I cannot get any output out of it and am wondering if I am using it
correctly or it is broken.  As I understand it, git-log should just
print out the log messages but not the changes, whereas git-whatchanged
will print out both.  But while git-whatchanged works, git-log never
does.  I have a trivial example below which shows what I mean.  But I
get the same result using my real archives and out of git.git as well.

Thanks,
Bob

PS I'm using git 1.3.0 and have tried this on both Mac OS X and Linux
with the same results.

Trivial example:
git-test> mkdir test-log
git-test> cd test-log
test-log> git-init-db
defaulting to local storage area
test-log> echo "Hello World" >hello
test-log> git add .
test-log> git commit -a -m 'One line hello'
Committing initial tree 117c62a8c5e01758bd284126a6af69deab9dbbe2
test-log> echo "Hello World 2" >>hello
test-log> git commit -a -m 'Two line hello'
test-log> git whatchanged -p
diff-tree 9a4d7602fff052b6796c2862edddd11ae2e45d08 (from
a38306518c5e5e8eb630c02Author: Bob Portmann <portmann@xxxx.xx.xx>
Date:   Fri Apr 21 10:56:11 2006 -0600

    Two line hello

diff --git a/hello b/hello
index 557db03..514e5c5 100644
--- a/hello
+++ b/hello
@@ -1 +1,2 @@
 Hello World
+Hello World 2
test-log> git log
test-log> 

As you can see git log produces no output.  I've tried it with other
options with the same result.


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

* Re: git-log produces no output
  2006-04-21 17:20 git-log produces no output Bob Portmann
@ 2006-04-21 18:11 ` Linus Torvalds
  2006-04-21 18:48   ` Bob Portmann
  0 siblings, 1 reply; 10+ messages in thread
From: Linus Torvalds @ 2006-04-21 18:11 UTC (permalink / raw)
  To: Bob Portmann; +Cc: Git Mailing List



On Fri, 21 Apr 2006, Bob Portmann wrote:
>
>  I cannot get any output out of it and am wondering if I am using it
> correctly or it is broken.

You're using it correctly, but it isn't broken for me. 

> As I understand it, git-log should just print out the log messages but 
> not the changes, whereas git-whatchanged will print out both.

Well, in 1.3.0, "git log" can actually do both, and you can get the 
whatchanged output by just saying "git log -p".

But yes, without the "-p", you should get just the log.

And that's exactly what I get, both with current HEAD git, and with a 
v1.3.0 checkout.

> test-log> git log
> test-log> 
> 
> As you can see git log produces no output.  I've tried it with other
> options with the same result.

Very strange indeed. Can you do

	git log > file

to see if that changes (and see if the file contains anything)? The reason 
I mention that is that by default "git log" will start a pager for you, 
and if you somehow have a broken PAGER setup, I could imagine exactly the 
behaviour you see (although I don't see why "git whatchanged" would work 
either, in that case).

Finally, if that doesn't output anything either, please do (for just that 
small repository, so that the trace is also small)

	strace -o git-trace git log > /dev/null

and send out the result. Again, for PAGER reasons, that "> /dev/null" is 
actually important, because we don't want to trigger the pager code.

		Linus

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

* Re: git-log produces no output
  2006-04-21 18:11 ` Linus Torvalds
@ 2006-04-21 18:48   ` Bob Portmann
  2006-04-21 18:58     ` Paolo Ciarrocchi
  2006-04-21 19:18     ` Linus Torvalds
  0 siblings, 2 replies; 10+ messages in thread
From: Bob Portmann @ 2006-04-21 18:48 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Git Mailing List

--- Linus Torvalds <torvalds@osdl.org> wrote:
> On Fri, 21 Apr 2006, Bob Portmann wrote:
> >
> >  I cannot get any output out of it and am wondering if I am using
> it
> > correctly or it is broken.
> 
> You're using it correctly, but it isn't broken for me. 
> 
> > As I understand it, git-log should just print out the log messages
> but 
> > not the changes, whereas git-whatchanged will print out both.
> 
> Well, in 1.3.0, "git log" can actually do both, and you can get the 
> whatchanged output by just saying "git log -p".
> 
> But yes, without the "-p", you should get just the log.
> 
> And that's exactly what I get, both with current HEAD git, and with a
> 
> v1.3.0 checkout.
> 
> > test-log> git log
> > test-log> 
> > 
> > As you can see git log produces no output.  I've tried it with
> other
> > options with the same result.
> 
> Very strange indeed. Can you do
> 
> 	git log > file
> 
> to see if that changes (and see if the file contains anything)? The
> reason 
> I mention that is that by default "git log" will start a pager for
> you, 
> and if you somehow have a broken PAGER setup, I could imagine exactly
> the 
> behaviour you see (although I don't see why "git whatchanged" would
> work 
> either, in that case).

Yes, this is the problem.  It works when I send it to a file.  It seems
to be that having any extra options my PAGER command that messes it up
(see below).  If get-log was a shell script I would imagine that some
quotes are missing:-)

Bob

test-log> export PAGER='more'
test-log> git log
commit 9a4d7602fff052b6796c2862edddd11ae2e45d08
Author: Bob Portmann <portmann@removed>
Date:   Fri Apr 21 10:56:11 2006 -0600

    Two line hello

commit a38306518c5e5e8eb630c02a47bec2a9fc292025
Author: Bob Portmann <portmann@removed>
Date:   Fri Apr 21 10:55:44 2006 -0600

    One line hello

test-log> export PAGER='more -i'
test-log> git log
test-log> 

Adding the option -i (which should do nothing) has eliminated the
output.


> Finally, if that doesn't output anything either, please do (for just
> that 
> small repository, so that the trace is also small)
> 
> 	strace -o git-trace git log > /dev/null
> 
> and send out the result. Again, for PAGER reasons, that "> /dev/null"
> is 
> actually important, because we don't want to trigger the pager code.
> 
> 		Linus
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

* Re: git-log produces no output
  2006-04-21 18:48   ` Bob Portmann
@ 2006-04-21 18:58     ` Paolo Ciarrocchi
  2006-04-21 19:13       ` Bob Portmann
  2006-04-21 19:18     ` Linus Torvalds
  1 sibling, 1 reply; 10+ messages in thread
From: Paolo Ciarrocchi @ 2006-04-21 18:58 UTC (permalink / raw)
  To: Bob Portmann; +Cc: Linus Torvalds, Git Mailing List

On 4/21/06, Bob Portmann <bportmann@yahoo.com> wrote:
[...]
> test-log> export PAGER='more -i'
> test-log> git log
> test-log>
>
> Adding the option -i (which should do nothing) has eliminated the
> output.

Well, on my machine:
paolo@Italia:~/gkernel$ more -i
more: unknown option "-i"
usage: more [-dflpcsu] [+linenum | +/pattern] name1 name2 ...

Ciao,
--
Paolo
http://paolociarrocchi.googlepages.com

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

* Re: git-log produces no output
  2006-04-21 18:58     ` Paolo Ciarrocchi
@ 2006-04-21 19:13       ` Bob Portmann
  0 siblings, 0 replies; 10+ messages in thread
From: Bob Portmann @ 2006-04-21 19:13 UTC (permalink / raw)
  To: Paolo Ciarrocchi; +Cc: Linus Torvalds, Git Mailing List

--- Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:
> On 4/21/06, Bob Portmann <bportmann@yahoo.com> wrote:
> [...]
> > test-log> export PAGER='more -i'
> > test-log> git log
> > test-log>
> >
> > Adding the option -i (which should do nothing) has eliminated the
> > output.
> 
> Well, on my machine:
> paolo@Italia:~/gkernel$ more -i
> more: unknown option "-i"
> usage: more [-dflpcsu] [+linenum | +/pattern] name1 name2 ...

Well, then try an option that does work.  On my system less and more
are essentially the same and -i just causes it to ignore case on
searches.  The PAGER is automatically setup to 'less -XRse' on my
system (not sure why).  Changing it to 'more' makes git-log work, but
it should work with 'less -XRse' as well since that works with other
commands on the system (e.g. man) and git-whatchanged as well.

Bob
 
> Ciao,
> --
> Paolo
> http://paolociarrocchi.googlepages.com
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

* Re: git-log produces no output
  2006-04-21 18:48   ` Bob Portmann
  2006-04-21 18:58     ` Paolo Ciarrocchi
@ 2006-04-21 19:18     ` Linus Torvalds
  2006-04-21 19:25       ` Linus Torvalds
  1 sibling, 1 reply; 10+ messages in thread
From: Linus Torvalds @ 2006-04-21 19:18 UTC (permalink / raw)
  To: Bob Portmann, Junio C Hamano; +Cc: Git Mailing List



On Fri, 21 Apr 2006, Bob Portmann wrote:
> 
> Yes, this is the problem.  It works when I send it to a file.  It seems
> to be that having any extra options my PAGER command that messes it up
> (see below).  If get-log was a shell script I would imagine that some
> quotes are missing:-)

It's the other way around: it's got "too much" quoting.

"git log" will literally _execute_ the PAGER environment, not pass it to a 
shell, and not interpret any arguments.

So it will look for a program called "more -i" (space and all), and no 
such program exists, so the execve fails, and git log ends up being 
silent.

This patch would have made things a lot more obvious.

Junio?

		Linus
---
diff --git a/pager.c b/pager.c
index b063353..9204641 100644
--- a/pager.c
+++ b/pager.c
@@ -47,5 +47,6 @@ void setup_pager(void)
 
 	setenv("LESS", "-S", 0);
 	run_pager(pager);
+	die("unable to execute pager '%s'", pager);
 	exit(255);
 }

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

* Re: git-log produces no output
  2006-04-21 19:18     ` Linus Torvalds
@ 2006-04-21 19:25       ` Linus Torvalds
  2006-04-21 19:38         ` Bob Portmann
  2006-04-21 20:05         ` Junio C Hamano
  0 siblings, 2 replies; 10+ messages in thread
From: Linus Torvalds @ 2006-04-21 19:25 UTC (permalink / raw)
  To: Bob Portmann, Junio C Hamano; +Cc: Git Mailing List



On Fri, 21 Apr 2006, Linus Torvalds wrote:
> 
> This patch would have made things a lot more obvious.

Actually, scratch that one, and use this one instead. Much better, and 
actually allows Bob's crazy PAGER environment variable to work, rather 
than just reporting an error about it.

		Linus
---
diff --git a/pager.c b/pager.c
index b063353..9a30939 100644
--- a/pager.c
+++ b/pager.c
@@ -8,6 +8,7 @@ #include "cache.h"
 static void run_pager(const char *pager)
 {
 	execlp(pager, pager, NULL);
+	execl("/bin/sh", "sh", "-c", pager, NULL);
 }
 
 void setup_pager(void)
@@ -47,5 +48,6 @@ void setup_pager(void)
 
 	setenv("LESS", "-S", 0);
 	run_pager(pager);
+	die("unable to execute pager '%s'", pager);
 	exit(255);
 }

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

* Re: git-log produces no output
  2006-04-21 19:25       ` Linus Torvalds
@ 2006-04-21 19:38         ` Bob Portmann
  2006-04-21 20:05         ` Junio C Hamano
  1 sibling, 0 replies; 10+ messages in thread
From: Bob Portmann @ 2006-04-21 19:38 UTC (permalink / raw)
  To: Linus Torvalds, Junio C Hamano; +Cc: Git Mailing List

Yes, that fixes it, even with the crazy PAGER (which is going to be
plain 'more' from now on:-)

Thanks,
Bob

--- Linus Torvalds <torvalds@osdl.org> wrote:

> On Fri, 21 Apr 2006, Linus Torvalds wrote:
> > 
> > This patch would have made things a lot more obvious.
> 
> Actually, scratch that one, and use this one instead. Much better,
> and 
> actually allows Bob's crazy PAGER environment variable to work,
> rather 
> than just reporting an error about it.
> 
> 		Linus
> ---
> diff --git a/pager.c b/pager.c
> index b063353..9a30939 100644
> --- a/pager.c
> +++ b/pager.c
> @@ -8,6 +8,7 @@ #include "cache.h"
>  static void run_pager(const char *pager)
>  {
>  	execlp(pager, pager, NULL);
> +	execl("/bin/sh", "sh", "-c", pager, NULL);
>  }
>  
>  void setup_pager(void)
> @@ -47,5 +48,6 @@ void setup_pager(void)
>  
>  	setenv("LESS", "-S", 0);
>  	run_pager(pager);
> +	die("unable to execute pager '%s'", pager);
>  	exit(255);
>  }
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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

* Re: git-log produces no output
  2006-04-21 19:25       ` Linus Torvalds
  2006-04-21 19:38         ` Bob Portmann
@ 2006-04-21 20:05         ` Junio C Hamano
  2006-04-21 20:25           ` Linus Torvalds
  1 sibling, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2006-04-21 20:05 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: git

Linus Torvalds <torvalds@osdl.org> writes:

> On Fri, 21 Apr 2006, Linus Torvalds wrote:
>> 
>> This patch would have made things a lot more obvious.
>
> Actually, scratch that one, and use this one instead. Much better, and 
> actually allows Bob's crazy PAGER environment variable to work, rather 
> than just reporting an error about it.

Agreed, this is much better than just punting.  Sign-off?

BTW: The extended extended SHA1 is a great addition.  I do not
usually have contrib/colordiff checked out (it is in "pu", not
in "next"), but I can easily do:

	git tar-tree pu:contrib/colordiff colordiff | tar xf -

Of course "git tar-tree pu | tar xf - contrib/colordiff" would
work for this particular case, but that is besides the point.

BTW: Allow me to try "git fmt-patch -1" ;-).

-- >8 --
From 34fd1c9ac5845d541e3196983df7f993e751b544  Thu Apr 7 15:13:13 2005
From: Linus Torvalds <torvalds@osdl.org>
Date: Fri Apr 21 12:25:13 2006 -0700
Subject: git-log produces no output

When $PAGER is set to 'less -i', we used to fail because we
assumed the $PAGER is a command and simply exec'ed it.

Try exec first, and then run it through shell if it fails.  This
allows even funkier PAGERs like these ;-):

	PAGER='sed -e "s/^/`date`: /" | more'
	PAGER='contrib/colordiff.perl | less -RS'

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 pager.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/pager.c b/pager.c
index e5ba273..f7b8e78 100644
--- a/pager.c
+++ b/pager.c
@@ -8,6 +8,7 @@ #include "cache.h"
 static void run_pager(const char *pager)
 {
 	execlp(pager, pager, NULL);
+	execl("/bin/sh", "sh", "-c", pager, NULL);
 }
 
 void setup_pager(void)
@@ -47,5 +48,6 @@ void setup_pager(void)
 
 	setenv("LESS", "-S", 0);
 	run_pager(pager);
+	die("unable to execute pager '%s'", pager);
 	exit(255);
 }
-- 
1.3.0.gd1e3

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

* Re: git-log produces no output
  2006-04-21 20:05         ` Junio C Hamano
@ 2006-04-21 20:25           ` Linus Torvalds
  0 siblings, 0 replies; 10+ messages in thread
From: Linus Torvalds @ 2006-04-21 20:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git



On Fri, 21 Apr 2006, Junio C Hamano wrote:
>
> Linus Torvalds <torvalds@osdl.org> writes:
> 
> > On Fri, 21 Apr 2006, Linus Torvalds wrote:
> >> 
> >> This patch would have made things a lot more obvious.
> >
> > Actually, scratch that one, and use this one instead. Much better, and 
> > actually allows Bob's crazy PAGER environment variable to work, rather 
> > than just reporting an error about it.
> 
> Agreed, this is much better than just punting.  Sign-off?

Yup, you can just go wild with the 

	Signed-off-by: Linus Torvalds <torvalds@osdl.org>

lines. My employment contract requires that everything I produce is open 
source ;)

> BTW: The extended extended SHA1 is a great addition.  I do not
> usually have contrib/colordiff checked out (it is in "pu", not
> in "next"), but I can easily do:
> 
> 	git tar-tree pu:contrib/colordiff colordiff | tar xf -

Ahh, yes. That is one situation where a sub-tree SHA1 makes more sense 
than most (the fact that it works with "git diff" and directory renames is 
likely more of a curiosity than anything widely useful, I think)

> BTW: Allow me to try "git fmt-patch -1" ;-).

Looks good to me.

		Linus

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

end of thread, other threads:[~2006-04-21 20:25 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-21 17:20 git-log produces no output Bob Portmann
2006-04-21 18:11 ` Linus Torvalds
2006-04-21 18:48   ` Bob Portmann
2006-04-21 18:58     ` Paolo Ciarrocchi
2006-04-21 19:13       ` Bob Portmann
2006-04-21 19:18     ` Linus Torvalds
2006-04-21 19:25       ` Linus Torvalds
2006-04-21 19:38         ` Bob Portmann
2006-04-21 20:05         ` Junio C Hamano
2006-04-21 20:25           ` Linus Torvalds

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 NNTP newsgroup(s).