Fossil Forum
Post: Prevent merges from own checkout
This patch is enough to prevent both standard and cherrypick merges with themselves. Backout merges are still permitted with this (reasonable, if you want to immediately undo the changes but don't want to move to a mistake branch for some reason).
``` Index: src/merge.c ================================================================== --- src/merge.c +++ src/merge.c @@ -987,11 +987,11 @@ } if( nid==0 ) nid = pid; if( !is_a_version(pid) ){ fossil_fatal("not a version: record #%d", pid); } - if( !forceFlag && mid==pid ){ + if( !forceFlag && (mid==pid || mid==vid) ){ fossil_print("Merge skipped because it is a no-op. " " Use --force to override.\n"); return; } if( integrateFlag && !is_a_leaf(mid)){
```