mirror of
https://git.ludikovsky.name/git/fugitive.git
synced 2024-09-28 22:25:27 +02:00
preventing to go through foreach loops if not actually in use (there can be a lot of commits)
This commit is contained in:
parent
b9b53df3cc
commit
7b173c1770
|
@ -237,13 +237,18 @@ replace_foreach () {
|
||||||
temp=`tempfile -p "fugitive"`
|
temp=`tempfile -p "fugitive"`
|
||||||
fe="foreach:$1"
|
fe="foreach:$1"
|
||||||
cat > "$temp"
|
cat > "$temp"
|
||||||
|
cat "$temp" | \
|
||||||
|
sed -n "/<?fugitive\s\+$fe\s*?>/,/<?fugitive\s\+end$fe\s*?>/p" | \
|
||||||
|
tail -n +2 | head -n -1 > "$foreach_body"
|
||||||
|
if [ ! -s "$foreach_body" ]; then
|
||||||
|
cat "$temp"
|
||||||
|
rm "$foreach_body" "$tmpfile" "$temp"
|
||||||
|
return
|
||||||
|
fi
|
||||||
cat "$temp" | \
|
cat "$temp" | \
|
||||||
sed "s/<?fugitive\s\+$fe\s*?>/<?fugitive foreach_body ?>\n\0/" | \
|
sed "s/<?fugitive\s\+$fe\s*?>/<?fugitive foreach_body ?>\n\0/" | \
|
||||||
sed "/<?fugitive\s\+$fe\s*?>/,/<?fugitive\s\+end$fe\s*?>/d" | \
|
sed "/<?fugitive\s\+$fe\s*?>/,/<?fugitive\s\+end$fe\s*?>/d" | \
|
||||||
cat > "$tmpfile"
|
cat > "$tmpfile"
|
||||||
cat "$temp" | \
|
|
||||||
sed -n "/<?fugitive\s\+$fe\s*?>/,/<?fugitive\s\+end$fe\s*?>/p" | \
|
|
||||||
tail -n +2 | head -n -1 > "$foreach_body"
|
|
||||||
for i in `cat "$2"`; do
|
for i in `cat "$2"`; do
|
||||||
cat "$foreach_body" | replace_$1_info "$i"
|
cat "$foreach_body" | replace_$1_info "$i"
|
||||||
done > "$temp"
|
done > "$temp"
|
||||||
|
|
Loading…
Reference in a new issue