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

Function get_next_component

abspath.c:33–51  ·  view source on GitHub ↗

get (and remove) the next component in 'remaining' and place it in 'next' */

Source from the content-addressed store, hash-verified

31
32/* get (and remove) the next component in 'remaining' and place it in 'next' */
33static void get_next_component(struct strbuf *next, struct strbuf *remaining)
34{
35 char *start = NULL;
36 char *end = NULL;
37
38 strbuf_reset(next);
39
40 /* look for the next component */
41 /* Skip sequences of multiple path-separators */
42 for (start = remaining->buf; is_dir_sep(*start); start++)
43 ; /* nothing */
44 /* Find end of the path component */
45 for (end = start; *end && !is_dir_sep(*end); end++)
46 ; /* nothing */
47
48 strbuf_add(next, start, end - start);
49 /* remove the component from 'remaining' */
50 strbuf_remove(remaining, 0, end - remaining->buf);
51}
52
53/* copies root part from remaining to resolved, canonicalizing it on the way */
54static void get_root_part(struct strbuf *resolved, struct strbuf *remaining)

Callers 1

strbuf_realpath_1Function · 0.85

Calls 2

strbuf_addFunction · 0.85
strbuf_removeFunction · 0.85

Tested by

no test coverage detected