Merge branch 'km/delete-ref-reflog-message'

"git update-ref -d" and other operations to delete references did
not leave any entry in HEAD's reflog when the reference being
deleted was the current branch.  This is not a problem in practice
because you do not want to delete the branch you are currently on,
but caused renaming of the current branch to something else not to
be logged in a useful way.

* km/delete-ref-reflog-message:
  branch: record creation of renamed branch in HEAD's log
  rename_ref: replace empty message in HEAD's log
  update-ref: pass reflog message to delete_ref()
  delete_ref: accept a reflog message argument
This commit is contained in:
Junio C Hamano
2017-02-27 13:57:18 -08:00
18 changed files with 58 additions and 30 deletions

6
refs.c
View File

@ -592,8 +592,8 @@ static int delete_pseudoref(const char *pseudoref, const unsigned char *old_sha1
return 0;
}
int delete_ref(const char *refname, const unsigned char *old_sha1,
unsigned int flags)
int delete_ref(const char *msg, const char *refname,
const unsigned char *old_sha1, unsigned int flags)
{
struct ref_transaction *transaction;
struct strbuf err = STRBUF_INIT;
@ -604,7 +604,7 @@ int delete_ref(const char *refname, const unsigned char *old_sha1,
transaction = ref_transaction_begin(&err);
if (!transaction ||
ref_transaction_delete(transaction, refname, old_sha1,
flags, NULL, &err) ||
flags, msg, &err) ||
ref_transaction_commit(transaction, &err)) {
error("%s", err.buf);
ref_transaction_free(transaction);