Skip to content

Commit 0cbd548

Browse files
misc fixes and diff now shows when filelist/cryptlist is the only change (fix #10)
1 parent a25d36f commit 0cbd548

3 files changed

Lines changed: 17 additions & 4 deletions

File tree

bin/dotgit

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ declare -a FE # File encrypt flag
3939

4040
[[ $DG_VERBOSE -eq 0 ]] && shift
4141

42-
init_cgroups
42+
[[ $# -ne 0 ]] && [[ $1 != "init" ]] && [[ $1 != "help" ]] && init_cgroups
4343

4444
declare -a tctg
45-
if [[ $# == 0 ]]; then
45+
if [[ $# -eq 0 ]]; then
4646
phelp
4747
exit
48-
elif [[ $# == 1 ]]; then
48+
elif [[ $# -eq 1 ]]; then
4949
tctg=(common $HOSTNAME)
5050
else
5151
tctg=(${@:2})

bin/dotgit_headers/diff

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ function init_diff
99
cd "$REPO"
1010
git add --all
1111
IFS=$'\n'
12+
13+
local fl_ch=0
14+
local cr_ch=0
15+
1216
while read -r line; do
1317
local a=${line%% *}
1418
local f=${line#* }
@@ -17,6 +21,8 @@ function init_diff
1721
f=${f%\"}
1822
f=${f#\"}
1923

24+
[[ $f == "$FILELIST" ]] && fl_ch=1 && continue
25+
[[ $f == "$CRYPTLIST" ]] && cr_ch=1 && continue
2026
[[ ! $f =~ ^$DG_DFDIR* ]] && continue
2127
[[ $f =~ .*\.hash ]] && continue
2228

@@ -33,6 +39,11 @@ function init_diff
3339
done <<< "$(git status --porcelain)"
3440
unset line
3541

42+
if [[ ${#DG_DIFF_F[@]} -eq 0 ]]; then
43+
[[ $fl_ch -ne 0 ]] && DG_DIFF_F+=("filelist") && DG_DIFF_T+=("modified")
44+
[[ $cr_ch -ne 0 ]] && DG_DIFF_F+=("cryptlist") && DG_DIFF_T+=("modified")
45+
fi
46+
3647
git reset -q
3748
}
3849

bin/dotgit_headers/repo

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ function init_flists
118118

119119
local -a arr
120120
IFS=$',' arr=(${l[1]:-"common"})
121-
IFS=$'\n' arr=($(sort<<<"${arr[*]}"))
121+
IFS=$'\n' arr=($(sort -u<<<"${arr[*]}"))
122122

123123
# If file entry is folder inside repo and home folder has no such
124124
# file, folder or the folder is empty - then use repo contents as
@@ -139,11 +139,13 @@ function init_flists
139139
FE+=($n)
140140
verecho "$(levecho 1 "Added ${l[0]} - ${arr[*]} - $n")"
141141
else
142+
IFS=$','
142143
verecho "$(levecho 1 \
143144
"Using directory mode for ${l[0]} - ${arr[*]} - $n")"
144145

145146
IFS=$'\n'
146147
while read -r fls; do
148+
[[ ! $fls ]] && continue
147149
[[ $PRE ]] && fls=${fls#$PRE}
148150
FN+=("$fls")
149151
IFS=$',' FC+=("${arr[*]}")

0 commit comments

Comments
 (0)