Fossil

View Ticket
Login

View Ticket

Ticket Hash: 67a47646ea38c7ed77112b579a6f7dce84e4eda9
Title: commit failure after merge
Status: Fixed Type: Code_Defect
Severity: Severe Priority:
Subsystem: Resolution: Fixed
Last Modified: 2012-02-10 14:40:18
Version Found In: trunk
Description:
I ran into a strange problem which results in "fossil commit" failure after a specific type of merge. Below I included a self-contained shell script that reproduces the problem. Tested with trunk version of fossil on Linux. Here is the problem's description. A fossil repository T.fossil contains two brunches "trunk" and "next". In both branches there are two files "foo" and "bar". At some point in development process I merge branch next into the trunk. The contents of the files are such that "fossil merge next" successfully auto-merges changes in bar but has merge conflicts in foo that has to be manually resolved. So far so good.
$ fossil cha
UPDATED_BY_MERGE bar
EDITED     foo

The project's internal logic dictates that while fixing merge conflicts in foo I have to make some changes to bar. After any changes to "bar" fossil refuses to commit claiming that "working checkout does not match what would have ended up in the repository".

I think this behavior is incorrect, for it forces me to commit a broken state of the project, let say code does not compile. Please, run an attached shell script to reproduce the problem.

----%<--------%<----
#!/bin/bash
################################################################################
# Demonstrates "fossil commit" failure after merge.
# We have a repo with two files bar, foo which is being developed in branches 
# trunk and next. At some point next is merged into trunk. bar is successfully 
# automerged while foo has merge conflicts requiring manual resolution. 
# From internal logic of the project resolving conflicts in foo requires 
# modifications to bar. After bar is edited "fossil commit" fails!
################################################################################

# Preamble to setup directories and output redirection
BNAME=merge-conflict
RTDIR="/tmp/fossil-tests/$BNAME"
rm -rf   "$RTDIR"
mkdir -p "$RTDIR"
exec 2>&1
exec 1>& >(tee "$RTDIR/T.log")
echo "**************************************************************************"
echo "**  $RTDIR/T.log     -- this log"
echo "**  $RTDIR/T.fossil  -- test repo"
echo "**  $RTDIR/T         -- checkout"
echo "**************************************************************************"
set -x

# Test case
cd "$RTDIR"			# Now in $RTDIR
fossil new T.fossil
mkdir -p T
cd T				# Now in $RTDIR/T
fossil open ../T.fossil
echo "foo in the branch trunk" > foo
echo "bar in the trunk" > bar
fossil add foo bar
fossil ci -m 'added foo, bar to the trunk'
echo "foo in the branch next" > foo
echo "line added to bar in branch next" >> bar
fossil ci --branch next -m 'commit to newly created branch next'
# go to the trunk 
fossil co trunk
fossil inf
# make changes to trunk
echo "new foo version in the trunk" > foo
fossil ci -m 'foo changed in trunk'
# merge next into trunk
fossil merge --detail next
fossil cha
echo "merged version of foo" > foo
echo "resolving merge conflicts in foo required changes in bar" > bar
# trying to commit. GETTING ERRORS!!!
fossil ci --force -m 'resolved conflicts in foo'

#EoF
---->%-------->%----

drh added on 2012-02-10 14:40:18 UTC:
Problem introduced by check-in [b9227b85cbd78].

Hurray for the self-check logic that blocked the commit and thus prevented this bug from causing permanent damage to the repository.


Attachments: