aboutsummaryrefslogtreecommitdiffhomepage
path: root/git-remote-gcrypt
diff options
context:
space:
mode:
authorroot <root@localhost>2013-02-14 00:00:00 +0000
committerroot <root@localhost>2013-02-14 00:00:00 +0000
commit1e0decc8930573470a31ac7caefa5f33bf7fe2bc (patch)
treec88af4b5e01a5186e2354e7326a689d606a8f3ec /git-remote-gcrypt
parentda65f512a7e85293381b991ebb4c0417ac23fac6 (diff)
downloadgit-remote-gcrypt-1e0decc8930573470a31ac7caefa5f33bf7fe2bc.tar.gz
Implement stable sort (Lacking in POSIX)
Diffstat (limited to 'git-remote-gcrypt')
-rwxr-xr-xgit-remote-gcrypt9
1 files changed, 7 insertions, 2 deletions
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.$$"