Skip to content

Commit b54301b

Browse files
committed
Merge branch 'dl/subtree-avoid-tricky-echo'
"git subtree" script (in contrib/) used "echo -n" to produce progress messages in a non-portable way. * dl/subtree-avoid-tricky-echo: contrib/subtree: portability fix for string printing
2 parents 8087a62 + 2ded109 commit b54301b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

contrib/subtree/git-subtree.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,21 @@ prefix=
5151
debug()
5252
{
5353
if [ -n "$debug" ]; then
54-
echo "$@" >&2
54+
printf "%s\n" "$*" >&2
5555
fi
5656
}
5757

5858
say()
5959
{
6060
if [ -z "$quiet" ]; then
61-
echo "$@" >&2
61+
printf "%s\n" "$*" >&2
62+
fi
63+
}
64+
65+
progress()
66+
{
67+
if [ -z "$quiet" ]; then
68+
printf "%s\r" "$*" >&2
6269
fi
6370
}
6471

@@ -599,7 +606,7 @@ cmd_split()
599606
eval "$grl" |
600607
while read rev parents; do
601608
revcount=$(($revcount + 1))
602-
say -n "$revcount/$revmax ($createcount)"
609+
progress "$revcount/$revmax ($createcount)"
603610
debug "Processing commit: $rev"
604611
exists=$(cache_get $rev)
605612
if [ -n "$exists" ]; then

0 commit comments

Comments
 (0)