threads / patch / 1482

patchUse "-script" postfix for scripts

Subject: [PATCH] Use "-script" postfix for scripts

## tl;dr

9 messages between Aug 12, 2005 and Aug 13, 2005. Diffs are folded; open one to read it.

replies: 8people: 5as markdown or json

Johannes Schindelin· Aug 12, 2005, 13:28 UTC · lore
For consistency reasons, the names of all scripts should end in "-script".
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---

This may be a bit controversial (people might find it unnecessary). Subject to discussion.

---
 Makefile                   |   15 ++++++++-------
 git-cherry-script          |    0 
 git-clone-dumb-http-script |    0 
 git-clone-script           |    2 +-
 git-rebase-script          |    4 ++--
 git-request-pull-script    |    4 ++--
 git-shortlog-script        |    0 
 git-whatchanged-script     |    0 
 8 files changed, 13 insertions(+), 12 deletions(-)
 rename git-cherry => git-cherry-script (100%)
 rename git-clone-dumb-http => git-clone-dumb-http-script (100%)
 rename git-shortlog => git-shortlog-script (100%)
 rename git-whatchanged => git-whatchanged-script (100%)
5cc55f08d874b61f1067857c7310fac325504ec8
Show changes to 8 files +13 −12

Makefile, git-cherry, git-clone-dumb-http, git-clone-script, git-rebase-script, git-request-pull-script, git-shortlog, git-whatchanged

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -58,15 +58,16 @@ SPARSE_FLAGS?=-D__BIG_ENDIAN__ -D__power
 
 
 SCRIPTS=git git-apply-patch-script git-merge-one-file-script git-prune-script \
-	git-pull-script git-tag-script git-resolve-script git-whatchanged \
-	git-fetch-script git-status-script git-commit-script \
-	git-log-script git-shortlog git-cvsimport-script git-diff-script \
-	git-reset-script git-add-script git-checkout-script git-clone-script \
-	gitk git-cherry git-rebase-script git-relink-script git-repack-script \
+	git-pull-script git-tag-script git-resolve-script \
+	git-whatchanged-script git-fetch-script git-status-script \
+	git-commit-script git-log-script git-shortlog-script \
+	git-cvsimport-script git-diff-script git-reset-script git-add-script \
+	git-checkout-script git-clone-script gitk git-cherry-script \
+	git-rebase-script git-relink-script git-repack-script \
 	git-format-patch-script git-sh-setup-script git-push-script \
 	git-branch-script git-parse-remote git-verify-tag-script \
-	git-ls-remote-script git-clone-dumb-http git-rename-script \
-	git-request-pull-script git-bisect-script
+	git-ls-remote-script git-clone-dumb-http-script \
+	git-rename-script git-request-pull-script git-bisect-script
 
 SCRIPTS += git-count-objects-script
 # SCRIPTS += git-send-email-script
diff --git a/git-cherry b/git-cherry-script
similarity index 100%
rename from git-cherry
rename to git-cherry-script
diff --git a/git-clone-dumb-http b/git-clone-dumb-http-script
similarity index 100%
rename from git-clone-dumb-http
rename to git-clone-dumb-http-script
diff --git a/git-clone-script b/git-clone-script
--- a/git-clone-script
+++ b/git-clone-script
@@ -89,7 +89,7 @@ yes,yes)
 		rsync $quiet -avz --ignore-existing "$repo/refs/" "$D/.git/refs/"
 		;;
 	http://*)
-		git-clone-dumb-http "$repo" "$D"
+		git-clone-dumb-http-script "$repo" "$D"
 		case "$?" in
 		2)
 			echo "Somebody should define smarter http server protocol" >&2
diff --git a/git-rebase-script b/git-rebase-script
--- a/git-rebase-script
+++ b/git-rebase-script
@@ -7,7 +7,7 @@
 
 usage="usage: $0 "'<upstream> [<head>]
 
-Uses output from git-cherry to rebase local commits to the new head of
+Uses output from git-cherry-script to rebase local commits to the new head of
 upstream tree.'
 
 case "$#,$1" in
@@ -36,7 +36,7 @@ trap "rm -rf $tmp-*" 0 1 2 3 15
 
 >$fail
 
-git-cherry $upstream $ours |
+git-cherry-script $upstream $ours |
 while read sign commit
 do
 	case "$sign" in
diff --git a/git-request-pull-script b/git-request-pull-script
--- a/git-request-pull-script
+++ b/git-request-pull-script
@@ -24,12 +24,12 @@ headrev=`git-rev-parse --verify $head^0`
 
 echo "The following changes since commit $baserev:"
 git log --max-count=1 --pretty=short "$baserev" |
-git-shortlog | sed -e 's/^\(.\)/  \1/'
+git-shortlog-script | sed -e 's/^\(.\)/  \1/'
 
 echo "are found in the git repository at:" 
 echo
 echo "  $url"
 echo
 
-git log  $baserev..$headrev | git-shortlog ;
+git log  $baserev..$headrev | git-shortlog-script ;
 git diff $baserev..$headrev | git-apply --stat --summary
diff --git a/git-shortlog b/git-shortlog-script
similarity index 100%
rename from git-shortlog
rename to git-shortlog-script
diff --git a/git-whatchanged b/git-whatchanged-script
similarity index 100%
rename from git-whatchanged
rename to git-whatchanged-script
Junio C Hamano· Aug 12, 2005, 15:32 UTC · re: Johannes Schindelin · lore

Re: [PATCH] Use "-script" postfix for scripts

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> For consistency reasons, the names of all scripts should end in "-script".
>
> This may be a bit controversial (people might find it unnecessary). 
> Subject to discussion.

