diff --git a/git-remote-gcrypt b/git-remote-gcrypt index 6f6a009..9dce8ec 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -40,6 +40,12 @@ isurl() { isnull "${2%%$1://*}"; } xgrep() { command grep "$@" || : ; } sort_C() { LC_ALL=C command sort "$@"; } +sort_stable_k2() +{ + awk '{ printf("%08d %s\n", NR, $0) }' | sort_C -k3,3 -k1,1 | + awk '{ print $2 " " $3 }' +} + tac() { sed '1!G;h;$!d'; } # Split $1 into $prefix_:$suffix_ @@ -437,8 +443,7 @@ do_push() $1 EOF - # POSIX compat issue: sort -s (stable), but supported in bsd and gnu - Branchlist=$(xecho "$Branchlist" | sort_C -k2 -s | tac | uniq -s40) + Branchlist=$(xecho "$Branchlist" | sort_stable_k2 | tac | uniq -s40) TmpPack_Encrypted="$Localdir/tmp_pack_ENCRYPTED_.$$" TmpObjlist="$Localdir/tmp_packrevlist.$$"