diff options
author | Ronnie Sahlberg <sahlberg@google.com> | 2014-04-30 12:22:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-10-15 10:47:22 -0700 |
commit | db7516ab9f435e3ce86b257c6631fb4d2dfb12ae (patch) | |
tree | 84b452b76a6315511691d30f7e97a2a9388b25c1 /builtin/update-ref.c | |
parent | dbdcac7d5c5eea314ec4c318a5e88cff427e9f0e (diff) | |
download | git-db7516ab9f435e3ce86b257c6631fb4d2dfb12ae.tar.gz git-db7516ab9f435e3ce86b257c6631fb4d2dfb12ae.tar.xz |
refs.c: pass the ref log message to _create/delete/update instead of _commit
Change the ref transaction API so that we pass the reflog message to the
create/delete/update functions instead of to ref_transaction_commit.
This allows different reflog messages for each ref update in a multi-ref
transaction.
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 'builtin/update-ref.c')
-rw-r--r-- | builtin/update-ref.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/builtin/update-ref.c b/builtin/update-ref.c index 54a48c0cf..6c9be0512 100644 --- a/builtin/update-ref.c +++ b/builtin/update-ref.c @@ -14,6 +14,7 @@ static const char * const git_update_ref_usage[] = { static char line_termination = '\n'; static int update_flags; +static const char *msg; /* * Parse one whitespace- or NUL-terminated, possibly C-quoted argument @@ -198,7 +199,7 @@ static const char *parse_cmd_update(struct ref_transaction *transaction, die("update %s: extra input: %s", refname, next); if (ref_transaction_update(transaction, refname, new_sha1, old_sha1, - update_flags, have_old, &err)) + update_flags, have_old, msg, &err)) die("%s", err.buf); update_flags = 0; @@ -229,7 +230,7 @@ static const char *parse_cmd_create(struct ref_transaction *transaction, die("create %s: extra input: %s", refname, next); if (ref_transaction_create(transaction, refname, new_sha1, - update_flags, &err)) + update_flags, msg, &err)) die("%s", err.buf); update_flags = 0; @@ -264,7 +265,7 @@ static const char *parse_cmd_delete(struct ref_transaction *transaction, die("delete %s: extra input: %s", refname, next); if (ref_transaction_delete(transaction, refname, old_sha1, - update_flags, have_old, &err)) + update_flags, have_old, msg, &err)) die("%s", err.buf); update_flags = 0; @@ -300,7 +301,7 @@ static const char *parse_cmd_verify(struct ref_transaction *transaction, die("verify %s: extra input: %s", refname, next); if (ref_transaction_update(transaction, refname, new_sha1, old_sha1, - update_flags, have_old, &err)) + update_flags, have_old, msg, &err)) die("%s", err.buf); update_flags = 0; @@ -354,7 +355,7 @@ static void update_refs_stdin(struct ref_transaction *transaction) int cmd_update_ref(int argc, const char **argv, const char *prefix) { - const char *refname, *oldval, *msg = NULL; + const char *refname, *oldval; unsigned char sha1[20], oldsha1[20]; int delete = 0, no_deref = 0, read_stdin = 0, end_null = 0, flags = 0; struct option options[] = { @@ -385,7 +386,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix) if (end_null) line_termination = '\0'; update_refs_stdin(transaction); - if (ref_transaction_commit(transaction, msg, &err)) + if (ref_transaction_commit(transaction, &err)) die("%s", err.buf); ref_transaction_free(transaction); strbuf_release(&err); |