Skip to content

Commit

Permalink
submodule, repack: migrate to git-sh-setup's say()
Browse files Browse the repository at this point in the history
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 <bebarino@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Stephen Boyd authored and Junio C Hamano committed Jun 18, 2009
1 parent e064c17 commit 2e6a30e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 25 deletions.
12 changes: 5 additions & 7 deletions git-repack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ SUBDIRECTORY_OK='Yes'
. git-sh-setup

no_update_info= all_into_one= remove_redundant= unpack_unreachable=
local= quiet= no_reuse= extra=
local= no_reuse= extra=
while test $# != 0
do
case "$1" in
Expand All @@ -33,7 +33,7 @@ do
-A) all_into_one=t
unpack_unreachable=--unpack-unreachable ;;
-d) remove_redundant=t ;;
-q) quiet=-q ;;
-q) GIT_QUIET=t ;;
-f) no_reuse=--no-reuse-object ;;
-l) local=--local ;;
--max-pack-size|--window|--window-memory|--depth)
Expand Down Expand Up @@ -80,13 +80,11 @@ case ",$all_into_one," in
;;
esac

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

# Ok we have prepared all new packfiles.
Expand Down Expand Up @@ -176,7 +174,7 @@ then
done
)
fi
git prune-packed $quiet
git prune-packed ${GIT_QUIET:+-q}
fi

case "$no_update_info" in
Expand Down
24 changes: 6 additions & 18 deletions git-submodule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,11 @@ require_work_tree

command=
branch=
quiet=
reference=
cached=
nofetch=
update=

#
# print stuff on stdout unless -q was specified
#
say()
{
if test -z "$quiet"
then
echo "$@"
fi
}

# Resolve relative url by appending to parent's url
resolve_relative_url ()
{
Expand Down Expand Up @@ -137,7 +125,7 @@ cmd_add()
shift
;;
-q|--quiet)
quiet=1
GIT_QUIET=1
;;
--reference)
case "$2" in '') usage ;; esac
Expand Down Expand Up @@ -273,7 +261,7 @@ cmd_init()
do
case "$1" in
-q|--quiet)
quiet=1
GIT_QUIET=1
;;
--)
shift
Expand Down Expand Up @@ -333,7 +321,7 @@ cmd_update()
case "$1" in
-q|--quiet)
shift
quiet=1
GIT_QUIET=1
;;
-i|--init)
init=1
Expand Down Expand Up @@ -650,7 +638,7 @@ cmd_status()
do
case "$1" in
-q|--quiet)
quiet=1
GIT_QUIET=1
;;
--cached)
cached=1
Expand Down Expand Up @@ -704,7 +692,7 @@ cmd_sync()
do
case "$1" in
-q|--quiet)
quiet=1
GIT_QUIET=1
shift
;;
--)
Expand Down Expand Up @@ -759,7 +747,7 @@ do
command=$1
;;
-q|--quiet)
quiet=1
GIT_QUIET=1
;;
-b|--branch)
case "$2" in
Expand Down

0 comments on commit 2e6a30e

Please sign in to comment.