MCPcopy Index your code
hub / github.com/git/git / remove_path

Function remove_path

dir.c:3520–3540  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3518}
3519
3520int remove_path(const char *name)
3521{
3522 const char *last;
3523
3524 if (unlink(name) && !is_missing_file_error(errno))
3525 return -1;
3526
3527 last = strrchr(name, '/');
3528 if (last) {
3529 char *dirs = xstrdup(name);
3530 char *slash = dirs + (last - name);
3531 do {
3532 *slash = '\0';
3533 if (startup_info->original_cwd &&
3534 !strcmp(startup_info->original_cwd, dirs))
3535 break;
3536 } while (rmdir(dirs) == 0 && (slash = strrchr(dirs, '/')));
3537 free(dirs);
3538 }
3539 return 0;
3540}
3541
3542/*
3543 * Frees memory within dir which was allocated, and resets fields for further

Callers 10

clear_midx_fileFunction · 0.85
remove_fileFunction · 0.85
files_delete_reflogFunction · 0.85
restore_untrackedFunction · 0.85
save_untracked_filesFunction · 0.85
stash_patchFunction · 0.85
stash_working_treeFunction · 0.85
cmd_rmFunction · 0.85

Calls 2

is_missing_file_errorFunction · 0.85
xstrdupFunction · 0.85

Tested by

no test coverage detected