summaryrefslogtreecommitdiff
path: root/rvs/plugins/tree/bin/addparent.d.sh
diff options
context:
space:
mode:
Diffstat (limited to 'rvs/plugins/tree/bin/addparent.d.sh')
-rw-r--r--rvs/plugins/tree/bin/addparent.d.sh16
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"