mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
test/thread-order: more robust loop exit in case of broken input
When creating $THREADS data it may end of not having 'None' at all or the numbers in line output yields a loop. To avoid loop the value in current array index is set to 'None' so that if the same item is reached again the loop will end. Also empty string as next array index will end the loop.
This commit is contained in:
parent
0fa9cf75e5
commit
3d1483df12
1 changed files with 4 additions and 1 deletions
|
@ -45,9 +45,12 @@ for ((n = 0; n < 4; n++)); do
|
|||
while read -a parents; do
|
||||
references=""
|
||||
parent=${parents[$n]}
|
||||
while [[ $parent != None ]]; do
|
||||
while [[ ${parent:-None} != None ]]; do
|
||||
references="<m$parent@t$thread> $references"
|
||||
pp=$parent
|
||||
parent=${parents[$parent]}
|
||||
# Avoid looping over broken input (if ever)
|
||||
parents[$pp]="None"
|
||||
done
|
||||
|
||||
generate_message \
|
||||
|
|
Loading…
Reference in a new issue