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

Function verify_working_tree_path

blame.c:107–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105
106
107static void verify_working_tree_path(struct repository *r,
108 struct commit *work_tree, const char *path)
109{
110 struct commit_list *parents;
111 int pos;
112
113 for (parents = work_tree->parents; parents; parents = parents->next) {
114 const struct object_id *commit_oid = &parents->item->object.oid;
115 struct object_id blob_oid;
116 unsigned short mode;
117
118 if (!get_tree_entry(r, commit_oid, path, &blob_oid, &mode) &&
119 odb_read_object_info(r->objects, &blob_oid, NULL) == OBJ_BLOB)
120 return;
121 }
122
123 pos = index_name_pos(r->index, path, strlen(path));
124 if (pos >= 0)
125 ; /* path is in the index */
126 else if (-1 - pos < r->index->cache_nr &&
127 !strcmp(r->index->cache[-1 - pos]->name, path))
128 ; /* path is in the index, unmerged */
129 else
130 die("no such path '%s' in HEAD", path);
131}
132
133static struct commit_list **append_parent(struct repository *r,
134 struct commit_list **tail,

Callers 1

fake_working_tree_commitFunction · 0.85

Calls 4

get_tree_entryFunction · 0.85
odb_read_object_infoFunction · 0.85
index_name_posFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected