git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-rev-list --help anywhere
@ 2006-02-19 11:09 Alex Riesen
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Riesen @ 2006-02-19 11:09 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Petr Baudis, git

Junio C Hamano, Sat, Feb 18, 2006 19:55:02 +0100:
> Petr Baudis <pasky@suse.cz> writes:
> 
> > 	$ git-rev-list --help
> > 	fatal: Not a git repository
> 
> Hmph, true.  Ideas?
> 

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>

---

 rev-list.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

0855207c43a83007e4c060a03c39269f379fed41
diff --git a/rev-list.c b/rev-list.c
index f2d1105..a059e45 100644
--- a/rev-list.c
+++ b/rev-list.c
@@ -755,10 +755,16 @@ static void handle_all(struct commit_lis
 
 int main(int argc, const char **argv)
 {
-	const char *prefix = setup_git_directory();
+	const char *prefix;
 	struct commit_list *list = NULL;
 	int i, limited = 0;
 
+	for (i = 1 ; i < argc; i++)
+	    if ( !strcmp(argv[i], "--help") )
+		usage(rev_list_usage);
+
+	prefix = setup_git_directory();
+
 	for (i = 1 ; i < argc; i++) {
 		int flags;
 		const char *arg = argv[i];
-- 
1.2.1.g59a08

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

* Re: [PATCH] git-rev-list --help anywhere
@ 2006-02-19 11:26 linux
  2006-02-19 18:39 ` Alex Riesen
  0 siblings, 1 reply; 7+ messages in thread
From: linux @ 2006-02-19 11:26 UTC (permalink / raw)
  To: raa.lkml; +Cc: git

>+	for (i = 1 ; i < argc; i++)
>+	    if ( !strcmp(argv[i], "--help") )
>+		usage(rev_list_usage);

You might want to try something more like:

+	for (i = 1 ; i < argc; i++) {
+	    if ( !strcmp(argv[i], "--help") )
+		usage(rev_list_usage);
+	    if ( !strcmp(argv[i], "--") )
+		break;
+	}

So that you don't break in the perverse but legal case of
having a file named "--help".

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

* Re: [PATCH] git-rev-list --help anywhere
  2006-02-19 11:26 [PATCH] git-rev-list --help anywhere linux
@ 2006-02-19 18:39 ` Alex Riesen
  2006-02-19 19:25   ` Johannes Schindelin
  0 siblings, 1 reply; 7+ messages in thread
From: Alex Riesen @ 2006-02-19 18:39 UTC (permalink / raw)
  To: linux; +Cc: Junio C Hamano, git

linux@horizon.com, Sun, Feb 19, 2006 12:26:27 +0100:
> >+	for (i = 1 ; i < argc; i++)
> >+	    if ( !strcmp(argv[i], "--help") )
> >+		usage(rev_list_usage);
> 
> You might want to try something more like:
> 
> +	for (i = 1 ; i < argc; i++) {
> +	    if ( !strcmp(argv[i], "--help") )
> +		usage(rev_list_usage);
> +	    if ( !strcmp(argv[i], "--") )
> +		break;
> +	}
> 
> So that you don't break in the perverse but legal case of
> having a file named "--help".

Of course. Thanks!

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>

---

diff --git a/rev-list.c b/rev-list.c
index f2d1105..bcb492e 100644
--- a/rev-list.c
+++ b/rev-list.c
@@ -755,11 +755,20 @@ static void handle_all(struct commit_lis
 
 int main(int argc, const char **argv)
 {
-	const char *prefix = setup_git_directory();
+	const char *prefix;
 	struct commit_list *list = NULL;
 	int i, limited = 0;
 
 	for (i = 1 ; i < argc; i++) {
+	    if ( !strcmp(argv[i], "--help") )
+		usage(rev_list_usage);
+	    if ( !strcmp(argv[i], "--") )
+		break;
+	}
+
+	prefix = setup_git_directory();
+
+	for (i = 1 ; i < argc; i++) {
 		int flags;
 		const char *arg = argv[i];
 		char *dotdot;
--
1.2.2.gbc57

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

* Re: [PATCH] git-rev-list --help anywhere
  2006-02-19 18:39 ` Alex Riesen
@ 2006-02-19 19:25   ` Johannes Schindelin
  2006-02-19 19:39     ` linux
                       ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Johannes Schindelin @ 2006-02-19 19:25 UTC (permalink / raw)
  To: Alex Riesen; +Cc: linux, Junio C Hamano, git

Hi,

can someone please enlighten me why you need to see the usage, when you 
cannot execute the command anyway?

Puzzled,
Dscho

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

* Re: [PATCH] git-rev-list --help anywhere
  2006-02-19 19:25   ` Johannes Schindelin
@ 2006-02-19 19:39     ` linux
  2006-02-19 19:40     ` A Large Angry SCM
  2006-02-20  5:52     ` Junio C Hamano
  2 siblings, 0 replies; 7+ messages in thread
From: linux @ 2006-02-19 19:39 UTC (permalink / raw)
  To: Johannes.Schindelin, raa.lkml; +Cc: git, junkio, linux

> can someone please enlighten me why you need to see the usage, when you 
> cannot execute the command anyway?

Because you're writing a script, or explaining it to someone over
the phone, or writing shell autocompletion macros, otherwise using
it in some kind of delayed or deferred way.

These ain't no steenkin GUI tools; they can be used in more ways
that typed interactively for immediate execution.

(Have you ever noticed how all the GUI people have rediscovered the
concept of a pathname and a single-character directory separator when
explaining how to navigate a menu/dialog maze?  The character '>' seems
to be popular.
	Go to menu A
	Then go to submenu B
	Then select item C to open a dialog
	Then go to tab D of that dialog.
	Then hit the "Advanced options" button
	Then select tab E of that dialog
	Then select option F
How exactly is this is an improvement over A/B/C/D/Advanced options/E/F?)

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

* Re: [PATCH] git-rev-list --help anywhere
  2006-02-19 19:25   ` Johannes Schindelin
  2006-02-19 19:39     ` linux
@ 2006-02-19 19:40     ` A Large Angry SCM
  2006-02-20  5:52     ` Junio C Hamano
  2 siblings, 0 replies; 7+ messages in thread
From: A Large Angry SCM @ 2006-02-19 19:40 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Alex Riesen, linux, Junio C Hamano, git

Johannes Schindelin wrote:
> Hi,
> 
> can someone please enlighten me why you need to see the usage, when you 
> cannot execute the command anyway?
> 
> Puzzled,
> Dscho

How about so that you can find the options needed to run the command in 
another window where it will work.

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

* Re: [PATCH] git-rev-list --help anywhere
  2006-02-19 19:25   ` Johannes Schindelin
  2006-02-19 19:39     ` linux
  2006-02-19 19:40     ` A Large Angry SCM
@ 2006-02-20  5:52     ` Junio C Hamano
  2 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2006-02-20  5:52 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Alex Riesen, linux, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> can someone please enlighten me why you need to see the usage, when you 
> cannot execute the command anyway?

I think Pasky gave rev-list just as an example, as I am sure
there are other lowlevel core tools, that share this same
unfriendliness.  Primarily, these tools are meant for scripting,
and not for end-user interactive use.  For this reason, it is
not high on my priority list to add --help to the lowlevel core
tools, although it would be nicer to have.

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

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

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-19 11:26 [PATCH] git-rev-list --help anywhere linux
2006-02-19 18:39 ` Alex Riesen
2006-02-19 19:25   ` Johannes Schindelin
2006-02-19 19:39     ` linux
2006-02-19 19:40     ` A Large Angry SCM
2006-02-20  5:52     ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2006-02-19 11:09 Alex Riesen

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