MCPcopy Index your code
hub / github.com/RsyncProject/rsync / do_delete_pass

Function do_delete_pass

generator.c:358–394  ·  view source on GitHub ↗

This deletes any files on the receiving side that are not present on the * sending side. This is used by --delete-before and --delete-after. */

Source from the content-addressed store, hash-verified

356/* This deletes any files on the receiving side that are not present on the
357 * sending side. This is used by --delete-before and --delete-after. */
358static void do_delete_pass(void)
359{
360 char fbuf[MAXPATHLEN];
361 STRUCT_STAT st;
362 int j;
363
364 /* dry_run is incremented when the destination doesn't exist yet. */
365 if (dry_run > 1 || list_only)
366 return;
367
368 for (j = 0; j < cur_flist->used; j++) {
369 struct file_struct *file = cur_flist->sorted[j];
370
371 if (!F_IS_ACTIVE(file))
372 continue;
373
374 f_name(file, fbuf);
375
376 if (!(file->flags & FLAG_CONTENT_DIR)) {
377 change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(file));
378 continue;
379 }
380
381 if (DEBUG_GTE(DEL, 1) && file->flags & FLAG_TOP_DIR)
382 rprintf(FINFO, "deleting in %s\n", fbuf);
383
384 if (link_stat(fbuf, &st, keep_dirlinks) < 0
385 || !S_ISDIR(st.st_mode))
386 continue;
387
388 delete_in_dir(fbuf, file, st.st_dev);
389 }
390 delete_in_dir(NULL, NULL, dev_zero);
391
392 if (INFO_GTE(FLIST, 2) && !am_server)
393 rprintf(FINFO, " \r");
394}
395
396static inline int mtime_differs(STRUCT_STAT *stp, struct file_struct *file)
397{

Callers 1

generate_filesFunction · 0.85

Calls 5

f_nameFunction · 0.85
change_local_filter_dirFunction · 0.85
link_statFunction · 0.85
delete_in_dirFunction · 0.85
rprintfFunction · 0.70

Tested by

no test coverage detected