Replace wc -l with line_count
This commit is contained in:
parent
100490af1f
commit
1d7a760a7e
1 changed files with 16 additions and 7 deletions
|
@ -143,6 +143,18 @@ filter_to()
|
||||||
setvar "$1" "$f_result_"
|
setvar "$1" "$f_result_"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Output the number of lines in $1
|
||||||
|
line_count()
|
||||||
|
{
|
||||||
|
local f_x=0 IFS=
|
||||||
|
IFS=$Newline
|
||||||
|
for f_line in $1
|
||||||
|
do
|
||||||
|
f_x=$(($f_x + 1))
|
||||||
|
done
|
||||||
|
xecho "$f_x"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
## gitception part
|
## gitception part
|
||||||
# Fetch giturl $1, file $2
|
# Fetch giturl $1, file $2
|
||||||
|
@ -577,7 +589,7 @@ fetch_decrypt_pack()
|
||||||
# $4 to list of packfiles to delete
|
# $4 to list of packfiles to delete
|
||||||
repack_if_needed()
|
repack_if_needed()
|
||||||
{
|
{
|
||||||
local pack_= packline_= premote_= key_= pkeep_= n_=
|
local pack_= packline_= premote_= key_= pkeep_= n_= m_=
|
||||||
|
|
||||||
# $TmpPack_Encrypted set in caller
|
# $TmpPack_Encrypted set in caller
|
||||||
|
|
||||||
|
@ -593,12 +605,9 @@ repack_if_needed()
|
||||||
pick_fields @premote_ 1,2 "$Packlist"
|
pick_fields @premote_ 1,2 "$Packlist"
|
||||||
pick_fields @pkeep_ 2 "$Keeplist"
|
pick_fields @pkeep_ 2 "$Keeplist"
|
||||||
|
|
||||||
if isnull "$pkeep_"; then
|
n_=$(line_count "$Packlist")
|
||||||
n_=$(xecho "$Packlist" | wc -l)
|
m_=$(line_count "$pkeep_")
|
||||||
else
|
if [ $Repack_limit -gt "$(($n_ - $m_))" ]; then
|
||||||
n_=$(xecho "$Packlist" | grep -v -e "$pkeep_" | wc -l)
|
|
||||||
fi
|
|
||||||
if [ $Repack_limit -gt "$n_" ]; then
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
echo_info "Repacking remote $NAME, ..."
|
echo_info "Repacking remote $NAME, ..."
|
||||||
|
|
Loading…
Reference in a new issue