From 5ffc5bd5ba0bc44f20c60295ca99ef00af200dbb Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 6 Oct 2016 20:29:17 -0700 Subject: [PATCH] combine-packs.sh: update to latest This version generally produces slightly smaller output packs, but its big advantage is that it produces much more efficient packs when there is no refs/tags/* ref present to trigger the much more efficient pack-objects output ordering. Additionally, given the same input objects and the same refs/tags/* refs, the output should now be identical under --threads=1. Signed-off-by: Kyle J. McKay --- jobd/combine-packs.sh | 50 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/jobd/combine-packs.sh b/jobd/combine-packs.sh index a0321e8..461ab52 100755 --- a/jobd/combine-packs.sh +++ b/jobd/combine-packs.sh @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Version 1.1.13 +# Version 1.1.15 USAGE=' printf "%s\n" path-to-pack[.idx|.pack] ... | @@ -345,6 +345,7 @@ bl="$tdmin/blobs" ms="$tdmin/missing" trbl="$tdmin/treesblobs" named="$tdmin/named" +named2="$tdmin/named2" get_pack_base() { _name="$1" @@ -433,21 +434,48 @@ awk '{ }' | sort -t " " -k2,2 | join -t " " -1 2 - "$trbl" >"$named" +join -t " " -v 1 "$tr" "$named" | +git rev-list --no-walk --objects --stdin | +awk '{print NR " " $0}' | +sort -t " " -k2,2 | +join -t " " -1 2 - "$trbl" >"$named2" pocmd='git pack-objects --delta-base-offset "$@"' [ -z "$packbasearg" ] || pocmd="$pocmd \"${packbasearg}tmp\"" { cat "$cmo" ! [ -s "$tg" ] || git cat-file $gcfbo --batch <"$tg" | perl -e "$perlprog" - sort -t " " -k2,2n <"$named" | - sed -e 's/\([^ ][^ ]*\) [^ ][^ ]*/\1/' - join -t " " -v 1 "$tr" "$named" | - git rev-list --no-walk --objects --stdin | - awk '{print NR " " $0}' | - sort -t " " -k2,2 | - join -t " " -1 2 - "$trbl" | - sort -t " " -k2,2n | - sed -e 's/\([^ ][^ ]*\) [^ ][^ ]*/\1/' - cat "$bl" + { + join -t " " "$named" "$tr" | + sort -t " " -k2,2n + join -t " " "$named2" "$tr" | + sort -t " " -k2,2n + } | sed -e 's/\([^ ][^ ]*\) [^ ][^ ]*/\1/' + { + join -t " " -v 1 "$named" "$tr" | + sort -t " " -k2,2n + join -t " " -v 1 "$named2" "$tr" | + sort -t " " -k2,2n + } | awk -F '[ ]' '{ + if (NF >= 3) { + nm = substr($0, length($1) + length($2) + 3) + sfx = nm + gsub(/[\t\n\013\f\r ]+/, "", sfx) + if (length(sfx)) { + if (length(sfx) > 16) sfx = substr(sfx, length(sfx) - 15) + else if (length(sfx) < 16) sfx = sprintf("%16s", sfx) + split(sfx, c, "") + r = c[16] c[15] c[14] c[13] c[12] c[11] c[10] c[9] c[8] c[7] c[6] c[5] c[4] c[3] c[2] c[1] + sub(/[ ]+$/, "", r) + print NR " " $1 " " r " " nm + } else print NR " " $1 " " nm + } else print NR " " $1 " " + }' | sort -t " " -k3,3 -k1,1n | awk -F '[ ]' '{ + if (NF >= 4) { + nm = substr($0, length($1) + length($2) + length($3) + 4) + print $2 " " nm + } else print $2 " " + }' + sort -u "$bl" >"$listok" } | { sh -c 'echo $$ >"$1"; pocmd="$2"; shift; shift; eval "exec $pocmd"' sh "$popid" "$pocmd" "$@" || { -- 2.11.4.GIT