lib/git-status-checker.js
function gitUrlPath(gitUrl) {
  // Foreign URL for remote helper
  // See transport_get in transport.c
  // Note:  url.parse considers second : as part of path.  So check this first.
  const foreignParts = /^([A-Za-z0-9][A-Za-z0-9+.-]*)::(.*)$/.exec(gitUrl);
  if (foreignParts) {
    return foreignParts[2];
  }

  // Typical URL
  const gitUrlObj = url.parse(gitUrl);
  if (gitUrlObj.protocol) {
    return gitUrlObj.path;
  }

  // SCP-like syntax.  Host can be wrapped in [] to disambiguate path.
  // See parse_connect_url and host_end in connect.c
  const scpParts = /^([^@/]+)@(\[[^]\/]+\]|[^:/]+):(.*)$/.exec(gitUrl);
  if (scpParts) {
    return scpParts[3];
  }

  // Assume URL is a local path
  return gitUrl;
}
function gitUrlPath(gitUrl) {
  // Foreign URL for remote helper
  // See transport_get in transport.c
  // Note:  url.parse considers second : as part of path.  So check this first.
  const foreignParts = /^([A-Za-z0-9][A-Za-z0-9+.-]*)::(.*)$/.exec(gitUrl);
  if (foreignParts) {
    return foreignParts[2];
  }

  // Typical URL
  const gitUrlObj = url.parse(gitUrl);
  if (gitUrlObj.protocol) {
    return gitUrlObj.path;
  }

  // SCP-like syntax.  Host can be wrapped in [] to disambiguate path.
  // See parse_connect_url and host_end in connect.c
  const scpParts = /^([^@/]+)@(\[[^]\/]+\]|[^:/]+):(.*)$/.exec(gitUrl);
  if (scpParts) {
    return scpParts[3];
  }

  // Assume URL is a local path
  return gitUrl;
}
Gets the path portion of a git URL.
@param {string} gitUrl Git URL to parse.
@return {string} Path portion of the URL.
@private