[__git] Fix bug introduced in explorers.

I was using explorers in the explorers >,< which is not supported and would be
awkward.
While at it, symlinked group to owner and unified that code.
This commit is contained in:
evilham 2020-06-18 11:03:48 +02:00
parent e13b44bd5d
commit db68b04420
2 changed files with 18 additions and 18 deletions

View file

@ -1,15 +0,0 @@
#!/bin/sh
destination="/$__object_id/.git"
os="$(cat "$__global/explorer/os")"
case $os in
*bsd)
# Checked on OpenBSD, FreeBSD and NetBSD
stat -f "%Sg" "${destination}" 2>/dev/null || exit 0
;;
*)
stat --print "%G" "${destination}" 2>/dev/null || exit 0
;;
esac

View file

@ -0,0 +1 @@
owner

View file

@ -2,14 +2,28 @@
destination="/$__object_id/.git" destination="/$__object_id/.git"
os="$(cat "$__global/explorer/os")" action="$(basename "${0}")"
case $action in
owner)
bsd_fmt="%Su"
linux_fmt="%U"
;;
group)
bsd_fmt="%Sg"
linux_fmt="%G"
;;
esac
os="$(uname | tr '[:upper:]' '[:lower:]')"
case $os in case $os in
*bsd) *bsd)
# Checked on OpenBSD, FreeBSD and NetBSD # Checked on OpenBSD, FreeBSD and NetBSD
stat -f "%Su" "${destination}" 2>/dev/null || exit 0 stat -f "${bsd_fmt}" "${destination}" 2>/dev/null || exit 0
;; ;;
*) *)
stat --print "%U" "${destination}" 2>/dev/null || exit 0 stat --print "${linux_fmt}" "${destination}" 2>/dev/null || exit 0
;; ;;
esac esac