Skip to content

Commit

Permalink
Merge pull request #129 from waynetheisinger/weirdnewline
Browse files Browse the repository at this point in the history
fix(automodman): Weird new line breaking things on High Sierra
  • Loading branch information
colinmollenhour authored Oct 31, 2017
2 parents 318a588 + 23a634a commit 799fbd1
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions modman
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,20 @@ run_automodman () #"$module" "$mm" "$wc_dir" "$wc_desc"
#first f tends to be empty because of our stripping the path down so test for it -n is default operator
if [ "$pathname" ]; then
# find a previous match for the path. if there is one the exitcode will be 1, otherwise 0.
prevmatch=$(! printf -- '%s\n' "${ARRAY[@]}" | grep -qv "${pathname/$incPath/}"; echo $?)
prevmatch=0
if [[ ${incpaths[@]} ]]; then
for i in "${incpaths[@]}"
do
if [[ "$pathname" =~ "$i" ]] ; then
prevmatch=1
fi
done
fi
#if substring then do recurse
if [[ $prevmatch -eq 0 ]]; then #make sure we have not previously matched
if [[ $prevmatch -eq 0 ]]; then #make sure we have not previously matched to prevent subpaths
#pre-existing path: yes | no?
if grep -rq "^[^#].*\s$pathname$" "${amm}/"*"/modman" #target is what is important so find end line not beginning line
then #pre-existing path: yes
Expand Down

0 comments on commit 799fbd1

Please sign in to comment.