Bugfix: stop if directory already exists
PATCH 1/1 Bugfix: stop if directory already exists
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
---
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
git-clone.sh +2 -2
@@ -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
Quoted 3 lines · Josef Weidendorfer
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.
Quoted 1 line
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/.
Quoted 2 lines
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.
Quoted 6 lines · Junio C Hamano
Quoted 2 lines · Josef Weidendorfer
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
Quoted 2 lines · Josef Weidendorfer
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.
Quoted 4 lines
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.
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Quoted 7 lines · Junio C Hamano
Quoted 3 lines
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>
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Quoted 6 lines · Andreas Ericsson
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
Quoted 10 lines · Josef Weidendorfer
Quoted 5 lines · Andreas Ericsson
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.
Quoted 7 lines
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).
Signature · 3 lines
Andreas Ericsson [email protected] OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231
Quoted 10 lines · Andreas Ericsson
Quoted 4 lines · Junio C Hamano
Quoted 3 lines
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?