| | @@ -136,15 +136,22 @@ |
| 136 | 136 | #define CKSIG_SETMTIME 0x004 /* Set mtime to last check-out time */ |
| 137 | 137 | |
| 138 | 138 | #endif /* INTERFACE */ |
| 139 | 139 | |
| 140 | 140 | /* |
| 141 | | -** Look at every VFILE entry with the given vid and update |
| 142 | | -** VFILE.CHNGED field according to whether or not |
| 143 | | -** the file has changed. 0 means no change. 1 means edited. 2 means |
| 144 | | -** the file has changed due to a merge. 3 means the file was added |
| 145 | | -** by a merge. |
| 141 | +** Look at every VFILE entry with the given vid and update VFILE.CHNGED field |
| 142 | +** according to whether or not the file has changed. |
| 143 | +** - 0 means no change. |
| 144 | +** - 1 means edited. |
| 145 | +** - 2 means changed due to a merge. |
| 146 | +** - 3 means added by a merge. |
| 147 | +** - 4 means changed due to an integrate merge. |
| 148 | +** - 5 means added by an integrate merge. |
| 149 | +** - 6 means became executable but has unmodified contents. |
| 150 | +** - 7 means became a symlink whose target equals its old contents. |
| 151 | +** - 8 means lost executable status but has unmodified contents. |
| 152 | +** - 9 means lost symlink status and has contents equal to its old target. |
| 146 | 153 | ** |
| 147 | 154 | ** If VFILE.DELETED is true or if VFILE.RID is zero, then the file was either |
| 148 | 155 | ** removed from configuration management via "fossil rm" or added via |
| 149 | 156 | ** "fossil add", respectively, and in both cases we always know that |
| 150 | 157 | ** the file has changed without having the check the size, mtime, |
| | @@ -170,18 +177,22 @@ |
| 170 | 177 | int useMtime = (cksigFlags & CKSIG_SHA1)==0 |
| 171 | 178 | && db_get_boolean("mtime-changes", 1); |
| 172 | 179 | |
| 173 | 180 | db_begin_transaction(); |
| 174 | 181 | db_prepare(&q, "SELECT id, %Q || pathname," |
| 175 | | - " vfile.mrid, deleted, chnged, uuid, size, mtime" |
| 182 | + " vfile.mrid, deleted, chnged, uuid, size, mtime," |
| 183 | + " CASE WHEN isexe THEN %d WHEN islink THEN %d ELSE %d END" |
| 176 | 184 | " FROM vfile LEFT JOIN blob ON vfile.mrid=blob.rid" |
| 177 | | - " WHERE vid=%d ", g.zLocalRoot, vid); |
| 185 | + " WHERE vid=%d ", g.zLocalRoot, PERM_EXE, PERM_LNK, PERM_REG, |
| 186 | + vid); |
| 178 | 187 | while( db_step(&q)==SQLITE_ROW ){ |
| 179 | 188 | int id, rid, isDeleted; |
| 180 | 189 | const char *zName; |
| 181 | 190 | int chnged = 0; |
| 182 | 191 | int oldChnged; |
| 192 | + int origPerm; |
| 193 | + int currentPerm; |
| 183 | 194 | i64 oldMtime; |
| 184 | 195 | i64 currentMtime; |
| 185 | 196 | i64 origSize; |
| 186 | 197 | i64 currentSize; |
| 187 | 198 | |
| | @@ -192,10 +203,12 @@ |
| 192 | 203 | oldChnged = chnged = db_column_int(&q, 4); |
| 193 | 204 | oldMtime = db_column_int64(&q, 7); |
| 194 | 205 | origSize = db_column_int64(&q, 6); |
| 195 | 206 | currentSize = file_wd_size(zName); |
| 196 | 207 | currentMtime = file_wd_mtime(0); |
| 208 | + origPerm = db_column_int(&q, 8); |
| 209 | + currentPerm = file_wd_perm(zName); |
| 197 | 210 | if( chnged==0 && (isDeleted || rid==0) ){ |
| 198 | 211 | /* "fossil rm" or "fossil add" always change the file */ |
| 199 | 212 | chnged = 1; |
| 200 | 213 | }else if( !file_wd_isfile_or_link(0) && currentSize>=0 ){ |
| 201 | 214 | if( cksigFlags & CKSIG_ENOTFILE ){ |
| | @@ -245,10 +258,25 @@ |
| 245 | 258 | file_set_mtime(zName, desiredMtime); |
| 246 | 259 | currentMtime = file_wd_mtime(zName); |
| 247 | 260 | } |
| 248 | 261 | } |
| 249 | 262 | } |
| 263 | +#ifndef _WIN32 |
| 264 | + if( chnged==0 || chnged==6 || chnged==7 || chnged==8 || chnged==9 ){ |
| 265 | + if( origPerm == currentPerm ){ |
| 266 | + chnged = 0; |
| 267 | + }else if( currentPerm == PERM_EXE ){ |
| 268 | + chnged = 6; |
| 269 | + }else if( currentPerm == PERM_LNK ){ |
| 270 | + chnged = 7; |
| 271 | + }else if( origPerm == PERM_EXE ){ |
| 272 | + chnged = 8; |
| 273 | + }else if( origPerm == PERM_LNK ){ |
| 274 | + chnged = 9; |
| 275 | + } |
| 276 | + } |
| 277 | +#endif |
| 250 | 278 | if( currentMtime!=oldMtime || chnged!=oldChnged ){ |
| 251 | 279 | db_multi_exec("UPDATE vfile SET mtime=%lld, chnged=%d WHERE id=%d", |
| 252 | 280 | currentMtime, chnged, id); |
| 253 | 281 | } |
| 254 | 282 | } |
| 255 | 283 | |