summaryrefslogtreecommitdiff
path: root/reflog-walk.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@google.com>2014-07-15 12:59:36 -0700
committerJunio C Hamano <gitster@pobox.com>2014-10-15 10:47:24 -0700
commit7695d118e5a3c9c6fcb4cb15eb766a1c57422aed (patch)
tree53872b12d57c9f7fca48379262baff5d4f4051eb /reflog-walk.c
parentaae383db8c384dc46abe199899235f67c838e601 (diff)
downloadgit-7695d118e5a3c9c6fcb4cb15eb766a1c57422aed.tar.gz
refs.c: change resolve_ref_unsafe reading argument to be a flags field
resolve_ref_unsafe takes a boolean argument for reading (a nonexistent ref resolves successfully for writing but not for reading). Change this to be a flags field instead, and pass the new constant RESOLVE_REF_READING when we want this behaviour. While at it, swap two of the arguments in the function to put output arguments at the end. As a nice side effect, this ensures that we can catch callers that were unaware of the new API so they can be audited. Give the wrapper functions resolve_refdup and read_ref_full the same treatment for consistency. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reflog-walk.c')
-rw-r--r--reflog-walk.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/reflog-walk.c b/reflog-walk.c
index 0e5174b605..222de762eb 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -48,7 +48,8 @@ static struct complete_reflogs *read_complete_reflog(const char *ref)
unsigned char sha1[20];
const char *name;
void *name_to_free;
- name = name_to_free = resolve_refdup(ref, sha1, 1, NULL);
+ name = name_to_free = resolve_refdup(ref, RESOLVE_REF_READING,
+ sha1, NULL);
if (name) {
for_each_reflog_ent(name, read_one_reflog, reflogs);
free(name_to_free);
@@ -174,7 +175,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
if (*branch == '\0') {
unsigned char sha1[20];
free(branch);
- branch = resolve_refdup("HEAD", sha1, 0, NULL);
+ branch = resolve_refdup("HEAD", 0, sha1, NULL);
if (!branch)
die ("No current branch");