git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Bugfix: stop if directory already exists
@ 2005-11-13 14:03 Josef Weidendorfer
  2005-11-14  8:57 ` Junio C Hamano
  0 siblings, 1 reply; 8+ messages in thread
From: Josef Weidendorfer @ 2005-11-13 14:03 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Fix a typo: We do not want to run the directory as command,
and want to terminate if the directory exists
Additionally, update the usage message

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>

---

Regarding the usage: I do not think that on an error condition
the usage string should be outputted. This helps nothing:
either the user knows the usage, and can see what is wrong by
the error message, or he should look up the man page.
Should we use "git clone" or "git-clone" in the usage message?
Or perhaps
 usage: git clone ...
 For more details, see 'man git-clone'
?

 git-clone.sh |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

applies-to: 62fad3f1275b9bbf07fba50c328a3bd730c3454c
3de065bff303bd4caa433dfa685fdc1164be2b81
diff --git a/git-clone.sh b/git-clone.sh
index f99e0ad..c09979a 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -9,7 +9,7 @@
 unset CDPATH
 
 usage() {
-	echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> <dir>"
+	echo >&2 "* git clone [-l [-s]] [-q] [-u <upload-pack>] [-n] <repo> [<dir>]"
 	exit 1
 }
 
@@ -98,7 +98,7 @@ fi
 dir="$2"
 # Try using "humanish" part of source repo if user didn't specify one
 [ -z "$dir" ] && dir=$(echo "$repo" | sed -e 's|/$||' -e 's|:*/*\.git$||' -e 's|.*/||g')
-[ -e "$dir" ] && $(echo "$dir already exists."; usage)
+[ -e "$dir" ] && echo "$dir already exists." && usage
 mkdir -p "$dir" &&
 D=$(
 	(cd "$dir" && git-init-db && pwd)
---
0.99.9.GIT

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

* Re: [PATCH] Bugfix: stop if directory already exists
  2005-11-13 14:03 [PATCH] Bugfix: stop if directory already exists Josef Weidendorfer
@ 2005-11-14  8:57 ` Junio C Hamano
  2005-11-14  9:28   ` Andreas Ericsson
  2005-11-14  9:29   ` Josef Weidendorfer
  0 siblings, 2 replies; 8+ messages in thread
From: Junio C Hamano @ 2005-11-14  8:57 UTC (permalink / raw)
  To: Josef Weidendorfer; +Cc: git

Josef Weidendorfer <Josef.Weidendorfer@gmx.de> writes:

> Fix a typo: We do not want to run the directory as command,
> and want to terminate if the directory exists
> Additionally, update the usage message

Thanks.

> Should we use "git clone" or "git-clone" in the usage message?

I think "git clone" is probably preferred, given that we would
eventually want to be able to install them outside /usr/bin/,
leaving "git" wrapper (and very small number of other programs)
in /usr/bin/.

>  usage: git clone ...
>  For more details, see 'man git-clone'

