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 <lukeshu@datawire.io> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Luke Shumaker committed
Apr 27, 2021 at 15:17 UTC
6d43585a6865493b68e64f0b100ae801ed15d806
1 file changed
+7
-15
contrib/subtree/git-subtree.sh
+7
-15
@@ -30,7 +30,6 @@ squash merge subtree changes as a single commit
30
31
PATH=$PATH:$(git --exec-path)
32
33
-quiet=
33
branch=
34
debug=
35
command=
@@ -49,15 +48,8 @@ debug () {
48
fi
49
}
50
52
-say () {
53
- if test -z "$quiet"
54
- then
55
- printf "%s\n" "$*" >&2
56
- fi
57
-}
58
-
51
progress () {
60
- if test -z "$quiet"
52
+ if test -z "$GIT_QUIET"
53
then
54
printf "%s\r" "$*" >&2
55
fi
@@ -93,7 +85,7 @@ main () {
85
86
case "$opt" in
87
-q)
96
- quiet=1
88
+ GIT_QUIET=1
89
;;
90
-d)
91
debug=1
@@ -201,7 +193,7 @@ main () {
193
fi
194
195
debug "command: {$command}"
204
- debug "quiet: {$quiet}"
196
+ debug "quiet: {$GIT_QUIET}"
197
debug "revs: {$revs}"
198
debug "dir: {$dir}"
199
debug "opts: {$*}"
@@ -698,7 +690,7 @@ cmd_add () {
690
691
cmd_add_repository "$@"
692
else
701
- say "error: parameters were '$@'"
693
+ say >&2 "error: parameters were '$@'"
694
die "Provide either a commit or a repository and commit."
695
fi
696
}
@@ -742,7 +734,7 @@ cmd_add_commit () {
734
fi
735
git reset "$commit" || exit $?
736
745
- say "Added dir '$dir'"
737
+ say >&2 "Added dir '$dir'"
738
}
739
740
cmd_split () {
@@ -807,7 +799,7 @@ cmd_split () {
799
fi
800
git update-ref -m 'subtree split' \
801
"refs/heads/$branch" "$latest_new" || exit $?
810
- say "$action branch '$branch'"
802
+ say >&2 "$action branch '$branch'"
803
fi
804
echo "$latest_new"
805
exit 0
@@ -830,7 +822,7 @@ cmd_merge () {
822
sub=$2
823
if test "$sub" = "$rev"
824
then
833
- say "Subtree is already at commit $rev."
825
+ say >&2 "Subtree is already at commit $rev."
826
exit 0
827
fi
828
new=$(new_squash_commit "$old" "$sub" "$rev") || exit $?