add_branch_for_removal(): rewrite to take an object_id argument
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
May 25, 2015 at 18:38 UTC
45690a57a3aaba862a66096f3ebdf9a412643cf1
1 file changed
+3
-5
builtin/remote.c
+3
-5
@@ -509,7 +509,7 @@ struct branches_for_remote {
509
};
510
511
static int add_branch_for_removal(const char *refname,
512
- const unsigned char *sha1, int flags, void *cb_data)
512
+ const struct object_id *oid, int flags, void *cb_data)
513
{
514
struct branches_for_remote *branches = cb_data;
515
struct refspec refspec;
@@ -545,7 +545,7 @@ static int add_branch_for_removal(const char *refname,
545
546
item = string_list_append(branches->branches, refname);
547
item->util = xmalloc(20);
548
- hashcpy(item->util, sha1);
548
+ hashcpy(item->util, oid->hash);
549
550
return 0;
551
}
@@ -783,8 +783,6 @@ static int rm(int argc, const char **argv)
783
struct string_list skipped = STRING_LIST_INIT_DUP;
784
struct branches_for_remote cb_data;
785
int i, result;
786
- struct each_ref_fn_sha1_adapter wrapped_add_branch_for_removal =
787
- {add_branch_for_removal, &cb_data};
786
787
memset(&cb_data, 0, sizeof(cb_data));
788
cb_data.branches = &branches;
@@ -825,7 +823,7 @@ static int rm(int argc, const char **argv)
823
* refs, which are invalidated when deleting a branch.
824
*/
825
cb_data.remote = remote;
828
- result = for_each_ref(each_ref_fn_adapter, &wrapped_add_branch_for_removal);
826
+ result = for_each_ref(add_branch_for_removal, &cb_data);
827
strbuf_release(&buf);
828
829
if (!result)