# [PATCH 0/5] Extend make remove-dashes

9 messages from 2008-07-11 to 2008-07-13. Participants: Miklos Vajna, Christian Couder, Junio C Hamano.
Thread: https://gitlist.dev/t/14405

## Miklos Vajna, 2008-07-11 00:12

Subject: [PATCH 0/5] Extend make remove-dashes
Message-ID: <cover.1215734604.git.vmiklos@frugalware.org>
URL: https://gitlist.dev/e/cover.1215734604.git.vmiklos%40frugalware.org

```
Hi,

This series extends what make remove-dashes did so far, now it uses not
only builtins but other programs (git-daemon, etc.) and the shell/perl
scripts as well.

The first two patch does minor changes to avoid unwanted renames.

The third patch changes the output of git bisect log to use a dash-less
form.

The 4th patch updates Linus' fixup-builtins script. It was used to
generate the last 'huge' patch.

The idea behind this series is to avoid commands in the source code and
tests which is not available in PATH; in other words I *think* is not a
'necessary' but a 'sooner or later we will have to do this' series.

The last patch is more a demonstration than a patch for inclusion at the
moment, since problem this is not the right time to do such a big
rename.

Miklos Vajna (5):
  t0001-init.sh: change confusing directory name
  t1007-hash-object.sh: use quotes for the test description
  git-bisect: use dash-less form on git bisect log
  make remove-dashes: apply to scripts and programs as well, not just
    to builtins
  Rewrite "git-frotz" to "git frotz" for scripts and programs as well

 Makefile                             |    2 +-
 contrib/examples/git-checkout.sh     |    2 +-
 contrib/examples/git-clean.sh        |    2 +-
 contrib/examples/git-clone.sh        |   24 ++--
 contrib/examples/git-commit.sh       |    6 +-
 contrib/examples/git-fetch.sh        |    6 +-
 contrib/examples/git-gc.sh           |    2 +-
 contrib/examples/git-ls-remote.sh    |    2 +-
 contrib/examples/git-resolve.sh      |    4 +-
 contrib/examples/git-revert.sh       |   22 ++--
 contrib/examples/git-tag.sh          |    6 +-
 fixup-builtins                       |   18 +-
 git-am.sh                            |   22 ++--
 git-bisect.sh                        |   10 +-
 git-instaweb.sh                      |    4 +-
 git-merge-octopus.sh                 |    2 +-
 git-merge-one-file.sh                |    8 +-
 git-merge-resolve.sh                 |    2 +-
 git-merge.sh                         |   10 +-
 git-parse-remote.sh                  |    6 +-
 git-pull.sh                          |   10 +-
 git-quiltimport.sh                   |    2 +-
 git-rebase.sh                        |   14 +-
 git-repack.sh                        |   12 +-
 git-sh-setup.sh                      |    2 +-
 git-stash.sh                         |   10 +-
 git-submodule.sh                     |   12 +-
 git-web--browse.sh                   |    2 +-
 t/t0001-init.sh                      |    6 +-
 t/t0050-filesystem.sh                |    2 +-
 t/t1007-hash-object.sh               |    2 +-
 t/t1200-tutorial.sh                  |    2 +-
 t/t1303-wacky-config.sh              |    2 +-
 t/t1400-update-ref.sh                |   10 +-
 t/t1503-rev-parse-verify.sh          |    2 +-
 t/t2005-checkout-index-symlinks.sh   |    4 +-
 t/t2050-git-dir-relative.sh          |    4 +-
 t/t2101-update-index-reupdate.sh     |    2 +-
 t/t2102-update-index-symlinks.sh     |    2 +-
 t/t2200-add-update.sh                |   12 +-
 t/t3001-ls-files-others-exclude.sh   |    2 +-
 t/t3020-ls-files-error-unmatch.sh    |    2 +-
 t/t3030-merge-recursive.sh           |   14 +-
 t/t3200-branch.sh                    |   58 +++---
 t/t3210-pack-refs.sh                 |    4 +-
 t/t3400-rebase.sh                    |    6 +-
 t/t3401-rebase-partial.sh            |   22 ++--
 t/t3403-rebase-skip.sh               |    2 +-
 t/t3404-rebase-interactive.sh        |    2 +-
 t/t3407-rebase-abort.sh              |    2 +-
 t/t3500-cherry.sh                    |   12 +-
 t/t3600-rm.sh                        |    4 +-
 t/t3800-mktag.sh                     |   12 +-
 t/t3900-i18n-commit.sh               |    6 +-
 t/t3901-i18n-patch.sh                |   16 +-
 t/t3903-stash.sh                     |    2 +-
 t/t4012-diff-binary.sh               |    4 +-
 t/t4103-apply-binary.sh              |   26 ++--
 t/t4124-apply-ws-rule.sh             |    2 +-
 t/t4127-apply-same-fn.sh             |    4 +-
 t/t4150-am.sh                        |    2 +-
 t/t5300-pack-object.sh               |   14 +-
 t/t5301-sliding-window.sh            |    4 +-
 t/t5302-pack-index.sh                |   12 +-
 t/t5400-send-pack.sh                 |   30 ++--
 t/t5401-update-hooks.sh              |    4 +-
 t/t5402-post-merge-hook.sh           |    4 +-
 t/t5403-post-checkout-hook.sh        |    4 +-
 t/t5500-fetch-pack.sh                |    4 +-
 t/t5510-fetch.sh                     |    2 +-
 t/t5530-upload-pack-error.sh         |    4 +-
 t/t5600-clone-fail-cleanup.sh        |   12 +-
 t/t6006-rev-list-format.sh           |    6 +-
 t/t6025-merge-symlinks.sh            |   32 ++--
 t/t6026-merge-attr.sh                |   12 +-
 t/t6030-bisect-porcelain.sh          |    4 +-
 t/t6120-describe.sh                  |   30 ++--
 t/t6300-for-each-ref.sh              |   28 ++--
 t/t7001-mv.sh                        |   12 +-
 t/t7003-filter-branch.sh             |   20 +-
 t/t7004-tag.sh                       |  318 +++++++++++++++++-----------------
 t/t7101-reset.sh                     |    8 +-
 t/t7102-reset.sh                     |    4 +-
 t/t7103-reset-bare.sh                |    2 +-
 t/t7201-co.sh                        |    2 +-
 t/t7300-clean.sh                     |   76 ++++----
 t/t7400-submodule-basic.sh           |   48 +++---
 t/t7401-submodule-summary.sh         |    2 +-
 t/t7500-commit.sh                    |    2 +-
 t/t7501-commit.sh                    |   48 +++---
 t/t7502-status.sh                    |    2 +-
 t/t7505-prepare-commit-msg-hook.sh   |    2 +-
 t/t7506-status-submodule.sh          |    2 +-
 t/t7600-merge.sh                     |    2 +-
 t/t7610-mergetool.sh                 |    2 +-
 t/t7701-repack-unpack-unreachable.sh |    2 +-
 t/t9001-send-email.sh                |    2 +-
 t/t9101-git-svn-props.sh             |   28 ++--
 t/t9119-git-svn-info.sh              |   44 +++---
 t/t9200-git-cvsexportcommit.sh       |   14 +-
 t/t9300-fast-import.sh               |   66 ++++----
 t/t9301-fast-export.sh               |    2 +-
 t/t9400-git-cvsserver-server.sh      |   40 ++--
 t/t9401-git-cvsserver-crlf.sh        |   10 +-
 t/t9600-cvsimport.sh                 |    2 +-
 t/t9700-perl-git.sh                  |   16 +-
 106 files changed, 731 insertions(+), 731 deletions(-)

```

