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

Function prepare_next_entry_data

dir-iterator.c:164–187  ·  view source on GitHub ↗

* Populate iter->base with the necessary information on the next iteration * entry, represented by the given name. Return 0 on success and -1 * otherwise, setting errno accordingly. */

Source from the content-addressed store, hash-verified

162 * otherwise, setting errno accordingly.
163 */
164static int prepare_next_entry_data(struct dir_iterator_int *iter,
165 const char *name)
166{
167 int err, saved_errno;
168
169 strbuf_addstr(&iter->base.path, name);
170 /*
171 * We have to reset these because the path strbuf might have
172 * been realloc()ed at the previous strbuf_addstr().
173 */
174 iter->base.relative_path = iter->base.path.buf +
175 iter->levels[0].prefix_len;
176 iter->base.basename = iter->base.path.buf +
177 iter->levels[iter->levels_nr - 1].prefix_len;
178
179 err = lstat(iter->base.path.buf, &iter->base.st);
180
181 saved_errno = errno;
182 if (err && errno != ENOENT)
183 warning_errno("failed to stat '%s'", iter->base.path.buf);
184
185 errno = saved_errno;
186 return err;
187}
188
189int dir_iterator_advance(struct dir_iterator *dir_iterator)
190{

Callers 1

dir_iterator_advanceFunction · 0.85

Calls 2

strbuf_addstrFunction · 0.85
warning_errnoFunction · 0.85

Tested by

no test coverage detected