Fossil SCM
Detect when an "update" is a no-op and exit early, without doing any work.
Commit
db313c32ce6edd0a6e8fe053447c3385b1d86402
Parent
44e6ae4f9a5ad46…
1 file changed
+2
-1
+2
-1
| --- src/update.c | ||
| +++ src/update.c | ||
| @@ -24,11 +24,11 @@ | ||
| 24 | 24 | |
| 25 | 25 | /* |
| 26 | 26 | ** Return true if artifact rid is a version |
| 27 | 27 | */ |
| 28 | 28 | int is_a_version(int rid){ |
| 29 | - return db_exists("SELECT 1 FROM event WHERE objid=%d AND type='ci'", rid); | |
| 29 | + return db_exists("SELECT 1 FROM event WHERE objid=%d AND type='ci'", rid); | |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /* |
| 33 | 33 | ** COMMAND: update |
| 34 | 34 | ** |
| @@ -111,10 +111,11 @@ | ||
| 111 | 111 | tid = db_int(0, "SELECT rid FROM leaves, event" |
| 112 | 112 | " WHERE event.objid=leaves.rid" |
| 113 | 113 | " ORDER BY event.mtime DESC"); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | + if( tid==vid ) return; /* Nothing to update */ | |
| 116 | 117 | db_begin_transaction(); |
| 117 | 118 | vfile_check_signature(vid, 1); |
| 118 | 119 | if( !nochangeFlag ) undo_begin(); |
| 119 | 120 | load_vfile_from_rid(tid); |
| 120 | 121 | |
| 121 | 122 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -24,11 +24,11 @@ | |
| 24 | |
| 25 | /* |
| 26 | ** Return true if artifact rid is a version |
| 27 | */ |
| 28 | int is_a_version(int rid){ |
| 29 | return db_exists("SELECT 1 FROM event WHERE objid=%d AND type='ci'", rid); |
| 30 | } |
| 31 | |
| 32 | /* |
| 33 | ** COMMAND: update |
| 34 | ** |
| @@ -111,10 +111,11 @@ | |
| 111 | tid = db_int(0, "SELECT rid FROM leaves, event" |
| 112 | " WHERE event.objid=leaves.rid" |
| 113 | " ORDER BY event.mtime DESC"); |
| 114 | } |
| 115 | |
| 116 | db_begin_transaction(); |
| 117 | vfile_check_signature(vid, 1); |
| 118 | if( !nochangeFlag ) undo_begin(); |
| 119 | load_vfile_from_rid(tid); |
| 120 | |
| 121 |
| --- src/update.c | |
| +++ src/update.c | |
| @@ -24,11 +24,11 @@ | |
| 24 | |
| 25 | /* |
| 26 | ** Return true if artifact rid is a version |
| 27 | */ |
| 28 | int is_a_version(int rid){ |
| 29 | return db_exists("SELECT 1 FROM event WHERE objid=%d AND type='ci'", rid); |
| 30 | } |
| 31 | |
| 32 | /* |
| 33 | ** COMMAND: update |
| 34 | ** |
| @@ -111,10 +111,11 @@ | |
| 111 | tid = db_int(0, "SELECT rid FROM leaves, event" |
| 112 | " WHERE event.objid=leaves.rid" |
| 113 | " ORDER BY event.mtime DESC"); |
| 114 | } |
| 115 | |
| 116 | if( tid==vid ) return; /* Nothing to update */ |
| 117 | db_begin_transaction(); |
| 118 | vfile_check_signature(vid, 1); |
| 119 | if( !nochangeFlag ) undo_begin(); |
| 120 | load_vfile_from_rid(tid); |
| 121 | |
| 122 |