## Miklos Vajna, 2008-07-11 00:12

Subject: [PATCH 1/5] t0001-init.sh: change confusing directory name
Message-ID: <8275a6b4a676d33a1ae80f29f85c52b7bbda9a84.1215734605.git.vmiklos@frugalware.org>
URL: https://gitlist.dev/e/8275a6b4a676d33a1ae80f29f85c52b7bbda9a84.1215734605.git.vmiklos%40frugalware.org
In-Reply-To: <cover.1215734604.git.vmiklos@frugalware.org>

```
using git-init as directory name confused 'make remove-dashes', so just
drop the 'git-' prefix.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 t/t0001-init.sh |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index d31887f..2a38d98 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -83,11 +83,11 @@ test_expect_success 'init --bare' '
 
 	(
 		unset GIT_DIR GIT_WORK_TREE GIT_CONFIG
-		mkdir git-init-bare.git &&
-		cd git-init-bare.git &&
+		mkdir init-bare.git &&
+		cd init-bare.git &&
 		git init --bare
 	) &&
-	check_config git-init-bare.git true unset
+	check_config init-bare.git true unset
 '
 
 test_expect_success 'GIT_DIR non-bare' '
-- 
1.5.6.2.450.g8d367.dirty

```

## Miklos Vajna, 2008-07-11 00:12

