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

Function find_packfile_uri_path

pkt-line.c:387–411  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

385}
386
387static const char *find_packfile_uri_path(const char *buffer)
388{
389 const char *URI_MARK = "://";
390 const char *path;
391 int len;
392
393 /* First char is sideband mark */
394 buffer += 1;
395
396 len = strspn(buffer, "0123456789abcdefABCDEF");
397 /* size of SHA1 and SHA256 hash */
398 if (!(len == 40 || len == 64) || buffer[len] != ' ')
399 return NULL; /* required "<hash>SP" not seen */
400
401 path = strstr(buffer + len + 1, URI_MARK);
402 if (!path)
403 return NULL;
404
405 path = strchr(path + strlen(URI_MARK), '/');
406 if (!path || !*(path + 1))
407 return NULL;
408
409 /* position after '/' */
410 return ++path;
411}
412
413enum packet_read_status packet_read_with_status(int fd, char **src_buffer,
414 size_t *src_len, char *buffer,

Callers 1

packet_read_with_statusFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected