summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Mike Burns <mike@mike-burns.com>2013-07-12 23:38:19 +0200
committerGravatar Mike Burns <mike@mike-burns.com>2013-07-12 23:44:16 +0200
commit3adcb218cbb42026bc0ef906b219f0e1888220cd (patch)
tree33a459b9749bc4cfa44712345c1e1be560b7cce9
parentc5ae3e947a891975a2f8edee5a8349a2f46e45b9 (diff)
Hide duplicates
With multiple source directories it is possible to have duplicates. Consider these source directories, `a` and `b`: |-- a | |-- bar | `-- foo `-- b |-- baz `-- foo The goal is to have this: .bar -> a/bar .baz -> b/baz .foo -> a/foo Note the duplcate `foo` file. We now handle this, in `lsrc` and therefore in `rcup`. We do this by storing a `:`-separated string of destination files (e.g. `.foo`) and `grep`ing that string before we operate on any destination.
-rwxr-xr-xbin/lsrc8
1 files changed, 7 insertions, 1 deletions
diff --git a/bin/lsrc b/bin/lsrc
index e2a3618..cdebfeb 100755
--- a/bin/lsrc
+++ b/bin/lsrc
@@ -58,7 +58,11 @@ link_file() {
local dotted=$4
local dest_file=`build_path $dest_dir $file $dotted`
- $PRINT $dest_file:$dotfiles_dir/$file
+ if echo $DEST_STACK | grep -vq ":$dest_file"; then
+ DEST_STACK="$DEST_STACK:$dest_file"
+
+ $PRINT $dest_file:$dotfiles_dir/$file
+ fi
}
handle_file() {
@@ -131,6 +135,8 @@ handle_command_line() {
FILES=$@
}
+DEST_STACK=
+
if [ -e $HOME/.rcrc ]; then
. $HOME/.rcrc
fi