Subject: [PATCH 2/5] t1007-hash-object.sh: use quotes for the test description
Message-ID: <9568dd5d03cd0f1da8872fd71f8bb253560e2352.1215734605.git.vmiklos@frugalware.org>
URL: https://gitlist.dev/e/9568dd5d03cd0f1da8872fd71f8bb253560e2352.1215734605.git.vmiklos%40frugalware.org
In-Reply-To: <8275a6b4a676d33a1ae80f29f85c52b7bbda9a84.1215734605.git.vmiklos@frugalware.org>

```
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 t/t1007-hash-object.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/t/t1007-hash-object.sh b/t/t1007-hash-object.sh
index 0526295..1ec0535 100755
--- a/t/t1007-hash-object.sh
+++ b/t/t1007-hash-object.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-test_description=git-hash-object
+test_description="git-hash-object"
 
 . ./test-lib.sh
 
-- 
1.5.6.2.450.g8d367.dirty

```

## Miklos Vajna, 2008-07-11 00:12

Subject: [PATCH 3/5] git-bisect: use dash-less form on git bisect log
Message-ID: <eb505d0d8f7d2bf50073414baa799a80a9df7453.1215734605.git.vmiklos@frugalware.org>
URL: https://gitlist.dev/e/eb505d0d8f7d2bf50073414baa799a80a9df7453.1215734605.git.vmiklos%40frugalware.org
In-Reply-To: <9568dd5d03cd0f1da8872fd71f8bb253560e2352.1215734605.git.vmiklos@frugalware.org>

```
Given that users are supposed to type 'git bisect' now, make the output
of 'git bisect log' consistent with this.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 git-bisect.sh |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 991b2ef..f4852a9 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -149,7 +149,7 @@ bisect_start() {
 	echo "$start_head" >"$GIT_DIR/BISECT_START" &&
 	sq "$@" >"$GIT_DIR/BISECT_NAMES" &&
 	eval "$eval" &&
-	echo "git-bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG" || exit
+	echo "git bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG" || exit
 	#
 	# Check if we can proceed to the next bisect state.
 	#
@@ -169,7 +169,7 @@ bisect_write() {
 	esac
 	git update-ref "refs/bisect/$tag" "$rev" || exit
 	echo "# $state: $(git show-branch $rev)" >>"$GIT_DIR/BISECT_LOG"
-	test -n "$nolog" || echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
+	test -n "$nolog" || echo "git bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
 }
 
 bisect_state() {
@@ -426,9 +426,9 @@ bisect_clean_state() {
 bisect_replay () {
 	test -r "$1" || die "cannot read $1 for replaying"
 	bisect_reset
-	while read bisect command rev
+	while read git bisect command rev
 	do
-		test "$bisect" = "git-bisect" || continue
+		test "$git $bisect" = "git bisect" || continue
 		case "$command" in
 		start)
 			cmd="bisect_start $rev"
-- 
1.5.6.2.450.g8d367.dirty

```

## Miklos Vajna, 2008-07-11 00:12

Subject: [PATCH 4/5] make remove-dashes: apply to scripts and programs as well, not just to builtins
Message-ID: <581f7ee17a4fb122f4df258d9cc0631b763fe9e1.1215734605.git.vmiklos@frugalware.org>
URL: https://gitlist.dev/e/581f7ee17a4fb122f4df258d9cc0631b763fe9e1.1215734605.git.vmiklos%40frugalware.org
In-Reply-To: <eb505d0d8f7d2bf50073414baa799a80a9df7453.1215734605.git.vmiklos@frugalware.org>

