diff options
author | Ronnie Sahlberg <sahlberg@google.com> | 2014-07-15 12:59:36 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-10-15 10:47:24 -0700 |
commit | 7695d118e5a3c9c6fcb4cb15eb766a1c57422aed (patch) | |
tree | 53872b12d57c9f7fca48379262baff5d4f4051eb /sequencer.c | |
parent | aae383db8c384dc46abe199899235f67c838e601 (diff) | |
download | git-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 'sequencer.c')
-rw-r--r-- | sequencer.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sequencer.c b/sequencer.c index 47aac754bc..a03d4fa252 100644 --- a/sequencer.c +++ b/sequencer.c @@ -331,7 +331,7 @@ static int is_index_unchanged(void) unsigned char head_sha1[20]; struct commit *head_commit; - if (!resolve_ref_unsafe("HEAD", head_sha1, 1, NULL)) + if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, head_sha1, NULL)) return error(_("Could not resolve HEAD commit\n")); head_commit = lookup_commit(head_sha1); @@ -871,7 +871,7 @@ static int rollback_single_pick(void) if (!file_exists(git_path("CHERRY_PICK_HEAD")) && !file_exists(git_path("REVERT_HEAD"))) return error(_("no cherry-pick or revert in progress")); - if (read_ref_full("HEAD", head_sha1, 0, NULL)) + if (read_ref_full("HEAD", 0, head_sha1, NULL)) return error(_("cannot resolve HEAD")); if (is_null_sha1(head_sha1)) return error(_("cannot abort from a branch yet to be born")); |