Skip to content

Commit 6d43585

Browse files
LukeShugitster
authored andcommitted
subtree: use git-sh-setup's say
subtree currently defines its own `say` implementation, rather than using git-sh-setups's implementation. Change that, don't re-invent the wheel. Signed-off-by: Luke Shumaker <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f664304 commit 6d43585

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

contrib/subtree/git-subtree.sh

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ squash merge subtree changes as a single commit
3030

3131
PATH=$PATH:$(git --exec-path)
3232

33-
quiet=
3433
branch=
3534
debug=
3635
command=
@@ -49,15 +48,8 @@ debug () {
4948
fi
5049
}
5150

52-
say () {
53-
if test -z "$quiet"
54-
then
55-
printf "%s\n" "$*" >&2
56-
fi
57-
}
58-
5951
progress () {
60-
if test -z "$quiet"
52+
if test -z "$GIT_QUIET"
6153
then
6254
printf "%s\r" "$*" >&2
6355
fi
@@ -93,7 +85,7 @@ main () {
9385

9486
case "$opt" in
9587
-q)
96-
quiet=1
88+
GIT_QUIET=1
9789
;;
9890
-d)
9991
debug=1
@@ -201,7 +193,7 @@ main () {
201193
fi
202194

203195
debug "command: {$command}"
204-
debug "quiet: {$quiet}"
196+
debug "quiet: {$GIT_QUIET}"
205197
debug "revs: {$revs}"
206198
debug "dir: {$dir}"
207199
debug "opts: {$*}"
@@ -698,7 +690,7 @@ cmd_add () {
698690

699691
cmd_add_repository "$@"
700692
else
701-
say "error: parameters were '$@'"
693+
say >&2 "error: parameters were '$@'"
702694
die "Provide either a commit or a repository and commit."
703695
fi
704696
}
@@ -742,7 +734,7 @@ cmd_add_commit () {
742734
fi
743735
git reset "$commit" || exit $?
744736

745-
say "Added dir '$dir'"
737+
say >&2 "Added dir '$dir'"
746738
}
747739

748740
cmd_split () {
@@ -807,7 +799,7 @@ cmd_split () {
807799
fi
808800
git update-ref -m 'subtree split' \
809801
"refs/heads/$branch" "$latest_new" || exit $?
810-
say "$action branch '$branch'"
802+
say >&2 "$action branch '$branch'"
811803
fi
812804
echo "$latest_new"
813805
exit 0
@@ -830,7 +822,7 @@ cmd_merge () {
830822
sub=$2
831823
if test "$sub" = "$rev"
832824
then
833-
say "Subtree is already at commit $rev."
825+
say >&2 "Subtree is already at commit $rev."
834826
exit 0
835827
fi
836828
new=$(new_squash_commit "$old" "$sub" "$rev") || exit $?

0 commit comments

Comments
 (0)