git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Start deprecating "git-command" in favor of "git command"
Date: Sat, 30 Jun 2007 12:43:55 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.0.98.0706301231200.1172@woody.linux-foundation.org> (raw)
In-Reply-To: <7vy7i1b6bt.fsf@assigned-by-dhcp.cox.net>



On Sat, 30 Jun 2007, Junio C Hamano wrote:
> 
> In the longer run, we may want to allow "git foo" to alias to
> "git foo --preferred-options", although we currently do not
> allow such an alias.  Scripts, especially the ones we ship,
> would not want to be confused by the user aliases when that
> happens.

I agree. And I think our current behaviour is the correct one.

> So I am somewhat negative on this, unless there is a way for
> scripts to say "Even though I say 'git foo', I do mean 'git foo'
> not whatever the user has aliased".

Well, we have a more serious issue, that is related, but has nothing to do 
with aliases.

If you set an environment variable "diff.color=always", any script will 
get that behaviour, and not work the way it might expect.

My point being that this has nothing to do with "git-diff" vs "git diff", 
and everything to do with default configurations. If you don't want people 
to be able to change fixed behaviour, you'd need to have a way to disable 
it.

Quite frankly, I think it's _easier_ to disable with "git xyzzy" than with 
"git-xyzzy", but hey, not a big deal. With "git xyzzy", we could add a 
generic flag like

	git - xyzzy

to make the rule be that no configurations (_including_ aliases) are 
allowed to override default behaviour, which is much harder with the 
"git-xyzzy" format (since then it's invariably a per-command thing).

That said, I'm not going to push that patch very hard.

Especially as I just realized that it had a bug: it caused things like

	-our \$logo = "file:///$(pwd)/../../gitweb/git-logo.png";
	+our \$logo = "file:///$(pwd)/../../gitweb/git logo.png";

because "git-log" got rewritten as "git log", without checking that it was 
a proper word.

I have a fixed version already (just make the sed script use \<..\> around 
the pattern - appended here), but as mentioned, I don't think this is a 
hugely important issue. I prefer the "git cmd" form, but if we want to 
maintain "git-cmd" forever, then hey...

		Linus
---

Fixed the sed pattern a bit..

 Makefile             |    3 ++-
 fixup-builtins       |   16 ++++++++++++++++
 git-filter-branch.sh |    2 +-
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index a98e27a..1620ef8 100644
--- a/Makefile
+++ b/Makefile
@@ -987,7 +987,8 @@ check-sha1:: test-sha1$X
 check: common-cmds.h
 	for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done
 
-
+remove-dashes:
+	./fixup-builtins $(BUILT_INS)
 
 ### Installation rules
 
diff --git a/fixup-builtins b/fixup-builtins
new file mode 100755
index 0000000..49e861d
--- /dev/null
+++ b/fixup-builtins
@@ -0,0 +1,16 @@
+#!/bin/sh
+while [ "$1" ]
+do
+	old="$1"
+	new=$(echo "$1" | sed 's/git-/git /')
+	echo "Converting '$old' to '$new'"
+	git ls-files '*.sh' | while read file
+	do
+		sed "s/\\<$old\\>/$new/g" < $file > $file.new
+		chmod --reference=$file $file.new
+		mv $file.new $file
+	done
+	shift
+done
+git update-index --refresh >& /dev/null
+exit 0
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 8fa5ce6..0f54271 100644
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -383,7 +383,7 @@ while read commit parents; do
 
 	sed -e '1,/^$/d' <../commit | \
 		eval "$filter_msg" | \
-		sh -c "$filter_commit" git-commit-tree $(git-write-tree) $parentstr | \
+		sh -c "$filter_commit" "git-commit-tree" $(git-write-tree) $parentstr | \
 		tee ../map/$commit
 done <../revs
 

  parent reply	other threads:[~2007-06-30 19:44 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-30 18:49 Start deprecating "git-command" in favor of "git command" Linus Torvalds
2007-06-30 19:17 ` Junio C Hamano
2007-06-30 19:43   ` Yann Dirson
2007-07-01  2:25     ` Junio C Hamano
2007-07-01  3:01       ` Linus Torvalds
2007-07-01  3:32         ` Junio C Hamano
2007-07-01 12:12           ` Johannes Schindelin
2007-07-01 18:16             ` Junio C Hamano
2007-07-03  2:56           ` Nicolas Pitre
2007-07-03  3:50             ` Junio C Hamano
2007-06-30 19:43   ` Linus Torvalds [this message]
2007-06-30 20:08     ` Junio C Hamano
2007-06-30 20:22   ` Junio C Hamano
2007-07-01  8:22   ` Jeff King
2007-07-01 13:48     ` Johannes Schindelin
2007-07-01 21:11       ` Josh Triplett
2007-06-30 20:34 ` walt
2007-06-30 21:37   ` Johannes Schindelin
2007-06-30 22:40     ` walt
2007-07-01 13:47     ` Yann Dirson
  -- strict thread matches above, loose matches on Subject: below --
2007-07-01  0:45 linux
2007-07-01  1:48 ` eschvoca
2007-07-01  3:00   ` Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.0.98.0706301231200.1172@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).