refs: rename constant REF_NODEREF
to REF_NO_DEREF
Even after working with this code for years, I still see this constant name as "ref node ref". Rename it to make it's meaning clearer. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
5ac95fee3d
commit
91774afcc3
@ -2151,7 +2151,7 @@ static void am_abort(struct am_state *state)
|
|||||||
has_curr_head ? &curr_head : NULL, 0,
|
has_curr_head ? &curr_head : NULL, 0,
|
||||||
UPDATE_REFS_DIE_ON_ERR);
|
UPDATE_REFS_DIE_ON_ERR);
|
||||||
else if (curr_branch)
|
else if (curr_branch)
|
||||||
delete_ref(NULL, curr_branch, NULL, REF_NODEREF);
|
delete_ref(NULL, curr_branch, NULL, REF_NO_DEREF);
|
||||||
|
|
||||||
free(curr_branch);
|
free(curr_branch);
|
||||||
am_destroy(state);
|
am_destroy(state);
|
||||||
|
@ -258,7 +258,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (delete_ref(NULL, name, is_null_oid(&oid) ? NULL : &oid,
|
if (delete_ref(NULL, name, is_null_oid(&oid) ? NULL : &oid,
|
||||||
REF_NODEREF)) {
|
REF_NO_DEREF)) {
|
||||||
error(remote_branch
|
error(remote_branch
|
||||||
? _("Error deleting remote-tracking branch '%s'")
|
? _("Error deleting remote-tracking branch '%s'")
|
||||||
: _("Error deleting branch '%s'"),
|
: _("Error deleting branch '%s'"),
|
||||||
|
@ -665,7 +665,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
|
|||||||
/* Nothing to do. */
|
/* Nothing to do. */
|
||||||
} else if (opts->force_detach || !new->path) { /* No longer on any branch. */
|
} else if (opts->force_detach || !new->path) { /* No longer on any branch. */
|
||||||
update_ref(msg.buf, "HEAD", &new->commit->object.oid, NULL,
|
update_ref(msg.buf, "HEAD", &new->commit->object.oid, NULL,
|
||||||
REF_NODEREF, UPDATE_REFS_DIE_ON_ERR);
|
REF_NO_DEREF, UPDATE_REFS_DIE_ON_ERR);
|
||||||
if (!opts->quiet) {
|
if (!opts->quiet) {
|
||||||
if (old->path &&
|
if (old->path &&
|
||||||
advice_detached_head && !opts->force_detach)
|
advice_detached_head && !opts->force_detach)
|
||||||
|
@ -689,7 +689,7 @@ static void update_head(const struct ref *our, const struct ref *remote,
|
|||||||
} else if (our) {
|
} else if (our) {
|
||||||
struct commit *c = lookup_commit_reference(&our->old_oid);
|
struct commit *c = lookup_commit_reference(&our->old_oid);
|
||||||
/* --branch specifies a non-branch (i.e. tags), detach HEAD */
|
/* --branch specifies a non-branch (i.e. tags), detach HEAD */
|
||||||
update_ref(msg, "HEAD", &c->object.oid, NULL, REF_NODEREF,
|
update_ref(msg, "HEAD", &c->object.oid, NULL, REF_NO_DEREF,
|
||||||
UPDATE_REFS_DIE_ON_ERR);
|
UPDATE_REFS_DIE_ON_ERR);
|
||||||
} else if (remote) {
|
} else if (remote) {
|
||||||
/*
|
/*
|
||||||
@ -697,7 +697,7 @@ static void update_head(const struct ref *our, const struct ref *remote,
|
|||||||
* HEAD points to a branch but we don't know which one.
|
* HEAD points to a branch but we don't know which one.
|
||||||
* Detach HEAD in all these cases.
|
* Detach HEAD in all these cases.
|
||||||
*/
|
*/
|
||||||
update_ref(msg, "HEAD", &remote->old_oid, NULL, REF_NODEREF,
|
update_ref(msg, "HEAD", &remote->old_oid, NULL, REF_NO_DEREF,
|
||||||
UPDATE_REFS_DIE_ON_ERR);
|
UPDATE_REFS_DIE_ON_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -686,7 +686,7 @@ static int merge_abort(struct notes_merge_options *o)
|
|||||||
|
|
||||||
if (delete_ref(NULL, "NOTES_MERGE_PARTIAL", NULL, 0))
|
if (delete_ref(NULL, "NOTES_MERGE_PARTIAL", NULL, 0))
|
||||||
ret += error(_("failed to delete ref NOTES_MERGE_PARTIAL"));
|
ret += error(_("failed to delete ref NOTES_MERGE_PARTIAL"));
|
||||||
if (delete_ref(NULL, "NOTES_MERGE_REF", NULL, REF_NODEREF))
|
if (delete_ref(NULL, "NOTES_MERGE_REF", NULL, REF_NO_DEREF))
|
||||||
ret += error(_("failed to delete ref NOTES_MERGE_REF"));
|
ret += error(_("failed to delete ref NOTES_MERGE_REF"));
|
||||||
if (notes_merge_abort(o))
|
if (notes_merge_abort(o))
|
||||||
ret += error(_("failed to remove 'git notes merge' worktree"));
|
ret += error(_("failed to remove 'git notes merge' worktree"));
|
||||||
|
@ -693,7 +693,7 @@ static int mv(int argc, const char **argv)
|
|||||||
read_ref_full(item->string, RESOLVE_REF_READING, &oid, &flag);
|
read_ref_full(item->string, RESOLVE_REF_READING, &oid, &flag);
|
||||||
if (!(flag & REF_ISSYMREF))
|
if (!(flag & REF_ISSYMREF))
|
||||||
continue;
|
continue;
|
||||||
if (delete_ref(NULL, item->string, NULL, REF_NODEREF))
|
if (delete_ref(NULL, item->string, NULL, REF_NO_DEREF))
|
||||||
die(_("deleting '%s' failed"), item->string);
|
die(_("deleting '%s' failed"), item->string);
|
||||||
}
|
}
|
||||||
for (i = 0; i < remote_branches.nr; i++) {
|
for (i = 0; i < remote_branches.nr; i++) {
|
||||||
@ -788,7 +788,7 @@ static int rm(int argc, const char **argv)
|
|||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
result = delete_refs("remote: remove", &branches, REF_NODEREF);
|
result = delete_refs("remote: remove", &branches, REF_NO_DEREF);
|
||||||
string_list_clear(&branches, 0);
|
string_list_clear(&branches, 0);
|
||||||
|
|
||||||
if (skipped.nr) {
|
if (skipped.nr) {
|
||||||
@ -1255,7 +1255,7 @@ static int set_head(int argc, const char **argv)
|
|||||||
head_name = xstrdup(states.heads.items[0].string);
|
head_name = xstrdup(states.heads.items[0].string);
|
||||||
free_remote_ref_states(&states);
|
free_remote_ref_states(&states);
|
||||||
} else if (opt_d && !opt_a && argc == 1) {
|
} else if (opt_d && !opt_a && argc == 1) {
|
||||||
if (delete_ref(NULL, buf.buf, NULL, REF_NODEREF))
|
if (delete_ref(NULL, buf.buf, NULL, REF_NO_DEREF))
|
||||||
result |= error(_("Could not delete %s"), buf.buf);
|
result |= error(_("Could not delete %s"), buf.buf);
|
||||||
} else
|
} else
|
||||||
usage_with_options(builtin_remote_sethead_usage, options);
|
usage_with_options(builtin_remote_sethead_usage, options);
|
||||||
|
@ -58,7 +58,7 @@ int cmd_symbolic_ref(int argc, const char **argv, const char *prefix)
|
|||||||
die("Cannot delete %s, not a symbolic ref", argv[0]);
|
die("Cannot delete %s, not a symbolic ref", argv[0]);
|
||||||
if (!strcmp(argv[0], "HEAD"))
|
if (!strcmp(argv[0], "HEAD"))
|
||||||
die("deleting '%s' is not allowed", argv[0]);
|
die("deleting '%s' is not allowed", argv[0]);
|
||||||
return delete_ref(NULL, argv[0], NULL, REF_NODEREF);
|
return delete_ref(NULL, argv[0], NULL, REF_NO_DEREF);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (argc) {
|
switch (argc) {
|
||||||
|
@ -312,7 +312,7 @@ static const char *parse_cmd_verify(struct ref_transaction *transaction,
|
|||||||
static const char *parse_cmd_option(struct strbuf *input, const char *next)
|
static const char *parse_cmd_option(struct strbuf *input, const char *next)
|
||||||
{
|
{
|
||||||
if (!strncmp(next, "no-deref", 8) && next[8] == line_termination)
|
if (!strncmp(next, "no-deref", 8) && next[8] == line_termination)
|
||||||
update_flags |= REF_NODEREF;
|
update_flags |= REF_NO_DEREF;
|
||||||
else
|
else
|
||||||
die("option unknown: %s", next);
|
die("option unknown: %s", next);
|
||||||
return next + 8;
|
return next + 8;
|
||||||
@ -427,7 +427,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (no_deref)
|
if (no_deref)
|
||||||
flags = REF_NODEREF;
|
flags = REF_NO_DEREF;
|
||||||
if (delete)
|
if (delete)
|
||||||
/*
|
/*
|
||||||
* For purposes of backwards compatibility, we treat
|
* For purposes of backwards compatibility, we treat
|
||||||
|
6
refs.h
6
refs.h
@ -476,7 +476,7 @@ struct ref_transaction *ref_transaction_begin(struct strbuf *err);
|
|||||||
* transaction.
|
* transaction.
|
||||||
*
|
*
|
||||||
* flags -- flags affecting the update, passed to
|
* flags -- flags affecting the update, passed to
|
||||||
* update_ref_lock(). Possible flags: REF_NODEREF,
|
* update_ref_lock(). Possible flags: REF_NO_DEREF,
|
||||||
* REF_FORCE_CREATE_REFLOG. See those constants for more
|
* REF_FORCE_CREATE_REFLOG. See those constants for more
|
||||||
* information.
|
* information.
|
||||||
*
|
*
|
||||||
@ -504,7 +504,7 @@ struct ref_transaction *ref_transaction_begin(struct strbuf *err);
|
|||||||
* If this flag is not specified, then symbolic references are
|
* If this flag is not specified, then symbolic references are
|
||||||
* dereferenced and the update is applied to the referent.
|
* dereferenced and the update is applied to the referent.
|
||||||
*/
|
*/
|
||||||
#define REF_NODEREF (1 << 0)
|
#define REF_NO_DEREF (1 << 0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Force the creation of a reflog for this reference, even if it
|
* Force the creation of a reflog for this reference, even if it
|
||||||
@ -517,7 +517,7 @@ struct ref_transaction *ref_transaction_begin(struct strbuf *err);
|
|||||||
* ref_transaction_update() and friends:
|
* ref_transaction_update() and friends:
|
||||||
*/
|
*/
|
||||||
#define REF_TRANSACTION_UPDATE_ALLOWED_FLAGS \
|
#define REF_TRANSACTION_UPDATE_ALLOWED_FLAGS \
|
||||||
(REF_NODEREF | REF_FORCE_CREATE_REFLOG)
|
(REF_NO_DEREF | REF_FORCE_CREATE_REFLOG)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add a reference update to transaction. `new_oid` is the value that
|
* Add a reference update to transaction. `new_oid` is the value that
|
||||||
|
@ -13,14 +13,14 @@
|
|||||||
/*
|
/*
|
||||||
* This backend uses the following flags in `ref_update::flags` for
|
* This backend uses the following flags in `ref_update::flags` for
|
||||||
* internal bookkeeping purposes. Their numerical values must not
|
* internal bookkeeping purposes. Their numerical values must not
|
||||||
* conflict with REF_NODEREF, REF_FORCE_CREATE_REFLOG, REF_HAVE_NEW,
|
* conflict with REF_NO_DEREF, REF_FORCE_CREATE_REFLOG, REF_HAVE_NEW,
|
||||||
* REF_HAVE_OLD, or REF_ISPRUNING, which are also stored in
|
* REF_HAVE_OLD, or REF_ISPRUNING, which are also stored in
|
||||||
* `ref_update::flags`.
|
* `ref_update::flags`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Used as a flag in ref_update::flags when a loose ref is being
|
* Used as a flag in ref_update::flags when a loose ref is being
|
||||||
* pruned. This flag must only be used when REF_NODEREF is set.
|
* pruned. This flag must only be used when REF_NO_DEREF is set.
|
||||||
*/
|
*/
|
||||||
#define REF_ISPRUNING (1 << 4)
|
#define REF_ISPRUNING (1 << 4)
|
||||||
|
|
||||||
@ -1044,7 +1044,7 @@ static void prune_ref(struct files_ref_store *refs, struct ref_to_prune *r)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
ref_transaction_add_update(
|
ref_transaction_add_update(
|
||||||
transaction, r->name,
|
transaction, r->name,
|
||||||
REF_NODEREF | REF_HAVE_NEW | REF_HAVE_OLD | REF_ISPRUNING,
|
REF_NO_DEREF | REF_HAVE_NEW | REF_HAVE_OLD | REF_ISPRUNING,
|
||||||
&null_oid, &r->oid, NULL);
|
&null_oid, &r->oid, NULL);
|
||||||
if (ref_transaction_commit(transaction, &err))
|
if (ref_transaction_commit(transaction, &err))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -1133,7 +1133,7 @@ static int files_pack_refs(struct ref_store *ref_store, unsigned int flags)
|
|||||||
*/
|
*/
|
||||||
if (ref_transaction_update(transaction, iter->refname,
|
if (ref_transaction_update(transaction, iter->refname,
|
||||||
iter->oid, NULL,
|
iter->oid, NULL,
|
||||||
REF_NODEREF, NULL, &err))
|
REF_NO_DEREF, NULL, &err))
|
||||||
die("failure preparing to create packed reference %s: %s",
|
die("failure preparing to create packed reference %s: %s",
|
||||||
iter->refname, err.buf);
|
iter->refname, err.buf);
|
||||||
|
|
||||||
@ -1336,7 +1336,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!copy && refs_delete_ref(&refs->base, logmsg, oldrefname,
|
if (!copy && refs_delete_ref(&refs->base, logmsg, oldrefname,
|
||||||
&orig_oid, REF_NODEREF)) {
|
&orig_oid, REF_NO_DEREF)) {
|
||||||
error("unable to delete old %s", oldrefname);
|
error("unable to delete old %s", oldrefname);
|
||||||
goto rollback;
|
goto rollback;
|
||||||
}
|
}
|
||||||
@ -1352,7 +1352,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
|
|||||||
RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
|
RESOLVE_REF_READING | RESOLVE_REF_NO_RECURSE,
|
||||||
&oid, NULL) &&
|
&oid, NULL) &&
|
||||||
refs_delete_ref(&refs->base, NULL, newrefname,
|
refs_delete_ref(&refs->base, NULL, newrefname,
|
||||||
NULL, REF_NODEREF)) {
|
NULL, REF_NO_DEREF)) {
|
||||||
if (errno == EISDIR) {
|
if (errno == EISDIR) {
|
||||||
struct strbuf path = STRBUF_INIT;
|
struct strbuf path = STRBUF_INIT;
|
||||||
int result;
|
int result;
|
||||||
@ -1377,7 +1377,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
|
|||||||
logmoved = log;
|
logmoved = log;
|
||||||
|
|
||||||
lock = lock_ref_oid_basic(refs, newrefname, NULL, NULL, NULL,
|
lock = lock_ref_oid_basic(refs, newrefname, NULL, NULL, NULL,
|
||||||
REF_NODEREF, NULL, &err);
|
REF_NO_DEREF, NULL, &err);
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
if (copy)
|
if (copy)
|
||||||
error("unable to copy '%s' to '%s': %s", oldrefname, newrefname, err.buf);
|
error("unable to copy '%s' to '%s': %s", oldrefname, newrefname, err.buf);
|
||||||
@ -1400,7 +1400,7 @@ static int files_copy_or_rename_ref(struct ref_store *ref_store,
|
|||||||
|
|
||||||
rollback:
|
rollback:
|
||||||
lock = lock_ref_oid_basic(refs, oldrefname, NULL, NULL, NULL,
|
lock = lock_ref_oid_basic(refs, oldrefname, NULL, NULL, NULL,
|
||||||
REF_NODEREF, NULL, &err);
|
REF_NO_DEREF, NULL, &err);
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
error("unable to lock %s for rollback: %s", oldrefname, err.buf);
|
error("unable to lock %s for rollback: %s", oldrefname, err.buf);
|
||||||
strbuf_release(&err);
|
strbuf_release(&err);
|
||||||
@ -1816,7 +1816,7 @@ static int files_create_symref(struct ref_store *ref_store,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
lock = lock_ref_oid_basic(refs, refname, NULL,
|
lock = lock_ref_oid_basic(refs, refname, NULL,
|
||||||
NULL, NULL, REF_NODEREF, NULL,
|
NULL, NULL, REF_NO_DEREF, NULL,
|
||||||
&err);
|
&err);
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
error("%s", err.buf);
|
error("%s", err.buf);
|
||||||
@ -2200,7 +2200,7 @@ static int split_head_update(struct ref_update *update,
|
|||||||
|
|
||||||
new_update = ref_transaction_add_update(
|
new_update = ref_transaction_add_update(
|
||||||
transaction, "HEAD",
|
transaction, "HEAD",
|
||||||
update->flags | REF_LOG_ONLY | REF_NODEREF,
|
update->flags | REF_LOG_ONLY | REF_NO_DEREF,
|
||||||
&update->new_oid, &update->old_oid,
|
&update->new_oid, &update->old_oid,
|
||||||
update->msg);
|
update->msg);
|
||||||
|
|
||||||
@ -2219,8 +2219,8 @@ static int split_head_update(struct ref_update *update,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* update is for a symref that points at referent and doesn't have
|
* update is for a symref that points at referent and doesn't have
|
||||||
* REF_NODEREF set. Split it into two updates:
|
* REF_NO_DEREF set. Split it into two updates:
|
||||||
* - The original update, but with REF_LOG_ONLY and REF_NODEREF set
|
* - The original update, but with REF_LOG_ONLY and REF_NO_DEREF set
|
||||||
* - A new, separate update for the referent reference
|
* - A new, separate update for the referent reference
|
||||||
* Note that the new update will itself be subject to splitting when
|
* Note that the new update will itself be subject to splitting when
|
||||||
* the iteration gets to it.
|
* the iteration gets to it.
|
||||||
@ -2275,7 +2275,7 @@ static int split_symref_update(struct files_ref_store *refs,
|
|||||||
* doesn't need to check its old SHA-1 value, as that will be
|
* doesn't need to check its old SHA-1 value, as that will be
|
||||||
* done when new_update is processed.
|
* done when new_update is processed.
|
||||||
*/
|
*/
|
||||||
update->flags |= REF_LOG_ONLY | REF_NODEREF;
|
update->flags |= REF_LOG_ONLY | REF_NO_DEREF;
|
||||||
update->flags &= ~REF_HAVE_OLD;
|
update->flags &= ~REF_HAVE_OLD;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2344,7 +2344,7 @@ static int check_old_oid(struct ref_update *update, struct object_id *oid,
|
|||||||
* - Check that its old SHA-1 value (if specified) is correct, and in
|
* - Check that its old SHA-1 value (if specified) is correct, and in
|
||||||
* any case record it in update->lock->old_oid for later use when
|
* any case record it in update->lock->old_oid for later use when
|
||||||
* writing the reflog.
|
* writing the reflog.
|
||||||
* - If it is a symref update without REF_NODEREF, split it up into a
|
* - If it is a symref update without REF_NO_DEREF, split it up into a
|
||||||
* REF_LOG_ONLY update of the symref and add a separate update for
|
* REF_LOG_ONLY update of the symref and add a separate update for
|
||||||
* the referent to transaction.
|
* the referent to transaction.
|
||||||
* - If it is an update of head_ref, add a corresponding REF_LOG_ONLY
|
* - If it is an update of head_ref, add a corresponding REF_LOG_ONLY
|
||||||
@ -2392,7 +2392,7 @@ static int lock_ref_for_update(struct files_ref_store *refs,
|
|||||||
update->backend_data = lock;
|
update->backend_data = lock;
|
||||||
|
|
||||||
if (update->type & REF_ISSYMREF) {
|
if (update->type & REF_ISSYMREF) {
|
||||||
if (update->flags & REF_NODEREF) {
|
if (update->flags & REF_NO_DEREF) {
|
||||||
/*
|
/*
|
||||||
* We won't be reading the referent as part of
|
* We won't be reading the referent as part of
|
||||||
* the transaction, so we have to read it here
|
* the transaction, so we have to read it here
|
||||||
@ -2564,7 +2564,7 @@ static int files_transaction_prepare(struct ref_store *ref_store,
|
|||||||
* split_symref_update() or split_head_update(), those
|
* split_symref_update() or split_head_update(), those
|
||||||
* functions will check that the new updates don't have the
|
* functions will check that the new updates don't have the
|
||||||
* same refname as any existing ones.) Also fail if any of the
|
* same refname as any existing ones.) Also fail if any of the
|
||||||
* updates use REF_ISPRUNING without REF_NODEREF.
|
* updates use REF_ISPRUNING without REF_NO_DEREF.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < transaction->nr; i++) {
|
for (i = 0; i < transaction->nr; i++) {
|
||||||
struct ref_update *update = transaction->updates[i];
|
struct ref_update *update = transaction->updates[i];
|
||||||
@ -2572,8 +2572,8 @@ static int files_transaction_prepare(struct ref_store *ref_store,
|
|||||||
string_list_append(&affected_refnames, update->refname);
|
string_list_append(&affected_refnames, update->refname);
|
||||||
|
|
||||||
if ((update->flags & REF_ISPRUNING) &&
|
if ((update->flags & REF_ISPRUNING) &&
|
||||||
!(update->flags & REF_NODEREF))
|
!(update->flags & REF_NO_DEREF))
|
||||||
BUG("REF_ISPRUNING set without REF_NODEREF");
|
BUG("REF_ISPRUNING set without REF_NO_DEREF");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We store a pointer to update in item->util, but at
|
* We store a pointer to update in item->util, but at
|
||||||
@ -2651,7 +2651,7 @@ static int files_transaction_prepare(struct ref_store *ref_store,
|
|||||||
|
|
||||||
ref_transaction_add_update(
|
ref_transaction_add_update(
|
||||||
packed_transaction, update->refname,
|
packed_transaction, update->refname,
|
||||||
REF_HAVE_NEW | REF_NODEREF,
|
REF_HAVE_NEW | REF_NO_DEREF,
|
||||||
&update->new_oid, NULL,
|
&update->new_oid, NULL,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
@ -2995,7 +2995,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
|
|||||||
* reference if --updateref was specified:
|
* reference if --updateref was specified:
|
||||||
*/
|
*/
|
||||||
lock = lock_ref_oid_basic(refs, refname, oid,
|
lock = lock_ref_oid_basic(refs, refname, oid,
|
||||||
NULL, NULL, REF_NODEREF,
|
NULL, NULL, REF_NO_DEREF,
|
||||||
&type, &err);
|
&type, &err);
|
||||||
if (!lock) {
|
if (!lock) {
|
||||||
error("cannot lock ref '%s': %s", refname, err.buf);
|
error("cannot lock ref '%s': %s", refname, err.buf);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* The following flags can appear in `ref_update::flags`. Their
|
* The following flags can appear in `ref_update::flags`. Their
|
||||||
* numerical values must not conflict with those of REF_NODEREF and
|
* numerical values must not conflict with those of REF_NO_DEREF and
|
||||||
* REF_FORCE_CREATE_REFLOG, which are also stored in
|
* REF_FORCE_CREATE_REFLOG, which are also stored in
|
||||||
* `ref_update::flags`.
|
* `ref_update::flags`.
|
||||||
*/
|
*/
|
||||||
@ -119,7 +119,7 @@ struct ref_update {
|
|||||||
struct object_id old_oid;
|
struct object_id old_oid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* One or more of REF_NODEREF, REF_FORCE_CREATE_REFLOG,
|
* One or more of REF_NO_DEREF, REF_FORCE_CREATE_REFLOG,
|
||||||
* REF_HAVE_NEW, REF_HAVE_OLD, or backend-specific flags.
|
* REF_HAVE_NEW, REF_HAVE_OLD, or backend-specific flags.
|
||||||
*/
|
*/
|
||||||
unsigned int flags;
|
unsigned int flags;
|
||||||
|
@ -1116,11 +1116,11 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
|
|||||||
*/
|
*/
|
||||||
if (command == TODO_PICK && !opts->no_commit && (res == 0 || res == 1) &&
|
if (command == TODO_PICK && !opts->no_commit && (res == 0 || res == 1) &&
|
||||||
update_ref(NULL, "CHERRY_PICK_HEAD", &commit->object.oid, NULL,
|
update_ref(NULL, "CHERRY_PICK_HEAD", &commit->object.oid, NULL,
|
||||||
REF_NODEREF, UPDATE_REFS_MSG_ON_ERR))
|
REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR))
|
||||||
res = -1;
|
res = -1;
|
||||||
if (command == TODO_REVERT && ((opts->no_commit && res == 0) || res == 1) &&
|
if (command == TODO_REVERT && ((opts->no_commit && res == 0) || res == 1) &&
|
||||||
update_ref(NULL, "REVERT_HEAD", &commit->object.oid, NULL,
|
update_ref(NULL, "REVERT_HEAD", &commit->object.oid, NULL,
|
||||||
REF_NODEREF, UPDATE_REFS_MSG_ON_ERR))
|
REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR))
|
||||||
res = -1;
|
res = -1;
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
@ -2125,7 +2125,7 @@ cleanup_head_ref:
|
|||||||
msg = reflog_message(opts, "finish", "%s onto %s",
|
msg = reflog_message(opts, "finish", "%s onto %s",
|
||||||
head_ref.buf, buf.buf);
|
head_ref.buf, buf.buf);
|
||||||
if (update_ref(msg, head_ref.buf, &head, &orig,
|
if (update_ref(msg, head_ref.buf, &head, &orig,
|
||||||
REF_NODEREF, UPDATE_REFS_MSG_ON_ERR)) {
|
REF_NO_DEREF, UPDATE_REFS_MSG_ON_ERR)) {
|
||||||
res = error(_("could not update %s"),
|
res = error(_("could not update %s"),
|
||||||
head_ref.buf);
|
head_ref.buf);
|
||||||
goto cleanup_head_ref;
|
goto cleanup_head_ref;
|
||||||
|
Loading…
Reference in New Issue
Block a user