Skip to content

Commit 36e5e70

Browse files
torvaldsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3b0d999 commit 36e5e70

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,8 @@ check-sha1:: test-sha1$X
988988
check: common-cmds.h
989989
for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done
990990

991-
991+
remove-dashes:
992+
./fixup-builtins $(BUILT_INS)
992993

993994
### Installation rules
994995

fixup-builtins

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
while [ "$1" ]
3+
do
4+
old="$1"
5+
new=$(echo "$1" | sed 's/git-/git /')
6+
echo "Converting '$old' to '$new'"
7+
git ls-files '*.sh' | while read file
8+
do
9+
sed "s/\\<$old\\>/$new/g" < $file > $file.new
10+
chmod --reference=$file $file.new
11+
mv $file.new $file
12+
done
13+
shift
14+
done
15+
git update-index --refresh >& /dev/null
16+
exit 0

git-filter-branch.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ while read commit parents; do
384384

385385
sed -e '1,/^$/d' <../commit | \
386386
eval "$filter_msg" | \
387-
sh -c "$filter_commit" git-commit-tree $(git-write-tree) $parentstr | \
387+
sh -c "$filter_commit" "git-commit-tree" $(git-write-tree) $parentstr | \
388388
tee ../map/$commit
389389
done <../revs
390390

0 commit comments

Comments
 (0)