```
All programs and scripts are now moved outside PATH, so it's a good idea
not to use the dashed forms for them, either.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---
 Makefile       |    2 +-
 fixup-builtins |   18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/Makefile b/Makefile
index 4796565..2b54d92 100644
--- a/Makefile
+++ b/Makefile
@@ -1296,7 +1296,7 @@ check: common-cmds.h
 	for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done
 
 remove-dashes:
-	./fixup-builtins $(BUILT_INS)
+	./fixup-builtins $(BUILT_INS) $(PROGRAMS) $(SCRIPTS)
 
 ### Installation rules
 
diff --git a/fixup-builtins b/fixup-builtins
index 49e861d..63dfa4c 100755
--- a/fixup-builtins
+++ b/fixup-builtins
@@ -1,16 +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
+	if [ "$1" != "git-sh-setup" -a "$1" != "git-parse-remote" -a "$1" != "git-svn" ]; then
+		old="$1"
+		new=$(echo "$1" | sed 's/git-/git /')
+		echo "Converting '$old' to '$new'"
+		sed -i "s/\\<$old\\>/$new/g" $(git ls-files '*.sh')
+	fi
 	shift
 done
+
+sed -i 's/git merge-one-file/git-merge-one-file/g
+s/git rebase-todo/git-rebase-todo/g' $(git ls-files '*.sh')
 git update-index --refresh >& /dev/null
 exit 0
-- 
1.5.6.2.450.g8d367.dirty

```

## Christian Couder, 2008-07-11 06:39

Subject: Re: [PATCH 3/5] git-bisect: use dash-less form on git bisect log
Message-ID: <200807110839.14764.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/200807110839.14764.chriscool%40tuxfamily.org
In-Reply-To: <eb505d0d8f7d2bf50073414baa799a80a9df7453.1215734605.git.vmiklos@frugalware.org>

```
Le vendredi 11 juillet 2008, Miklos Vajna a écrit :
> Given that users are supposed to type 'git bisect' now, make the output
> of 'git bisect log' consistent with this.
>
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
>  git-bisect.sh |    8 ++++----
>  1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/git-bisect.sh b/git-bisect.sh
> index 991b2ef..f4852a9 100755
> --- a/git-bisect.sh
> +++ b/git-bisect.sh
> @@ -149,7 +149,7 @@ bisect_start() {
>  	echo "$start_head" >"$GIT_DIR/BISECT_START" &&
>  	sq "$@" >"$GIT_DIR/BISECT_NAMES" &&
>  	eval "$eval" &&
> -	echo "git-bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG" || exit
> +	echo "git bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG" || exit
>  	#
>  	# Check if we can proceed to the next bisect state.
>  	#
> @@ -169,7 +169,7 @@ bisect_write() {
>  	esac
>  	git update-ref "refs/bisect/$tag" "$rev" || exit
>  	echo "# $state: $(git show-branch $rev)" >>"$GIT_DIR/BISECT_LOG"
> -	test -n "$nolog" || echo "git-bisect $state $rev"
> >>"$GIT_DIR/BISECT_LOG" +	test -n "$nolog" || echo "git bisect $state
> $rev" >>"$GIT_DIR/BISECT_LOG" }
>
>  bisect_state() {
> @@ -426,9 +426,9 @@ bisect_clean_state() {
>  bisect_replay () {
>  	test -r "$1" || die "cannot read $1 for replaying"
>  	bisect_reset
> -	while read bisect command rev
> +	while read git bisect command rev
>  	do
> -		test "$bisect" = "git-bisect" || continue
> +		test "$git $bisect" = "git bisect" || continue
>  		case "$command" in
>  		start)
>  			cmd="bisect_start $rev"

Wouldn't it be better if bisect_replay could read old logs?

Maybe with something like:

+	while read git bisect command rev
 	do
-		test "$bisect" = "git-bisect" || continue
+		test "$git $bisect" = "git bisect" -o "$git" = "git-bisect" || continue
+		if test "$git" = "git-bisect"; then
+			rev="$command"
+			command="$bisect"
+		fi
 		case "$command" in
 		start)
 			cmd="bisect_start $rev"

Thanks,
Christian.

```

## Miklos Vajna, 2008-07-11 16:01

Subject: [PATCH] git-bisect: use dash-less form on git bisect log
Message-ID: <1215792089-27201-1-git-send-email-vmiklos@frugalware.org>
URL: https://gitlist.dev/e/1215792089-27201-1-git-send-email-vmiklos%40frugalware.org
In-Reply-To: <200807110839.14764.chriscool@tuxfamily.org>

