]> Nutra Git (v1) - gamesguru/git-remote-gcrypt.git/commitdiff
Use filter_to for pruning Packlist after repack
authorroot <root@localhost>
Mon, 28 Jan 2013 07:44:43 +0000 (07:44 +0000)
committerroot <root@localhost>
Mon, 28 Jan 2013 07:44:43 +0000 (07:44 +0000)
git-remote-gcrypt

index d38f889f83530d1ee566ed0cd45f4c1574e19268..86dfe44ff32ad51c0c9ddc5ab4dfb8acbb131080 100755 (executable)
@@ -589,7 +589,8 @@ fetch_decrypt_pack()
 # $4 to list of packfiles to delete
 repack_if_needed()
 {
-       local pack_= packline_= premote_= key_= pkeep_= n_= m_=
+       local pack_= packline_= premote_= key_= pkeep_= n_= m_= \
+               orig_ifs= kline_= pline_= plist_new=
 
        # $TmpPack_Encrypted set in caller
 
@@ -642,7 +643,16 @@ repack_if_needed()
                Packlist=
        else
                setvar "$4" "$(xecho "$premote_" | xgrep -v -e "$pkeep_")"
-               Packlist=$(xecho "$Packlist" | xgrep -e "$pkeep_")
+               orig_ifs=$IFS
+               IFS=$Newline
+               for kline_ in $pkeep_
+               do
+                       IFS=$orig_ifs
+                       filter_to @pline_ "pack $kline_ " "$Packlist"
+                       append_to @plist_new "$pline_"
+               done
+               IFS=$orig_ifs
+               Packlist=$plist_new
        fi
 
        pack_id=$(pack_hash < "$TmpPack_Encrypted")