View Ticket
Not logged in
Ticket UUID: 2de4ae605844fe3fb7fdc5c0f8740b936d47a746
Title: 'checkout' command fail after merge without changes.
Status: Fixed Type: Code_Defect
Severity: Minor Priority:
Subsystem: Resolution: Fixed
Last Modified: 2009-10-31 13:12:32
Version Found In: 3275d9c63c 2009-10-21T15:43:23
Description & Comments:
The 'checkout' command scan 'mlink' table for validate specified artifact-id.
But in rare case, if merged but no files are changed, no rows added to 'mlink' table.
I think it could be use function 'is_a_version()' defined in 'update.c' for validation.
--- ../Fossil-3275d9c63c/src/checkout.c 2009-10-30 14:14:17.000000000 +0900
+++ src/checkout.c      2009-10-30 14:15:03.000000000 +0900
@@ -75,7 +75,7 @@
   if( vid==0 ){
     fossil_fatal("no such check-in: %s", g.argv[2]);
   }
-  if( !db_exists("SELECT 1 FROM mlink WHERE mid=%d", vid) ){
+  if( !is_a_version(vid) ){
     fossil_fatal("object [%.10s] is not a check-in", blob_str(&uuid));
   }
   load_vfile_from_rid(vid);
Example:
$ fossil new test.fsl
$ md a b

$ # User A add a file.
$ cd a && fossil open ../test.fsl
$ for e in fast second third fourth; do echo $e; done > foo.txt ; cat foo.txt
fast
second
third
fourth
$ fossil add foo.txt
$ fossil commit --nosign -m "add foo.txt"

$ # User B open repository.
$ cd ../b && fossil open ../test.fsl

$ # User A append new line, and fix typo.
$ cd ../a
$ echo fifth >> foo.txt
$ sed -i s/fast/first/ foo.txt
$ fossil commit --nosign -m "add fifth and fix typo"

$ # User B also fix typo and commit it with --force option.
$ cd ../b
$ sed -i s/fast/first/ foo.txt
$ fossil commit --nosign --force -m "fix typo"

$ # User A found User B's fix. merge it.
$ cd ../a
$ fossil timeline -n 1
=== 2009-10-30 ===
13:59:57 [e9d9022b4f] fix typo (user: silov tags: trunk)

$ fossil merge e9d9022b4f
$ fossil commit --nosign -m "thank you, but already fixed"

$ # User B found merged commit, but can not checkout it.
$ cd ../b
$ fossil timeline -n 1
=== 2009-10-30 ===
14:01:06 [2ba1ef2ce2] *MERGE* thank you, but already fixed (user: silov tags: trunk)

$ fossil checkout --latest
fossil: object [2ba1ef2ce2] is not a check-in

drh added on 2009-10-31 13:12:32:
Check-in 999b1779e71ed659e7b962ae96905bd9a6a5dcc6