From: Karthik Nayak <karthik.188@gmail.com>
To: git@vger.kernel.org
Cc: matthieu.moy@grenoble-inp.fr, christian.couder@gmail.com,
Jeff King <peff@peff.net>, Karthik Nayak <karthik.188@gmail.com>
Subject: [PATCH 1/4] for-each-ref: rename refinfo members to match similar structures
Date: Wed, 20 May 2015 18:48:21 +0530 [thread overview]
Message-ID: <1432127904-21070-1-git-send-email-karthik.188@gmail.com> (raw)
In-Reply-To: <555C88C2.8060902@gmail.com>
From: Jeff King <peff@peff.net>
Written-by: Jeff King <peff@peff.net>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
---
builtin/for-each-ref.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 83f9cf9..2721228 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -32,9 +32,9 @@ struct ref_sort {
};
struct refinfo {
- char *refname;
- unsigned char objectname[20];
- int flag;
+ char *name;
+ unsigned char sha1[20];
+ int flags;
const char *symref;
struct atom_value *value;
};
@@ -632,9 +632,9 @@ static void populate_value(struct refinfo *ref)
ref->value = xcalloc(used_atom_cnt, sizeof(struct atom_value));
- if (need_symref && (ref->flag & REF_ISSYMREF) && !ref->symref) {
+ if (need_symref && (ref->flags & REF_ISSYMREF) && !ref->symref) {
unsigned char unused1[20];
- ref->symref = resolve_refdup(ref->refname, RESOLVE_REF_READING,
+ ref->symref = resolve_refdup(ref->name, RESOLVE_REF_READING,
unused1, NULL);
if (!ref->symref)
ref->symref = "";
@@ -655,14 +655,14 @@ static void populate_value(struct refinfo *ref)
}
if (starts_with(name, "refname"))
- refname = ref->refname;
+ refname = ref->name;
else if (starts_with(name, "symref"))
refname = ref->symref ? ref->symref : "";
else if (starts_with(name, "upstream")) {
/* only local branches may have an upstream */
- if (!starts_with(ref->refname, "refs/heads/"))
+ if (!starts_with(ref->name, "refs/heads/"))
continue;
- branch = branch_get(ref->refname + 11);
+ branch = branch_get(ref->name + 11);
if (!branch || !branch->merge || !branch->merge[0] ||
!branch->merge[0]->dst)
@@ -677,9 +677,9 @@ static void populate_value(struct refinfo *ref)
continue;
} else if (!strcmp(name, "flag")) {
char buf[256], *cp = buf;
- if (ref->flag & REF_ISSYMREF)
+ if (ref->flags & REF_ISSYMREF)
cp = copy_advance(cp, ",symref");
- if (ref->flag & REF_ISPACKED)
+ if (ref->flags & REF_ISPACKED)
cp = copy_advance(cp, ",packed");
if (cp == buf)
v->s = "";
@@ -688,7 +688,7 @@ static void populate_value(struct refinfo *ref)
v->s = xstrdup(buf + 1);
}
continue;
- } else if (!deref && grab_objectname(name, ref->objectname, v)) {
+ } else if (!deref && grab_objectname(name, ref->sha1, v)) {
continue;
} else if (!strcmp(name, "HEAD")) {
const char *head;
@@ -696,7 +696,7 @@ static void populate_value(struct refinfo *ref)
head = resolve_ref_unsafe("HEAD", RESOLVE_REF_READING,
sha1, NULL);
- if (!strcmp(ref->refname, head))
+ if (!strcmp(ref->name, head))
v->s = "*";
else
v->s = " ";
@@ -774,13 +774,13 @@ static void populate_value(struct refinfo *ref)
return;
need_obj:
- buf = get_obj(ref->objectname, &obj, &size, &eaten);
+ buf = get_obj(ref->sha1, &obj, &size, &eaten);
if (!buf)
die("missing object %s for %s",
- sha1_to_hex(ref->objectname), ref->refname);
+ sha1_to_hex(ref->sha1), ref->name);
if (!obj)
die("parse_object_buffer failed on %s for %s",
- sha1_to_hex(ref->objectname), ref->refname);
+ sha1_to_hex(ref->sha1), ref->name);
grab_values(ref->value, 0, obj, buf, size);
if (!eaten)
@@ -808,10 +808,10 @@ static void populate_value(struct refinfo *ref)
buf = get_obj(tagged, &obj, &size, &eaten);
if (!buf)
die("missing object %s for %s",
- sha1_to_hex(tagged), ref->refname);
+ sha1_to_hex(tagged), ref->name);
if (!obj)
die("parse_object_buffer failed on %s for %s",
- sha1_to_hex(tagged), ref->refname);
+ sha1_to_hex(tagged), ref->name);
grab_values(ref->value, 1, obj, buf, size);
if (!eaten)
free(buf);
@@ -877,9 +877,9 @@ static int grab_single_ref(const char *refname, const unsigned char *sha1, int f
* by maxcount logic.
*/
ref = xcalloc(1, sizeof(*ref));
- ref->refname = xstrdup(refname);
- hashcpy(ref->objectname, sha1);
- ref->flag = flag;
+ ref->name = xstrdup(refname);
+ hashcpy(ref->sha1, sha1);
+ ref->flags = flag;
cnt = cb->grab_cnt;
REALLOC_ARRAY(cb->grab_array, cnt + 1);
--
2.4.1
next prev parent reply other threads:[~2015-05-20 13:19 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-20 13:14 [WIP] [PATCH 0/4] Unifying git branch -l, git tag -l, and git for-each-ref karthik nayak
2015-05-20 13:18 ` Karthik Nayak [this message]
2015-05-20 16:57 ` [PATCH 1/4] for-each-ref: rename refinfo members to match similar structures Matthieu Moy
2015-05-21 6:27 ` karthik nayak
2015-05-20 13:18 ` [PATCH 2/4] ref-filter: add ref-filter API Karthik Nayak
2015-05-20 19:07 ` Eric Sunshine
2015-05-21 17:30 ` karthik nayak
2015-05-21 18:40 ` Eric Sunshine
2015-05-22 12:30 ` karthik nayak
2015-05-21 8:47 ` Matthieu Moy
2015-05-21 17:22 ` karthik nayak
2015-05-21 17:59 ` karthik nayak
2015-05-22 6:44 ` Matthieu Moy
2015-05-22 12:46 ` karthik nayak
2015-05-23 14:42 ` Matthieu Moy
2015-05-23 16:04 ` Christian Couder
2015-05-23 17:00 ` Matthieu Moy
2015-05-23 17:18 ` Junio C Hamano
2015-05-23 22:33 ` Matthieu Moy
2015-05-23 17:52 ` Karthik Nayak
2015-05-20 13:18 ` [PATCH 3/4] for-each-ref: convert to ref-filter Karthik Nayak
2015-05-20 23:50 ` Junio C Hamano
2015-05-21 6:51 ` karthik nayak
2015-05-20 13:18 ` [PATCH 4/4] ref-filter: move formatting/sorting options from 'for-each-ref' Karthik Nayak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432127904-21070-1-git-send-email-karthik.188@gmail.com \
--to=karthik.188@gmail.com \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=matthieu.moy@grenoble-inp.fr \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).