summaryrefslogtreecommitdiff
path: root/builtin/update-ref.c
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2017-02-21 01:10:32 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-21 06:04:47 (GMT)
commit755b49ae965c9d17d91fbe7902050428f366bf69 (patch)
tree9fa000d28733ed4dd38cc5c67e85c24489383d39 /builtin/update-ref.c
parent20769079d22a9f8010232bdf6131918c33a1bf69 (diff)
downloadgit-755b49ae965c9d17d91fbe7902050428f366bf69.zip
git-755b49ae965c9d17d91fbe7902050428f366bf69.tar.gz
git-755b49ae965c9d17d91fbe7902050428f366bf69.tar.bz2
delete_ref: accept a reflog message argument
When the current branch is renamed with 'git branch -m/-M' or deleted with 'git update-ref -m<msg> -d', the event is recorded in HEAD's log with an empty message. In preparation for adding a more meaningful message to HEAD's log in these cases, update delete_ref() to take a message argument and pass it along to ref_transaction_delete(). Modify all callers to pass NULL for the new message argument; no change in behavior is intended. Note that this is relevant for HEAD's log but not for the deleted ref's log, which is currently deleted along with the ref. Even if it were not, an entry for the deletion wouldn't be present in the deleted ref's log. files_transaction_commit() writes to the log if REF_NEEDS_COMMIT or REF_LOG_ONLY are set, but lock_ref_for_update() doesn't set REF_NEEDS_COMMIT for the deleted ref because REF_DELETING is set. In contrast, the update for HEAD has REF_LOG_ONLY set by split_head_update(), resulting in the deletion being logged. Signed-off-by: Kyle Meyer <kyle@kyleam.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/update-ref.c')
-rw-r--r--builtin/update-ref.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/update-ref.c b/builtin/update-ref.c
index 7f30d3a..86d006d 100644
--- a/builtin/update-ref.c
+++ b/builtin/update-ref.c
@@ -433,7 +433,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
* For purposes of backwards compatibility, we treat
* NULL_SHA1 as "don't care" here:
*/
- return delete_ref(refname,
+ return delete_ref(NULL, refname,
(oldval && !is_null_sha1(oldsha1)) ? oldsha1 : NULL,
flags);
else