Use batch-check to use only the remote_has commits we also have locally

This commit is contained in:
root 2013-02-14 00:00:00 +00:00
parent 8e1246e738
commit fdb2732abb

View file

@ -249,10 +249,8 @@ pack_hash()
# Pass the branch/ref by pipe to git # Pass the branch/ref by pipe to git
safe_git_rev_parse() safe_git_rev_parse()
{ {
local out_= git cat-file --batch-check 2>/dev/null |
out_=$(xecho "$1" | git cat-file --batch-check) xgrep -v "missing" | cut -f 1 -d ' '
out_=${out_%%*missing}
xecho "${out_%% *}"
} }
check_recipients() check_recipients()
@ -446,8 +444,9 @@ do_push()
trap 'rm -f "$TmpPack_Encrypted" "$TmpObjlist"' EXIT trap 'rm -f "$TmpPack_Encrypted" "$TmpObjlist"' EXIT
if isnonnull "$Branchlist" if isnonnull "$Branchlist"
then then
remote_has=$(xecho "$Branchlist" | # filter through batch-check to mark only the commits we have
cut -f 1 -d ' ' | sed -e 's/^\(.\)/^&/') remote_has=$(xecho "$Branchlist" | cut -f 1 -d ' ' |
safe_git_rev_parse | sed -e 's/^\(.\)/^&/')
fi fi
while read line_ # from << while read line_ # from <<
@ -458,7 +457,7 @@ do_push()
then then
remote_want=$(append "$remote_want" "$prefix_") remote_want=$(append "$remote_want" "$prefix_")
Branchlist=$(append "$Branchlist" \ Branchlist=$(append "$Branchlist" \
"$(safe_git_rev_parse "$prefix_") $suffix_") "$(xecho "$prefix_" | safe_git_rev_parse) $suffix_")
else else
# Mark branch for deletion # Mark branch for deletion
Branchlist=$(append "$Branchlist" "$del_hash $suffix_") Branchlist=$(append "$Branchlist" "$del_hash $suffix_")