View Ticket
Not logged in
Ticket UUID: 1d50540ec50335beef3ee228185392d694c3b66a
Title: Merging branches with a renamed file
Status: Open Type: Code_Defect
Severity: Minor Priority:
Subsystem: Resolution:
Last Modified: 2011-02-07 18:31:16
Version Found In: d5729c31b5
Description & Comments:
If you update to a branch and move a file to a directory that doesn't exist in the mainline tree, a merge will fail.

In a new repository (in tcsh(1): alias fs fossil):

echo "hello" > bar.txt
fs add bar.txt
fs ci -m "Creating a branch" --branch rename_bug bar.txt
mkdir foo
fs mv bar.txt foo/bar.txt
mv bar.txt foo/bar.txt
fs ci -m "Moved bar.txt to foo/"
fs up master
fs merge rename_bug

The expected error output is:

fossil: SQLITE_BUSY: statement aborts at 2: [ROLLBACK] cannot rollback transaction - SQL statements in progress

If you pipe the merge to a file and don't capture stderr, you should be able to spot the problem:

fossil: cannot open "/private/tmp/fs-merge-bug/foo/bar.txt" for writing

I think it should be pretty easy to replicate the problem.

I'm speculating, but it looks like the easiest fix is to update src/file.c:file_copy() to be updated to create the destination directory if it doesn't exist. On the flip side, given the directory permissions, maybe it's better to just append an error message to the output when the command finishes rolling back the merge? Food for though I suppose.