My understanding of UNIX tradition of "usage:" is to be short
and sweet, to primarily help people who already know the command
but sometimes cannot remember how exactly the options are
spelled (e.g. "was that -F to specify the inter-field separator
to "sort" command?  Ah, no, it wants -t -- silly me must be
doing too much awk these days").  And "for more details see man"
goes without saying.

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

* Re: [PATCH] Bugfix: stop if directory already exists
  2005-11-14  8:57 ` Junio C Hamano
@ 2005-11-14  9:28   ` Andreas Ericsson
  2005-11-14 10:36     ` Josef Weidendorfer
  2005-11-14 21:30     ` Junio C Hamano
  2005-11-14  9:29   ` Josef Weidendorfer
  1 sibling, 2 replies; 8+ messages in thread
From: Andreas Ericsson @ 2005-11-14  9:28 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Josef Weidendorfer, git

Junio C Hamano wrote:
> 
>> usage: git clone ...
>> For more details, see 'man git-clone'
> 
> 
> And "for more details see man" goes without saying.
> 

But we name them differently, as hpa pointed out some week ago.

When I see "usage: <prog> <command>" I expect to find the info in "man 
<prog>". Soon, this will work to get the right page

	git --help <command>

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

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

* Re: [PATCH] Bugfix: stop if directory already exists
  2005-11-14  8:57 ` Junio C Hamano
  2005-11-14  9:28   ` Andreas Ericsson
@ 2005-11-14  9:29   ` Josef Weidendorfer
  2005-11-14  9:37     ` Andreas Ericsson
  1 sibling, 1 reply; 8+ messages in thread
From: Josef Weidendorfer @ 2005-11-14  9:29 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

On Monday 14 November 2005 09:57, Junio C Hamano wrote:
> Josef Weidendorfer <Josef.Weidendorfer@gmx.de> writes:
> >  usage: git clone ...
> >  For more details, see 'man git-clone'
> 
> doing too much awk these days").  And "for more details see man"
> goes without saying.

Of course; it was more about the current inconsistency: usage
says "git clone", but for the man page, you have to know that
there is an additional command "git-clone" with extra man page.
Usually, if I see e.g. "usage: cvs diff", I look up the man
page of "cvs" searching for "diff" on it, not "cvs-diff".

So just another suggestion: Why not put most of the
documentation in a huge "git" man page? cvs does this (3601 lines
here), all the shells have huge man pages (bash: 4794).
We would be in a good tradition ;-)

Josef

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

* Re: [PATCH] Bugfix: stop if directory already exists
  2005-11-14  9:29   ` Josef Weidendorfer
@ 2005-11-14  9:37     ` Andreas Ericsson
  0 siblings, 0 replies; 8+ messages in thread
From: Andreas Ericsson @ 2005-11-14  9:37 UTC (permalink / raw)
  To: git

Josef Weidendorfer wrote:
> So just another suggestion: Why not put most of the
> documentation in a huge "git" man page?

Becuase it's horrible. I like the fact that they are split up.

> cvs does this (3601 lines
> here), all the shells have huge man pages (bash: 4794).
> We would be in a good tradition ;-)
> 

We would be in tradition, but not necessarily a good one. Just because 
some stupid swede let some herrings ferment in a tin can some 800 years 
ago there's really no need to say "surströmming! What a clever idea!!" 
and actually eat the horrible things.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

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

* Re: [PATCH] Bugfix: stop if directory already exists
  2005-11-14  9:28   ` Andreas Ericsson
@ 2005-11-14 10:36     ` Josef Weidendorfer
  2005-11-14 10:47       ` Andreas Ericsson
  2005-11-14 21:30     ` Junio C Hamano
  1 sibling, 1 reply; 8+ messages in thread
From: Josef Weidendorfer @ 2005-11-14 10:36 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: Junio C Hamano, git

On Monday 14 November 2005 10:28, Andreas Ericsson wrote:
> But we name them differently, as hpa pointed out some week ago.
> 
> When I see "usage: <prog> <command>" I expect to find the info in "man 
> <prog>". Soon, this will work to get the right page
> 
> 	git --help <command>

This is a nice feature, but still needs educating the user.
I think that the idea of a huge git man page is not that bad; for sure,
it can be created automatically.

A huge man page helps searching a command name (Ah, what was the
command to see commit logs per file? What is the counterpart of
"cvs update" called?).

Josef

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

* Re: [PATCH] Bugfix: stop if directory already exists
  2005-11-14 10:36     ` Josef Weidendorfer
@ 2005-11-14 10:47       ` Andreas Ericsson
  0 siblings, 0 replies; 8+ messages in thread
From: Andreas Ericsson @ 2005-11-14 10:47 UTC (permalink / raw)
  To: git

Josef Weidendorfer wrote:
> On Monday 14 November 2005 10:28, Andreas Ericsson wrote:
> 
>>But we name them differently, as hpa pointed out some week ago.
>>
>>When I see "usage: <prog> <command>" I expect to find the info in "man 
>><prog>". Soon, this will work to get the right page
>>
>>	git --help <command>
> 
> 
> This is a nice feature, but still needs educating the user.

This feature goes away with the huge man-page.

> I think that the idea of a huge git man page is not that bad; for sure,
> it can be created automatically.
> 
> A huge man page helps searching a command name (Ah, what was the
> command to see commit logs per file?  What is the counterpart of
> "cvs update" called?).
> 

This is already implemented (sort of), but perhaps have both? Or 
pointers to the other man-pages from the "git" one (as is already sort 
of done).

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

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

* Re: [PATCH] Bugfix: stop if directory already exists
  2005-11-14  9:28   ` Andreas Ericsson
  2005-11-14 10:36     ` Josef Weidendorfer
@ 2005-11-14 21:30     ` Junio C Hamano
  1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2005-11-14 21:30 UTC (permalink / raw)
  To: Andreas Ericsson; +Cc: Josef Weidendorfer, git

Andreas Ericsson <ae@op5.se> writes:

> Junio C Hamano wrote:
>>
>>> usage: git clone ...
>>> For more details, see 'man git-clone'
>> And "for more details see man" goes without saying.
>
> But we name them differently, as hpa pointed out some week ago.
>
> When I see "usage: <prog> <command>" I expect to find the info in "man 
> <prog>".

... meaning, "man git", which would list the subcommands.

And a user who got "usage: git clone blah" and did "man git"
once is intelligent enough to know and remember "man git" lists
the subcommands, what she wanted to know about was listed as
"git-clone(1)", and she had to do "man git-clone", so next time
around we should be able to expect her to do "man git-commit".
Am I overestimating the users or overtaxing them?

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

end of thread, other threads:[~2005-11-14 21:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-13 14:03 [PATCH] Bugfix: stop if directory already exists Josef Weidendorfer
2005-11-14  8:57 ` Junio C Hamano
2005-11-14  9:28   ` Andreas Ericsson
2005-11-14 10:36     ` Josef Weidendorfer
2005-11-14 10:47       ` Andreas Ericsson
2005-11-14 21:30     ` Junio C Hamano
2005-11-14  9:29   ` Josef Weidendorfer
2005-11-14  9:37     ` Andreas Ericsson

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