Skip to content

Commit 2e6a30e

Browse files
bebarinogitster
authored andcommitted
submodule, repack: migrate to git-sh-setup's say()
Now that there is say() in git-sh-setup, these scripts don't need to use their own. Migrate them over by setting GIT_QUIET and removing their custom say() functions. Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e064c17 commit 2e6a30e

File tree

2 files changed

+11
-25
lines changed

2 files changed

+11
-25
lines changed

git-repack.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SUBDIRECTORY_OK='Yes'
2424
. git-sh-setup
2525

2626
no_update_info= all_into_one= remove_redundant= unpack_unreachable=
27-
local= quiet= no_reuse= extra=
27+
local= no_reuse= extra=
2828
while test $# != 0
2929
do
3030
case "$1" in
@@ -33,7 +33,7 @@ do
3333
-A) all_into_one=t
3434
unpack_unreachable=--unpack-unreachable ;;
3535
-d) remove_redundant=t ;;
36-
-q) quiet=-q ;;
36+
-q) GIT_QUIET=t ;;
3737
-f) no_reuse=--no-reuse-object ;;
3838
-l) local=--local ;;
3939
--max-pack-size|--window|--window-memory|--depth)
@@ -80,13 +80,11 @@ case ",$all_into_one," in
8080
;;
8181
esac
8282

83-
args="$args $local $quiet $no_reuse$extra"
83+
args="$args $local ${GIT_QUIET:+-q} $no_reuse$extra"
8484
names=$(git pack-objects --honor-pack-keep --non-empty --all --reflog $args </dev/null "$PACKTMP") ||
8585
exit 1
8686
if [ -z "$names" ]; then
87-
if test -z "$quiet"; then
88-
echo Nothing new to pack.
89-
fi
87+
say Nothing new to pack.
9088
fi
9189

9290
# Ok we have prepared all new packfiles.
@@ -176,7 +174,7 @@ then
176174
done
177175
)
178176
fi
179-
git prune-packed $quiet
177+
git prune-packed ${GIT_QUIET:+-q}
180178
fi
181179

182180
case "$no_update_info" in

git-submodule.sh

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,11 @@ require_work_tree
1414

1515
command=
1616
branch=
17-
quiet=
1817
reference=
1918
cached=
2019
nofetch=
2120
update=
2221

23-
#
24-
# print stuff on stdout unless -q was specified
25-
#
26-
say()
27-
{
28-
if test -z "$quiet"
29-
then
30-
echo "$@"
31-
fi
32-
}
33-
3422
# Resolve relative url by appending to parent's url
3523
resolve_relative_url ()
3624
{
@@ -137,7 +125,7 @@ cmd_add()
137125
shift
138126
;;
139127
-q|--quiet)
140-
quiet=1
128+
GIT_QUIET=1
141129
;;
142130
--reference)
143131
case "$2" in '') usage ;; esac
@@ -273,7 +261,7 @@ cmd_init()
273261
do
274262
case "$1" in
275263
-q|--quiet)
276-
quiet=1
264+
GIT_QUIET=1
277265
;;
278266
--)
279267
shift
@@ -333,7 +321,7 @@ cmd_update()
333321
case "$1" in
334322
-q|--quiet)
335323
shift
336-
quiet=1
324+
GIT_QUIET=1
337325
;;
338326
-i|--init)
339327
init=1
@@ -650,7 +638,7 @@ cmd_status()
650638
do
651639
case "$1" in
652640
-q|--quiet)
653-
quiet=1
641+
GIT_QUIET=1
654642
;;
655643
--cached)
656644
cached=1
@@ -704,7 +692,7 @@ cmd_sync()
704692
do
705693
case "$1" in
706694
-q|--quiet)
707-
quiet=1
695+
GIT_QUIET=1
708696
shift
709697
;;
710698
--)
@@ -759,7 +747,7 @@ do
759747
command=$1
760748
;;
761749
-q|--quiet)
762-
quiet=1
750+
GIT_QUIET=1
763751
;;
764752
-b|--branch)
765753
case "$2" in

0 commit comments

Comments
 (0)