I have never liked the original -script name convention. It only meant that they are implemented as scripts (as opposed to those on the $(PROG) Makefile variable), but the end users who end up typing their names from the command line, and to a lesser degree the people who use them in their scripts, should not care how they are implemented to begin with.

And to cope with long names and make things look a bit more familiar to CVS migrants, "git" wrapper was invented to supply the -script suffix to grok "git whatever", but just in case if something was _not_ implemented as a script, it ends up needing to try "git-whatever" in addition to "git-whatever-script". The patch alleviates the "git" problem for "git-whatchanged" and friends whose names currently do not end with -script, but it still does not help "git apply", for example. I like the general direction of making things consistent, but I wonder if we can become consistent by losing -script suffix, not adding to the ones that lack it.

And as you imply, this kind of change inevitable breaks people's scripts. But I do agree with you that we should do something about it, so it may be better to break them sooner rather than later, as long as we make sure we break them just once.

Johannes Schindelin· Aug 12, 2005, 16:00 UTC · re: Junio C Hamano · lore

Re: [PATCH] Use "-script" postfix for scripts

hI,
On Fri, 12 Aug 2005, Junio C Hamano wrote:
Show 8 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > For consistency reasons, the names of all scripts should end in "-script".
> >
> > This may be a bit controversial (people might find it unnecessary). 
> > Subject to discussion.
> 
> I have never liked the original -script name convention.
Okay. I'm all for dropping the "-script" postfix.

Ciao, Dscho

Linus Torvalds· Aug 12, 2005, 21:55 UTC · re: Junio C Hamano · lore

Re: [PATCH] Use "-script" postfix for scripts

On Fri, 12 Aug 2005, Junio C Hamano wrote:
Show 7 quoted lines
> 
> I have never liked the original -script name convention.  It
> only meant that they are implemented as scripts (as opposed to
> those on the $(PROG) Makefile variable), but the end users who
> end up typing their names from the command line, and to a lesser
> degree the people who use them in their scripts, should not care
> how they are implemented to begin with.

Well, end users _don't_ care, since they are supposed to use just a simple "git xxx".

The advantage with "git-xxx-script" is for git developers: at least yours truly does "grep xyz *.c" all the time, and the "grep abc *-script" is entirely analogous to that. That's where the "-script" ending comes from: it really helps pick out the stuff you can grep from (as opposed to the stuff that got compiled and isn't greppable).

Sure, I could have called it ".sh" instead to make it look even more like a shell script thing, but I actually think "-script" describes any scripting language - shell, perl, you name it..

			Linus
Ryan Anderson· Aug 12, 2005, 22:27 UTC · re: Linus Torvalds · lore

Re: [PATCH] Use "-script" postfix for scripts

On Fri, Aug 12, 2005 at 02:55:01PM -0700, Linus Torvalds wrote:
> 
> Sure, I could have called it ".sh" instead to make it look even more like 
> a shell script thing, but I actually think "-script" describes any 
> scripting language - shell, perl, you name it..
See, for example, the history on git-rename-script for why this is good.
-- 
Ryan Anderson
  sometimes Pug Majere
Junio C Hamano· Aug 13, 2005, 08:57 UTC · re: Ryan Anderson · lore

Re: [PATCH] Use "-script" postfix for scripts

Ryan Anderson <ryan@michonline.com> writes:
> See, for example, the history on git-rename-script for why this is good.

Why do you think it is a good example? What happens when next time somebody rewrites it in C?

Linus Torvalds· Aug 13, 2005, 16:35 UTC · re: Junio C Hamano · lore

Re: [PATCH] Use "-script" postfix for scripts

On Sat, 13 Aug 2005, Junio C Hamano wrote:
Show 5 quoted lines
> Ryan Anderson <ryan@michonline.com> writes:
> > See, for example, the history on git-rename-script for why this is good.
> 
> Why do you think it is a good example?  What happens when next
> time somebody rewrites it in C?

We'll call the C version "rename.c", and the program gets to be called "git-rename", and "git rename" continues to work perfectly fine, so users won't be affected in the least.

And "grep ... *.c" and "grep ... *-script" also still work right.
That sounds like a good outcome to me.
		Linus
Ryan Anderson· Aug 13, 2005, 22:25 UTC · re: Junio C Hamano · lore

Re: [PATCH] Use "-script" postfix for scripts

On Sat, Aug 13, 2005 at 01:57:22AM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> Ryan Anderson <ryan@michonline.com> writes:
> 
> > See, for example, the history on git-rename-script for why this is good.
> 
> Why do you think it is a good example?  What happens when next
> time somebody rewrites it in C?

Well, I was really responding to the comment about "-script" being better than ".sh", as trying ".sh", ".pl", ".php", etc, would rapidly be annoying.

Honestly, I think the biggest argument against the "-script" suffix is related to man-page usage: It requires significant knowledge of the Git project to figure out what name variant to use to find the man page.

(There are other problems with man pages, but I'll address those seperately now that they have occurred to me.)

-- 
Ryan Anderson
  sometimes Pug Majere
Petr Baudis· Aug 13, 2005, 22:28 UTC · re: Ryan Anderson · lore

Re: [PATCH] Use "-script" postfix for scripts

Dear diary, on Sun, Aug 14, 2005 at 12:25:12AM CEST, I got a letter where Ryan Anderson <ryan@michonline.com> told me that...

> Honestly, I think the biggest argument against the "-script" suffix is
> related to man-page usage:  It requires significant knowledge of the Git
> project to figure out what name variant to use to find the man page.
.oO(Hey, tcl has own man section as well!)
-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
If you want the holes in your knowledge showing up try teaching
someone.  -- Alan Cox

← back to recent threads