diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2010-04-02 22:03:02 -0600 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2015-06-26 00:30:20 -0600 |
commit | 67952443f7a7e3a76c9755c3e0f04789ae7705d1 (patch) | |
tree | 00bea57bdf74b20c9336b565880a2def6c321a00 /rvs/plugins/tree/bin/addparent.d.sh | |
parent | 0f7db62d9229aeaf87ab13fb010be797b375ff5a (diff) |
well, rvs trees at least sorta work now
Diffstat (limited to 'rvs/plugins/tree/bin/addparent.d.sh')
-rw-r--r-- | rvs/plugins/tree/bin/addparent.d.sh | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/rvs/plugins/tree/bin/addparent.d.sh b/rvs/plugins/tree/bin/addparent.d.sh index ed21085..db43dd2 100644 --- a/rvs/plugins/tree/bin/addparent.d.sh +++ b/rvs/plugins/tree/bin/addparent.d.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash name='addparent.d' ver=0.1 # Copyright (C) 2010 Luke Shumaker @@ -24,21 +24,21 @@ parent=${2?"$usage"} tc="`mktemp`" tp="`mktemp`" -"$RVS" ls "$child" '%n %i' > "$tc" -"$RVS" ls "$parent" '%n %i' > "$tc" +"$RVS" ls "$child" '%i\t%n' > "$tc" +"$RVS" ls "$parent" '%i\t%n' > "$tp" while read line; do - name="`echo "$line" | sed 's:\t[a-z]/[0-9a-f]$::'`" - nID="`echo "$line" | sed 's:^.*\t::'`" - oID="`sed -n 's:^${name/':'/'\:'}\t\([a-z]/[0-9a-f]\)$:\1:p'`" + name="`echo "$line" | cut -f2-`" + nID="`echo "$line" | cut -f1`" + oID="`sed -n "s:^\([a-z]\:[0-9a-f]*\)\t${name/:/\\:}$:\1:p" "$tp"`" - if [ -n "$oID" ] { + if [ -n "$oID" ]; then nT="`"$RVS" blob-gettype "$nID"`" oT="`"$RVS" blob-gettype "$oID"`" if [ "$nT" = "$oT" ]; then "$RVS" addparent "$nID" "$oID" fi - } + fi done < "$tc" "$RVS" addparent.f "$child" "$parent" |