MCPcopy Create free account
hub / github.com/git/git / remove_temporary_files

Function remove_temporary_files

builtin/prune.c:135–151  ·  view source on GitHub ↗

* Write errors (particularly out of space) can result in * failed temporary packs (and more rarely indexes and other * files beginning with "tmp_") accumulating in the object * and the pack directories. */

Source from the content-addressed store, hash-verified

133 * and the pack directories.
134 */
135static void remove_temporary_files(const char *path)
136{
137 DIR *dir;
138 struct dirent *de;
139
140 dir = opendir(path);
141 if (!dir) {
142 if (errno != ENOENT)
143 fprintf(stderr, "Unable to open directory %s: %s\n",
144 path, strerror(errno));
145 return;
146 }
147 while ((de = readdir(dir)) != NULL)
148 if (starts_with(de->d_name, "tmp_"))
149 prune_tmp_file(mkpath("%s/%s", path, de->d_name));
150 closedir(dir);
151}
152
153int cmd_prune(int argc,
154 const char **argv,

Callers 1

cmd_pruneFunction · 0.85

Calls 6

opendirFunction · 0.85
readdirFunction · 0.85
starts_withFunction · 0.85
prune_tmp_fileFunction · 0.85
mkpathFunction · 0.85
closedirFunction · 0.85

Tested by

no test coverage detected