```
Given that users are supposed to type 'git bisect' now, make the output
of 'git bisect log' consistent with this.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
---

On Fri, Jul 11, 2008 at 08:39:14AM +0200, Christian Couder <chriscool@tuxfamily.org> wrote:
> Wouldn't it be better if bisect_replay could read old logs?
>
> Maybe with something like:
>
> +     while read git bisect command rev
>       do
> -             test "$bisect" = "git-bisect" || continue
> +             test "$git $bisect" = "git bisect" -o "$git" =
> "git-bisect" || continue
> +             if test "$git" = "git-bisect"; then
> +                     rev="$command"
> +                     command="$bisect"
> +             fi

You are right, here is an updated patch.

 git-bisect.sh |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 991b2ef..3cac20d 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -149,7 +149,7 @@ bisect_start() {
 	echo "$start_head" >"$GIT_DIR/BISECT_START" &&
 	sq "$@" >"$GIT_DIR/BISECT_NAMES" &&
 	eval "$eval" &&
-	echo "git-bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG" || exit
+	echo "git bisect start$orig_args" >>"$GIT_DIR/BISECT_LOG" || exit
 	#
 	# Check if we can proceed to the next bisect state.
 	#
@@ -169,7 +169,7 @@ bisect_write() {
 	esac
 	git update-ref "refs/bisect/$tag" "$rev" || exit
 	echo "# $state: $(git show-branch $rev)" >>"$GIT_DIR/BISECT_LOG"
-	test -n "$nolog" || echo "git-bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
+	test -n "$nolog" || echo "git bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
 }
 
 bisect_state() {
@@ -426,9 +426,13 @@ bisect_clean_state() {
 bisect_replay () {
 	test -r "$1" || die "cannot read $1 for replaying"
 	bisect_reset
-	while read bisect command rev
+	while read git bisect command rev
 	do
-		test "$bisect" = "git-bisect" || continue
+		test "$git $bisect" = "git bisect" -o "$git" = "git-bisect" || continue
+		if test "$git" = "git-bisect"; then
+			rev="$command"
+			command="$bisect"
+		fi
 		case "$command" in
 		start)
 			cmd="bisect_start $rev"
-- 
1.5.6.2.450.g8d367.dirty

```

## Christian Couder, 2008-07-13 06:19

Subject: Re: [PATCH] git-bisect: use dash-less form on git bisect log
Message-ID: <200807130819.24206.chriscool@tuxfamily.org>
URL: https://gitlist.dev/e/200807130819.24206.chriscool%40tuxfamily.org
In-Reply-To: <1215792089-27201-1-git-send-email-vmiklos@frugalware.org>

```
Le vendredi 11 juillet 2008, Miklos Vajna a écrit :
> Given that users are supposed to type 'git bisect' now, make the output
> of 'git bisect log' consistent with this.
>
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
> ---
>
> On Fri, Jul 11, 2008 at 08:39:14AM +0200, Christian Couder 
<chriscool@tuxfamily.org> wrote:
> > Wouldn't it be better if bisect_replay could read old logs?
> >
> > Maybe with something like:
> >
> > +     while read git bisect command rev
> >       do
> > -             test "$bisect" = "git-bisect" || continue
> > +             test "$git $bisect" = "git bisect" -o "$git" =
> > "git-bisect" || continue
> > +             if test "$git" = "git-bisect"; then
> > +                     rev="$command"
> > +                     command="$bisect"
> > +             fi
>
> You are right, here is an updated patch.

Your patch looks good. But there is also the problem that new bisect logs 
will not be understood by old git. So I wonder if a patch to only read the 
new log should be first commited to the "maint" branch.

And sorry but I will be on vacation without Internet access for one week 
starting really soon now, so I will not be able to do anything soon, nor 
answer to any mails.

Thanks,
Christian.

```

## Junio C Hamano, 2008-07-13 21:26

Subject: Re: [PATCH] git-bisect: use dash-less form on git bisect log
Message-ID: <7vk5fpqxum.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vk5fpqxum.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <200807130819.24206.chriscool@tuxfamily.org>

```
Christian Couder <chriscool@tuxfamily.org> writes:

> Your patch looks good. But there is also the problem that new bisect logs 
> will not be understood by old git. So I wonder if a patch to only read the 
> new log should be first commited to the "maint" branch.

I do not think it is worth it.  If we are making something long lived like
rerere cache backward incompatible, the approach would be sensible, but
bisect log is about a single session and once you reached the breakage you
would not reuse it.  Besides, the bisect log is designed to be executable
shell script so you can always copy it out, edit it if needed and feed
that to shell.

```
