aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2007-06-30 11:49:17 -0700
committerJunio C Hamano <gitster@pobox.com>2007-07-02 22:39:10 -0700
commit36e5e70e0f40cf7ca4351b8159d68f8560a2805f (patch)
tree88707e3a970dc518b267edcb3a7f8f13b5603874
parent3b0d9992ee9849cf12b16662f2b3c272e6792213 (diff)
downloadgit-36e5e70e0f40cf7ca4351b8159d68f8560a2805f.tar.gz
git-36e5e70e0f40cf7ca4351b8159d68f8560a2805f.tar.xz
Start deprecating "git-command" in favor of "git command"
I realize that a lot of people use the "git-xyzzy" format, and we have various historical reasons for it, but I also think that most people have long since started thinking of the git command as a single command with various subcommands, and we've long had the documentation talk about it that way. Slowly migrating away from the git-xyzzy format would allow us to eventually no longer install hundreds of binaries (even if most of them are symlinks or hardlinks) in users $PATH, and the _original_ reasons for it (implementation issues and bash completion) are really long long gone. Using "git xyzzy" also has some fundamental advantages, like the ability to specify things like paging ("git -p xyzzy") and making the whole notion of aliases act like other git commands (which they already do, but they do *not* have a "git-xyzzy" form!) Anyway, while actually removing the "git-xyzzy" things is not practical right now, we can certainly start slowly to deprecate it internally inside git itself - in the shell scripts we use, and the test vectors. This patch adds a "remove-dashes" makefile target, which does that. It isn't particularly efficient or smart, but it *does* successfully rewrite a lot of our shell scripts to use the "git xyzzy" form for all built-in commands. (For non-builtins, the "git xyzzy" format implies an extra execve(), so this script leaves those alone). So apply this patch, and then run make remove-dashes make test git commit -a to generate a much larger patch that actually starts this transformation. (The only half-way subtle thing about this is that it also fixes up git-filter-branch.sh for the new world order by adding quoting around the use of "git-commit-tree" as an argument. It doesn't need it in that format, but when changed into "git commit-tree" it is no longer a single word, and the quoting maintains the old behaviour). NOTE! This does not yet mean that you can actually stop installing the "git-xyzzy" binaries for the builtins. There are some remaining places that want to use the old form, this just removes the most obvious ones that can easily be done automatically. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--Makefile3
-rwxr-xr-xfixup-builtins16
-rw-r--r--git-filter-branch.sh2
3 files changed, 19 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 90597edfc..5b30e5c86 100644
--- a/Makefile
+++ b/Makefile
@@ -988,7 +988,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 000000000..49e861d2a
--- /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 a2fcebc1c..e9907598e 100644
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -384,7 +384,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