nickva commented on PR #6195:
URL: https://github.com/apache/couchdb/pull/6195#issuecomment-6593097281
```
#!/bin/sh
# rev-limit =3
#
# 1-a -- 2-b
# \-- 2-c -- 3-d -- 4-e
#
# 4-e wrtten twice:
# 1) with one ancestor only (e - d)
# 2) with a full history
#
# Second write extends the fist tree and leaves the earlier fragment behind
as a
# duplicate and stem repairs it. Before we used to cut each leat to
revs_limit
# on its own (dropping 1-a from the long branch even though 1-a stays in the
# path as the parent of 2-b).
#
# TL;DR:
# before the fix {"start":4,"ids":["e","d","c"]}
#
# with the fix {"start":4,"ids":["e","d","c","a"]}
#
set -eu
URL=${URL:-http://adm:[email protected]:15984/stem}
bulk() {
curl -s -X POST $URL/_bulk_docs -H Content-Type:application/json -d "$1"
echo
}
curl -s -X DELETE $URL > /dev/null
curl -s -X PUT $URL > /dev/null
echo "set revs limit to 3"
curl -s -X PUT $URL/_revs_limit -d 3 > /dev/null
echo "add b - a"
bulk
'{"new_edits":false,"docs":[{"_id":"doc","_rev":"2-b","_revisions":{"start":2,"ids":["b","a"]}}]}'
echo "add e - d "
bulk
'{"new_edits":false,"docs":[{"_id":"doc","_rev":"4-e","_revisions":{"start":4,"ids":["e","d"]}}]}'
echo "add a - c - d - e"
bulk
'{"new_edits":false,"docs":[{"_id":"doc","_rev":"4-e","_revisions":{"start":4,"ids":["e","d","c","a"]}}]}'
echo "**raise revs limit to 1000"
curl -s -X PUT $URL/_revs_limit -d 1000 > /dev/null
echo "**show 4-e, expect e - d - c - a"
curl -s "$URL/doc?rev=4-e&revs=true"
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]