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.

drh 2021-09-18 15:15 trunk
Commit ed5843cf31c388bccef6dd73b1b3be1c80dd35e0e5bdff240abed7da0e908126
1 file changed +8 -6
+8 -6
--- src/checkin.c
+++ src/checkin.c
@@ -2572,11 +2572,11 @@
25722572
** table. If there were arguments passed to this command, only
25732573
** the identified files are inserted (if they have been modified).
25742574
*/
25752575
db_prepare(&q,
25762576
"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)",
25782578
g.zLocalRoot,
25792579
glob_expr("pathname", db_get("crlf-glob",db_get("crnl-glob",""))),
25802580
glob_expr("pathname", db_get("binary-glob","")),
25812581
glob_expr("pathname", db_get("encoding-glob",""))
25822582
);
@@ -2610,16 +2610,18 @@
26102610
blob_str(&fname));
26112611
blob_reset(&fname);
26122612
}
26132613
nrid = content_put(&content);
26142614
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);
26172622
}
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);
26212623
}
26222624
db_finalize(&q);
26232625
if( nConflict && !allowConflict ){
26242626
fossil_fatal("abort due to unresolved merge conflicts; "
26252627
"use --allow-conflict to override");
26262628
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button