summaryrefslogtreecommitdiff
path: root/plugins/tree/bin/addparent.d.sh
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2010-04-02 22:03:02 -0600
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-06-26 00:30:20 -0600
commitb2f69e2a90adce58775b76fd24c75e3ab51da4b6 (patch)
treee525baa4741e83abddf3ba1f4c116c3de6f3ba23 /plugins/tree/bin/addparent.d.sh
parent5cbc6057d2a2c7e00b466eb987acf04d68e1c18c (diff)
well, rvs trees at least sorta work now
Diffstat (limited to 'plugins/tree/bin/addparent.d.sh')
-rw-r--r--plugins/tree/bin/addparent.d.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/plugins/tree/bin/addparent.d.sh b/plugins/tree/bin/addparent.d.sh
index ed21085..db43dd2 100644
--- a/plugins/tree/bin/addparent.d.sh
+++ b/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"