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

Function process_path

builtin/update-index.c:381–415  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381static int process_path(const char *path, struct stat *st, int stat_errno)
382{
383 int pos, len;
384 const struct cache_entry *ce;
385
386 len = strlen(path);
387 if (has_symlink_leading_path(path, len))
388 return error("'%s' is beyond a symbolic link", path);
389
390 pos = index_name_pos(the_repository->index, path, len);
391 ce = pos < 0 ? NULL : the_repository->index->cache[pos];
392 if (ce && ce_skip_worktree(ce)) {
393 /*
394 * working directory version is assumed "good"
395 * so updating it does not make sense.
396 * On the other hand, removing it from index should work
397 */
398 if (!ignore_skip_worktree_entries && allow_remove &&
399 remove_file_from_index(the_repository->index, path))
400 return error("%s: cannot remove from the index", path);
401 return 0;
402 }
403
404 /*
405 * First things first: get the stat information, to decide
406 * what to do about the pathname!
407 */
408 if (stat_errno)
409 return process_lstat_error(path, stat_errno);
410
411 if (S_ISDIR(st->st_mode))
412 return process_directory(path, len, st);
413
414 return add_one_path(ce, path, len, st);
415}
416
417static int add_cacheinfo(unsigned int mode, const struct object_id *oid,
418 const char *path, int stage)

Callers 1

update_oneFunction · 0.85

Calls 7

has_symlink_leading_pathFunction · 0.85
errorFunction · 0.85
index_name_posFunction · 0.85
remove_file_from_indexFunction · 0.85
process_lstat_errorFunction · 0.85
process_directoryFunction · 0.85
add_one_pathFunction · 0.85

Tested by

no test coverage detected