summaryrefslogtreecommitdiff
path: root/builtin/update-ref.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/update-ref.c')
-rw-r--r--builtin/update-ref.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index 8a98615dc8..c3903c104f 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -1,4 +1,6 @@
#define USE_THE_REPOSITORY_VARIABLE
+#define DISABLE_SIGN_COMPARE_WARNINGS
+
#include "builtin.h"
#include "config.h"
#include "gettext.h"
@@ -177,7 +179,8 @@ static int parse_next_oid(const char **next, const char *end,
(*next)++;
*next = parse_arg(*next, &arg);
if (arg.len) {
- if (repo_get_oid(the_repository, arg.buf, oid))
+ if (repo_get_oid_with_flags(the_repository, arg.buf, oid,
+ GET_OID_SKIP_AMBIGUITY_CHECK))
goto invalid;
} else {
/* Without -z, an empty value means all zeros: */
@@ -195,7 +198,8 @@ static int parse_next_oid(const char **next, const char *end,
*next += arg.len;
if (arg.len) {
- if (repo_get_oid(the_repository, arg.buf, oid))
+ if (repo_get_oid_with_flags(the_repository, arg.buf, oid,
+ GET_OID_SKIP_AMBIGUITY_CHECK))
goto invalid;
} else if (flags & PARSE_SHA1_ALLOW_EMPTY) {
/* With -z, treat an empty value as all zeros: */
@@ -297,7 +301,8 @@ static void parse_cmd_symref_update(struct ref_transaction *transaction,
die("symref-update %s: expected old value", refname);
if (!strcmp(old_arg, "oid")) {
- if (repo_get_oid(the_repository, old_target, &old_oid))
+ if (repo_get_oid_with_flags(the_repository, old_target, &old_oid,
+ GET_OID_SKIP_AMBIGUITY_CHECK))
die("symref-update %s: invalid oid: %s", refname, old_target);
have_old_oid = 1;
@@ -498,7 +503,7 @@ static void parse_cmd_symref_verify(struct ref_transaction *transaction,
*/
old_target = parse_next_refname(&next);
if (!old_target)
- oidcpy(&old_oid, null_oid());
+ oidcpy(&old_oid, null_oid(the_hash_algo));
if (*next != line_termination)
die("symref-verify %s: extra input: %s", refname, next);
@@ -612,7 +617,7 @@ static void update_refs_stdin(void)
int i, j;
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction)
die("%s", err.buf);
@@ -680,7 +685,7 @@ static void update_refs_stdin(void)
*/
state = cmd->state;
transaction = ref_store_transaction_begin(get_main_ref_store(the_repository),
- &err);
+ 0, &err);
if (!transaction)
die("%s", err.buf);
@@ -770,7 +775,8 @@ int cmd_update_ref(int argc,
refname = argv[0];
value = argv[1];
oldval = argv[2];
- if (repo_get_oid(the_repository, value, &oid))
+ if (repo_get_oid_with_flags(the_repository, value, &oid,
+ GET_OID_SKIP_AMBIGUITY_CHECK))
die("%s: not a valid SHA1", value);
}
@@ -781,7 +787,8 @@ int cmd_update_ref(int argc,
* must not already exist:
*/
oidclr(&oldoid, the_repository->hash_algo);
- else if (repo_get_oid(the_repository, oldval, &oldoid))
+ else if (repo_get_oid_with_flags(the_repository, oldval, &oldoid,
+ GET_OID_SKIP_AMBIGUITY_CHECK))
die("%s: not a valid old SHA1", oldval);
}