#!/bin/bash
# You can pass --no-ir to see the difference.

rm -rf src dest dest2

mkdir src src/sub2
echo BIG >src/sub2/link2
rsync -a src/ dest/

ln src/sub2/link2 src/link1
# Make enough files that "link1" is sent before the "sub2" flist chunk is sent.
mkdir src/sub1
touch src/sub1/stuff{1..1000}
rsync "$@" -aH --link-dest=../dest/ src/ dest2/

ls -ld dest2/link1 dest2/sub2/link2
