diff options
| author | Junio C Hamano <gitster@pobox.com> | 2015-08-03 11:01:17 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2015-08-03 11:01:17 -0700 |
| commit | be9cb560e31c76c00760dadb151b5e3059970586 (patch) | |
| tree | 434003cf022bccf7f1a1dfecfb77305214defe32 /builtin/branch.c | |
| parent | 5f02274e4c4506b923b510a24da7991656f4db14 (diff) | |
| parent | 1c03c4d34771db20b78231359caa6fda28e2d9fe (diff) | |
| download | git-be9cb560e31c76c00760dadb151b5e3059970586.tar.gz | |
Merge branch 'mh/init-delete-refs-api'
Clean up refs API and make "git clone" less intimate with the
implementation detail.
* mh/init-delete-refs-api:
delete_ref(): use the usual convention for old_sha1
cmd_update_ref(): make logic more straightforward
update_ref(): don't read old reference value before delete
check_branch_commit(): make first parameter const
refs.h: add some parameter names to function declarations
refs: move the remaining ref module declarations to refs.h
initial_ref_transaction_commit(): check for ref D/F conflicts
initial_ref_transaction_commit(): check for duplicate refs
refs: remove some functions from the module's public interface
initial_ref_transaction_commit(): function for initial ref creation
repack_without_refs(): make function private
prune_refs(): use delete_refs()
prune_remote(): use delete_refs()
delete_refs(): bail early if the packed-refs file cannot be rewritten
delete_refs(): make error message more generic
delete_refs(): new function for the refs API
delete_ref(): handle special case more explicitly
remove_branches(): remove temporary
delete_ref(): move declaration to refs.h
Diffstat (limited to 'builtin/branch.c')
| -rw-r--r-- | builtin/branch.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/builtin/branch.c b/builtin/branch.c index b42e5b6dbc..58aa84f1e8 100644 --- a/builtin/branch.c +++ b/builtin/branch.c @@ -160,7 +160,7 @@ static int branch_merged(int kind, const char *name, } static int check_branch_commit(const char *branchname, const char *refname, - unsigned char *sha1, struct commit *head_rev, + const unsigned char *sha1, struct commit *head_rev, int kinds, int force) { struct commit *rev = lookup_commit_reference(sha1); @@ -253,7 +253,8 @@ static int delete_branches(int argc, const char **argv, int force, int kinds, continue; } - if (delete_ref(name, sha1, REF_NODEREF)) { + if (delete_ref(name, is_null_sha1(sha1) ? NULL : sha1, + REF_NODEREF)) { error(remote_branch ? _("Error deleting remote-tracking branch '%s'") : _("Error deleting branch '%s'"), |
