Fossil SCM
Fix the "fossil commit" command so that it does not get confused by files added by merge and then edited but keeping the same file size. See [forum:/forumpost/03f6b307f89c990b|forum thread 03f6b307f89c990b] for discussion and a more detailed description of the problem.
Commit
ed5843cf31c388bccef6dd73b1b3be1c80dd35e0e5bdff240abed7da0e908126
Parent
9c777150ed38697…
1 file changed
+8
-6
+8
-6
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -2572,11 +2572,11 @@ | ||
| 2572 | 2572 | ** table. If there were arguments passed to this command, only |
| 2573 | 2573 | ** the identified files are inserted (if they have been modified). |
| 2574 | 2574 | */ |
| 2575 | 2575 | db_prepare(&q, |
| 2576 | 2576 | "SELECT id, %Q || pathname, mrid, %s, %s, %s FROM vfile " |
| 2577 | - "WHERE chnged IN (1, 7, 9) AND NOT deleted AND is_selected(id)", | |
| 2577 | + "WHERE chnged<>0 AND NOT deleted AND is_selected(id)", | |
| 2578 | 2578 | g.zLocalRoot, |
| 2579 | 2579 | glob_expr("pathname", db_get("crlf-glob",db_get("crnl-glob",""))), |
| 2580 | 2580 | glob_expr("pathname", db_get("binary-glob","")), |
| 2581 | 2581 | glob_expr("pathname", db_get("encoding-glob","")) |
| 2582 | 2582 | ); |
| @@ -2610,16 +2610,18 @@ | ||
| 2610 | 2610 | blob_str(&fname)); |
| 2611 | 2611 | blob_reset(&fname); |
| 2612 | 2612 | } |
| 2613 | 2613 | nrid = content_put(&content); |
| 2614 | 2614 | blob_reset(&content); |
| 2615 | - if( rid>0 ){ | |
| 2616 | - content_deltify(rid, &nrid, 1, 0); | |
| 2615 | + if( nrid!=rid ){ | |
| 2616 | + if( rid>0 ){ | |
| 2617 | + content_deltify(rid, &nrid, 1, 0); | |
| 2618 | + } | |
| 2619 | + db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d, mhash=NULL WHERE id=%d", | |
| 2620 | + nrid,nrid,id); | |
| 2621 | + db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); | |
| 2617 | 2622 | } |
| 2618 | - db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d, mhash=NULL WHERE id=%d", | |
| 2619 | - nrid,nrid,id); | |
| 2620 | - db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); | |
| 2621 | 2623 | } |
| 2622 | 2624 | db_finalize(&q); |
| 2623 | 2625 | if( nConflict && !allowConflict ){ |
| 2624 | 2626 | fossil_fatal("abort due to unresolved merge conflicts; " |
| 2625 | 2627 | "use --allow-conflict to override"); |
| 2626 | 2628 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2572,11 +2572,11 @@ | |
| 2572 | ** table. If there were arguments passed to this command, only |
| 2573 | ** the identified files are inserted (if they have been modified). |
| 2574 | */ |
| 2575 | db_prepare(&q, |
| 2576 | "SELECT id, %Q || pathname, mrid, %s, %s, %s FROM vfile " |
| 2577 | "WHERE chnged IN (1, 7, 9) AND NOT deleted AND is_selected(id)", |
| 2578 | g.zLocalRoot, |
| 2579 | glob_expr("pathname", db_get("crlf-glob",db_get("crnl-glob",""))), |
| 2580 | glob_expr("pathname", db_get("binary-glob","")), |
| 2581 | glob_expr("pathname", db_get("encoding-glob","")) |
| 2582 | ); |
| @@ -2610,16 +2610,18 @@ | |
| 2610 | blob_str(&fname)); |
| 2611 | blob_reset(&fname); |
| 2612 | } |
| 2613 | nrid = content_put(&content); |
| 2614 | blob_reset(&content); |
| 2615 | if( rid>0 ){ |
| 2616 | content_deltify(rid, &nrid, 1, 0); |
| 2617 | } |
| 2618 | db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d, mhash=NULL WHERE id=%d", |
| 2619 | nrid,nrid,id); |
| 2620 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 2621 | } |
| 2622 | db_finalize(&q); |
| 2623 | if( nConflict && !allowConflict ){ |
| 2624 | fossil_fatal("abort due to unresolved merge conflicts; " |
| 2625 | "use --allow-conflict to override"); |
| 2626 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -2572,11 +2572,11 @@ | |
| 2572 | ** table. If there were arguments passed to this command, only |
| 2573 | ** the identified files are inserted (if they have been modified). |
| 2574 | */ |
| 2575 | db_prepare(&q, |
| 2576 | "SELECT id, %Q || pathname, mrid, %s, %s, %s FROM vfile " |
| 2577 | "WHERE chnged<>0 AND NOT deleted AND is_selected(id)", |
| 2578 | g.zLocalRoot, |
| 2579 | glob_expr("pathname", db_get("crlf-glob",db_get("crnl-glob",""))), |
| 2580 | glob_expr("pathname", db_get("binary-glob","")), |
| 2581 | glob_expr("pathname", db_get("encoding-glob","")) |
| 2582 | ); |
| @@ -2610,16 +2610,18 @@ | |
| 2610 | blob_str(&fname)); |
| 2611 | blob_reset(&fname); |
| 2612 | } |
| 2613 | nrid = content_put(&content); |
| 2614 | blob_reset(&content); |
| 2615 | if( nrid!=rid ){ |
| 2616 | if( rid>0 ){ |
| 2617 | content_deltify(rid, &nrid, 1, 0); |
| 2618 | } |
| 2619 | db_multi_exec("UPDATE vfile SET mrid=%d, rid=%d, mhash=NULL WHERE id=%d", |
| 2620 | nrid,nrid,id); |
| 2621 | db_multi_exec("INSERT OR IGNORE INTO unsent VALUES(%d)", nrid); |
| 2622 | } |
| 2623 | } |
| 2624 | db_finalize(&q); |
| 2625 | if( nConflict && !allowConflict ){ |
| 2626 | fossil_fatal("abort due to unresolved merge conflicts; " |
| 2627 | "use --allow-conflict to override"); |
| 2628 |