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

Function skip_tree_prefix

apply.c:1158–1175  ·  view source on GitHub ↗

* Skip p_value leading components from "line"; as we do not accept * absolute paths, return NULL in that case. */

Source from the content-addressed store, hash-verified

1156 * absolute paths, return NULL in that case.
1157 */
1158static const char *skip_tree_prefix(int p_value,
1159 const char *line,
1160 int llen)
1161{
1162 int nslash;
1163 int i;
1164
1165 if (!p_value)
1166 return (llen && line[0] == '/') ? NULL : line;
1167
1168 nslash = p_value;
1169 for (i = 0; i < llen; i++) {
1170 int ch = line[i];
1171 if (ch == '/' && --nslash <= 0)
1172 return (i == 0) ? NULL : &line[i + 1];
1173 }
1174 return NULL;
1175}
1176
1177/*
1178 * This is to extract the same name that appears on "diff --git"

Callers 1

git_header_nameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected