git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git log is a bit antisocial
@ 2006-04-14 20:50 Nicolas Pitre
  2006-04-14 20:56 ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Pitre @ 2006-04-14 20:50 UTC (permalink / raw
  To: git


$  git log -h
fatal: unrecognized argument: -h
$ git log --help
fatal: unrecognized argument: --help

Maybe the usage string could be printed in those cases?


Nicolas

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

* Re: git log is a bit antisocial
  2006-04-14 20:50 git log is a bit antisocial Nicolas Pitre
@ 2006-04-14 20:56 ` Junio C Hamano
  2006-04-14 21:20   ` Nicolas Pitre
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2006-04-14 20:56 UTC (permalink / raw
  To: Nicolas Pitre; +Cc: git

Nicolas Pitre <nico@cam.org> writes:

> $  git log -h
> fatal: unrecognized argument: -h
> $ git log --help
> fatal: unrecognized argument: --help
>
> Maybe the usage string could be printed in those cases?

Perhaps.  Alternatively, "git help log", perhaps.

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

* Re: git log is a bit antisocial
  2006-04-14 20:56 ` Junio C Hamano
@ 2006-04-14 21:20   ` Nicolas Pitre
  2006-04-14 21:28     ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Pitre @ 2006-04-14 21:20 UTC (permalink / raw
  To: Junio C Hamano; +Cc: git

On Fri, 14 Apr 2006, Junio C Hamano wrote:

> Nicolas Pitre <nico@cam.org> writes:
> 
> > $  git log -h
> > fatal: unrecognized argument: -h
> > $ git log --help
> > fatal: unrecognized argument: --help
> >
> > Maybe the usage string could be printed in those cases?
> 
> Perhaps.  Alternatively, "git help log", perhaps.

What about git-log then?


Nicolas

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

* Re: git log is a bit antisocial
  2006-04-14 21:20   ` Nicolas Pitre
@ 2006-04-14 21:28     ` Junio C Hamano
  2006-04-14 21:44       ` Sébastien Pierre
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2006-04-14 21:28 UTC (permalink / raw
  To: Nicolas Pitre; +Cc: git

Nicolas Pitre <nico@cam.org> writes:

> On Fri, 14 Apr 2006, Junio C Hamano wrote:
>
>> Nicolas Pitre <nico@cam.org> writes:
>> 
>> > $  git log -h
>> > fatal: unrecognized argument: -h
>> > $ git log --help
>> > fatal: unrecognized argument: --help
>> >
>> > Maybe the usage string could be printed in those cases?
>> 
>> Perhaps.  Alternatively, "git help log", perhaps.
>
> What about git-log then?

What about it?

Asking for help on log could be spelled as "git log --help" with
a patch like the attached, but I am not sure that is worth it...

-- >8 --
diff --git a/git.c b/git.c
index 78ed403..7fdacdd 100644
--- a/git.c
+++ b/git.c
@@ -497,6 +497,16 @@ int main(int argc, const char **argv, ch
 	}
 	argv[0] = cmd;
 
+	/* It could be git blah --help or git boo -h, but be
+	 * careful; most commands have their own '-h' and '--help'.
+	 */
+	if (argc == 2 &&
+	    (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))) {
+		argv[0] = "help";
+		argv[1] = cmd;
+		exit(cmd_help(1, argv, envp));
+	}
+
 	/*
 	 * We search for git commands in the following order:
 	 *  - git_exec_path()

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

* Re: git log is a bit antisocial
  2006-04-14 21:28     ` Junio C Hamano
@ 2006-04-14 21:44       ` Sébastien Pierre
  2006-04-14 22:06         ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Sébastien Pierre @ 2006-04-14 21:44 UTC (permalink / raw
  To: git

Le vendredi 14 avril 2006 à 14:28 -0700, Junio C Hamano a écrit :

> What about it?
> 
> Asking for help on log could be spelled as "git log --help" with
> a patch like the attached, but I am not sure that is worth it...

I would say that it is very useful to newbies, or simply not to
frustrate users trying to get help. It is really worth it, at least for
me.

 -- Sébastien

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

* Re: git log is a bit antisocial
  2006-04-14 21:44       ` Sébastien Pierre
@ 2006-04-14 22:06         ` Junio C Hamano
  2006-04-14 22:15           ` Sébastien Pierre
  0 siblings, 1 reply; 8+ messages in thread
From: Junio C Hamano @ 2006-04-14 22:06 UTC (permalink / raw
  To: Sébastien Pierre; +Cc: git

Sébastien Pierre <sebastien@xprima.com> writes:

> Le vendredi 14 avril 2006 à 14:28 -0700, Junio C Hamano a écrit :
>
>> What about it?
>> 
>> Asking for help on log could be spelled as "git log --help" with
>> a patch like the attached, but I am not sure that is worth it...
>
> I would say that it is very useful to newbies, or simply not to
> frustrate users trying to get help. It is really worth it, at least for
> me.

Have you read the patch, especially the comment in it?  With and
without the patch, this command would behave quite differently:

	$ git commit --help

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

* Re: git log is a bit antisocial
  2006-04-14 22:06         ` Junio C Hamano
@ 2006-04-14 22:15           ` Sébastien Pierre
  2006-04-14 22:45             ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Sébastien Pierre @ 2006-04-14 22:15 UTC (permalink / raw
  To: git

Le vendredi 14 avril 2006 à 15:06 -0700, Junio C Hamano a écrit :

> Have you read the patch, especially the comment in it?  With and
> without the patch, this command would behave quite differently:

I did not realize that at first (I thought this would be a fallback
method). 

Anyway, on git 1.2.3, here is something interesting:

>> git log -h
fatal: Not a git repository

>> git log --help
Usage: /home/sebastien/Local/bin/git-log [--max-count=<n>]
[<since>..<limit>] [--pretty=<format>] [git-rev-list options]

Which is confusing, so having a consistent behaviour for "git help cmd",
"git cmd help", "git cmd -h" and "git cmd --help" would be nice.

For instance, Darcs works just like that, which makes it easy for
newbies to find there ways through.

 -- Sébastien

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

* Re: git log is a bit antisocial
  2006-04-14 22:15           ` Sébastien Pierre
@ 2006-04-14 22:45             ` Junio C Hamano
  0 siblings, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2006-04-14 22:45 UTC (permalink / raw
  To: Sébastien Pierre; +Cc: git

Sébastien Pierre <sebastien@xprima.com> writes:

> Anyway, on git 1.2.3, here is something interesting:
>
>>> git log -h
> fatal: Not a git repository
>
>>> git log --help
> Usage: /home/sebastien/Local/bin/git-log [--max-count=<n>]
> [<since>..<limit>] [--pretty=<format>] [git-rev-list options]

You are talking about old codebase in the maitenance branch,
which is an independent issue, but thanks for noticing anyway.

The attached patch would help with that.

> Which is confusing, so having a consistent behaviour for "git help cmd",
> "git cmd help", "git cmd -h" and "git cmd --help" would be nice.
>
> For instance, Darcs works just like that, which makes it easy for
> newbies to find there ways through.

Patches welcome, but a new development should be based on the
"master" branch, not the maintenance 1.2.X series.

-- >8 --
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 025ef2d..d15747f 100755
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -30,7 +30,7 @@ else
 fi
 
 case "$1" in
-	--h|--he|--hel|--help)
+	-h|--h|--he|--hel|--help)
 	echo "$LONG_USAGE"
 	exit
 esac

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

end of thread, other threads:[~2006-04-14 22:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-14 20:50 git log is a bit antisocial Nicolas Pitre
2006-04-14 20:56 ` Junio C Hamano
2006-04-14 21:20   ` Nicolas Pitre
2006-04-14 21:28     ` Junio C Hamano
2006-04-14 21:44       ` Sébastien Pierre
2006-04-14 22:06         ` Junio C Hamano
2006-04-14 22:15           ` Sébastien Pierre
2006-04-14 22:45             ` Junio C Hamano

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