Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
grab_single_ref(): rewrite to take an object_id argument
author
Michael Haggerty
<mhagger@alum.mit.edu>
Mon, 25 May 2015 18:38:36 +0000
(18:38 +0000)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 25 May 2015 19:19:29 +0000
(12:19 -0700)
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>
builtin/for-each-ref.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
0e0b7de
)
diff --git
a/builtin/for-each-ref.c
b/builtin/for-each-ref.c
index caccd93ec51abc2514e93140512e80129be00987..05ce28cebbe3f6e5c64bcd1087caef4449d366b1 100644
(file)
--- a/
builtin/for-each-ref.c
+++ b/
builtin/for-each-ref.c
@@
-840,7
+840,8
@@
struct grab_ref_cbdata {
* A call-back given to for_each_ref(). Filter refs and keep them for
* later object processing.
*/
* A call-back given to for_each_ref(). Filter refs and keep them for
* later object processing.
*/
-static int grab_single_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
+static int grab_single_ref(const char *refname, const struct object_id *oid,
+ int flag, void *cb_data)
{
struct grab_ref_cbdata *cb = cb_data;
struct refinfo *ref;
{
struct grab_ref_cbdata *cb = cb_data;
struct refinfo *ref;
@@
-878,7
+879,7
@@
static int grab_single_ref(const char *refname, const unsigned char *sha1, int f
*/
ref = xcalloc(1, sizeof(*ref));
ref->refname = xstrdup(refname);
*/
ref = xcalloc(1, sizeof(*ref));
ref->refname = xstrdup(refname);
- hashcpy(ref->objectname,
sha1
);
+ hashcpy(ref->objectname,
oid->hash
);
ref->flag = flag;
cnt = cb->grab_cnt;
ref->flag = flag;
cnt = cb->grab_cnt;
@@
-1072,8
+1073,6
@@
int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
int maxcount = 0, quote_style = 0;
struct refinfo **refs;
struct grab_ref_cbdata cbdata;
int maxcount = 0, quote_style = 0;
struct refinfo **refs;
struct grab_ref_cbdata cbdata;
- struct each_ref_fn_sha1_adapter wrapped_grab_single_ref =
- {grab_single_ref, &cbdata};
struct option opts[] = {
OPT_BIT('s', "shell", "e_style,
struct option opts[] = {
OPT_BIT('s', "shell", "e_style,
@@
-1113,7
+1112,7
@@
int cmd_for_each_ref(int argc, const char **argv, const char *prefix)
memset(&cbdata, 0, sizeof(cbdata));
cbdata.grab_pattern = argv;
memset(&cbdata, 0, sizeof(cbdata));
cbdata.grab_pattern = argv;
- for_each_rawref(
each_ref_fn_adapter, &wrapped_grab_single_ref
);
+ for_each_rawref(
grab_single_ref, &cbdata
);
refs = cbdata.grab_array;
num_refs = cbdata.grab_cnt;
refs = cbdata.grab_array;
num_refs = cbdata.grab_cnt;