I found a weird bug that causes the 'svn merge' command to crash in a slightly unorthodox, but possible configuration. When the youngest common ancestor revision of source and target is zero, an assertion fails. This can be reproduced by branching both branches from the root at r0 (if I understood the reason correctly).
Here is a reproduction script: [[[ svnadmin create /tmp/repos svn co file:///tmp/repos wc # r1 svn mkdir wc/dddd svn ci wc -m dummy # r2 svn mkdir wc/dir echo "aa" > wc/dir/a svn add wc/dir/a echo "bb" > wc/dir/b svn add wc/dir/b svn ci wc -m files # r3 cd wc svn cp ^/@r0 ^/trunk -m trunk cd .. # r4 cd wc svn cp ^/@r0 ^/branch -m branch cd .. svn up wc # r5 svn merge file:///tmp/repos/trunk wc/branch svn ci wc -m merge svn up wc svn merge file:///tmp/repos/trunk wc/branch ### here it segfaults svn ci wc -m merge ]]] What's also interesting is that it works completely fine the first time and only crashes when the merge should make no changes (change revision in 'svn cp' to r1). It seems like the program fails in merge.c:branch_history_intersect_range() due to an assertion 'oldest_rev >= 1'. Which makes sense because well it's a zero. I'm not sure what the right fix should be. I assume there is a reason for the assertion, like to make sure it's initialized. I think the options are: 1) Remove assertion completely. 2) Initialize it with -1/SVN_INVALID_REVNUM in the very beginning and svn_client__calc_youngest_common_ancestor() to assert for it instead. Thoughts? As a note: I'm currently trying to study the merge implementation + do some clean ups and finally do the apply_processor refactoring (just realised how long ago this topic was first brought up...). -- Timofei Zhakov

