Merge branch 'rs/use-skip-prefix-more'

Code cleanup.

* rs/use-skip-prefix-more:
  name-rev: use skip_prefix() instead of starts_with()
  push: use skip_prefix() instead of starts_with()
  shell: use skip_prefix() instead of starts_with()
  fmt-merge-msg: use skip_prefix() instead of starts_with()
  fetch: use skip_prefix() instead of starts_with()
This commit is contained in:
Junio C Hamano
2019-12-06 15:09:22 -08:00
5 changed files with 16 additions and 22 deletions

View File

@ -957,18 +957,12 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
kind = "";
what = "";
}
else if (starts_with(rm->name, "refs/heads/")) {
else if (skip_prefix(rm->name, "refs/heads/", &what))
kind = "branch";
what = rm->name + 11;
}
else if (starts_with(rm->name, "refs/tags/")) {
else if (skip_prefix(rm->name, "refs/tags/", &what))
kind = "tag";
what = rm->name + 10;
}
else if (starts_with(rm->name, "refs/remotes/")) {
else if (skip_prefix(rm->name, "refs/remotes/", &what))
kind = "remote-tracking branch";
what = rm->name + 13;
}
else {
kind = "";
what = rm->name;