File tree Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Expand file tree Collapse file tree 2 files changed +41
-1
lines changed Original file line number Diff line number Diff line change @@ -279,3 +279,44 @@ Deno.test({
279
279
} ) ;
280
280
} ,
281
281
} ) ;
282
+
283
+ Deno . test ( {
284
+ name : "test push with no changes" ,
285
+ permissions : {
286
+ read : true ,
287
+ write : true ,
288
+ net : true ,
289
+ } ,
290
+ async fn ( ) {
291
+ await doWithNewProject ( async ( { project, branch } ) => {
292
+ await doWithTempDir ( async ( tempDir ) => {
293
+ // Create a file
294
+ const vtFilePath = "test.txt" ;
295
+ const localFilePath = join ( tempDir , vtFilePath ) ;
296
+ await Deno . writeTextFile ( localFilePath , "test content" ) ;
297
+
298
+ // Do the push
299
+ const firstResult = await push ( {
300
+ targetDir : tempDir ,
301
+ projectId : project . id ,
302
+ branchId : branch . id ,
303
+ } ) ;
304
+
305
+ // Verify that FileState reports the file was created. We have better
306
+ // tests for ensuring this operation with more detail, this is just to
307
+ // make sure it's idempotent.
308
+ assertEquals ( firstResult . created . length , 1 ) ;
309
+ assertEquals ( firstResult . size ( ) , 1 ) ;
310
+
311
+ const secondResult = await push ( {
312
+ targetDir : tempDir ,
313
+ projectId : project . id ,
314
+ branchId : branch . id ,
315
+ } ) ;
316
+ // Should be no changes on the second push
317
+ assertEquals ( secondResult . not_modified . length , 1 ) ;
318
+ assertEquals ( secondResult . size ( ) , 1 ) ;
319
+ } , "vt_push_nochange_test_" ) ;
320
+ } ) ;
321
+ } ,
322
+ } ) ;
Original file line number Diff line number Diff line change @@ -209,7 +209,6 @@ export async function isFileModified(
209
209
) : Promise < boolean > {
210
210
// First use the mtime as a heuristic to avoid unnecessary content checks
211
211
if ( projectMtime == localMtime ) return false ;
212
- if ( projectMtime > localMtime ) return true ;
213
212
214
213
// If mtime indicates a possible change, check content
215
214
const projectFileContent = await sdk . projects . files . getContent (
You can’t perform that action at this time.
0 commit comments