diff options
author | Peter Palfrader <peter@palfrader.org> | 2016-10-31 21:07:43 +0100 |
---|---|---|
committer | Peter Palfrader <peter@palfrader.org> | 2016-10-31 21:07:43 +0100 |
commit | c1424f11fab7a4c54f554403469b269de53f196b (patch) | |
tree | 8a96e28e9591aaa51b3efc0053f99846b301fcd3 | |
parent | 5e3b9eaf1f64b285d3d67a2ca18302d898ae41cf (diff) |
rvi: try to restore group ownership even as non-root
-rwxr-xr-x | rvi | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -56,6 +56,7 @@ if ! [ -e "$1,v" ] && ! [ -e "$DN/RCS/$BN,v" ] ; then fi owner="`stat -c "%u:%g" "$1"`" +group=$(stat -c '%g' "$1") rcsdiff -u "$1" if [ $? -ne 0 ] ; then echo @@ -74,7 +75,9 @@ if [ $? -ne 0 ] ; then exit 1 fi if [ "$(id -u)" = "0" ]; then - chown "$owner" "$1" + chown "$owner" "$1" +elif ! chgrp "$group" "$1"; then + echo >&2 "Warning: group ownership was $group, but this could not be restored." fi $editor "$1" ci -u "$1" |