diff options
author | Derrick Stolee <derrickstolee@github.com> | 2024-08-14 10:31:28 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-08-14 10:10:05 -0700 |
commit | 69020d034b75a7cd198c7351219d07ee6926fe59 (patch) | |
tree | 90647b7e547cb56cc5c2c8f266540655e6628144 /commit.c | |
parent | e32eaf73b0023122d23381dd027365e0c9fd50e8 (diff) |
commit: add gentle reference lookup method
The lookup_commit_reference_by_name() method uses lookup_commit_reference()
without an option to use lookup_commit_reference_gently(). Create a gentle
version of the method so it can be used in locations where non-commits may
be found but error messages should be silenced.
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
-rw-r--r-- | commit.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -85,12 +85,18 @@ struct commit *lookup_commit(struct repository *r, const struct object_id *oid) struct commit *lookup_commit_reference_by_name(const char *name) { + return lookup_commit_reference_by_name_gently(name, 0); +} + +struct commit *lookup_commit_reference_by_name_gently(const char *name, + int quiet) +{ struct object_id oid; struct commit *commit; if (repo_get_oid_committish(the_repository, name, &oid)) return NULL; - commit = lookup_commit_reference(the_repository, &oid); + commit = lookup_commit_reference_gently(the_repository, &oid, quiet); if (repo_parse_commit(the_repository, commit)) return NULL; return commit; |