From: Jakub Narebski <jnareb@gmail.com>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH 1/2] for-each-ref: "creator" and "creatordate" fields
Date: Thu, 2 Nov 2006 20:17:30 +0100 [thread overview]
Message-ID: <200611022017.31351.jnareb@gmail.com> (raw)
In-Reply-To: <7vslh86uz9.fsf@assigned-by-dhcp.cox.net>
From fa1a32c9a7c8a31b122df7d07f4a8885cbe120d0 Mon Sep 17 00:00:00 2001
From: Junio C Hamano <junkio@cox.net>
Date: Sat, 28 Oct 2006 13:33:46 -0700
Subject: [PATCH 1/2] for-each-ref: "creator" and "creatordate" fields
This adds "creator" (which is parallel to "tagger" or "committer")
and "creatordate" (corresponds to "taggerdate" and
"committerdate").
As other "date" fields, "creatordate" sorts numerically
and displays human readably. This allows for example for
sorting together heavyweigth and lightweight tags.
[jn: originally fields were named "epoch" and "epochdate".]
Signed-off-by: Junio C Hamano <junkio@cox.net>
Acked-by: Jakub Narebski <jnareb@gmail.com>
---
builtin-for-each-ref.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 93d3d7e..173bf38 100644
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
@@ -59,6 +59,8 @@ static struct {
{ "taggername" },
{ "taggeremail" },
{ "taggerdate", FIELD_TIME },
+ { "creator" },
+ { "creatordate", FIELD_TIME },
{ "subject" },
{ "body" },
{ "contents" },
@@ -401,6 +403,29 @@ static void grab_person(const char *who,
else if (!strcmp(name + wholen, "date"))
grab_date(wholine, v);
}
+
+ /* For a tag or a commit object, if "creator" or "creatordate" is
+ * requested, do something special.
+ */
+ if (strcmp(who, "tagger") && strcmp(who, "committer"))
+ return; /* "author" for commit object is not wanted */
+ if (!wholine)
+ wholine = find_wholine(who, wholen, buf, sz);
+ if (!wholine)
+ return;
+ for (i = 0; i < used_atom_cnt; i++) {
+ const char *name = used_atom[i];
+ struct atom_value *v = &val[i];
+ if (!!deref != (*name == '*'))
+ continue;
+ if (deref)
+ name++;
+
+ if (!strcmp(name, "creatordate"))
+ grab_date(wholine, v);
+ else if (!strcmp(name, "creator"))
+ v->s = copy_line(wholine);
+ }
}
static void find_subpos(const char *buf, unsigned long sz, const char **sub, const char **body)
--
1.4.3.3
next prev parent reply other threads:[~2006-11-02 19:23 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-28 17:30 [PATCH] Documentation: Update information about <format> in git-for-each-ref Jakub Narebski
2006-10-28 20:33 ` Junio C Hamano
2006-10-28 21:23 ` Jakub Narebski
2006-11-01 8:25 ` Andreas Ericsson
2006-11-01 8:47 ` Junio C Hamano
2006-11-01 10:23 ` Andreas Ericsson
2006-11-01 15:30 ` Junio C Hamano
2006-11-01 15:48 ` Johannes Schindelin
2006-11-02 19:17 ` Jakub Narebski [this message]
2006-11-02 19:23 ` [PATCH 2/2] gitweb: Use git-for-each-ref to generate list of heads and/or tags Jakub Narebski
2006-11-03 2:40 ` Junio C Hamano
2006-11-03 3:26 ` Jakub Narebski
2006-11-03 2:40 ` [PATCH 1/2] for-each-ref: "creator" and "creatordate" fields Junio C Hamano
2006-11-03 3:27 ` Jakub Narebski
2006-10-28 20:42 ` [PATCH] Documentation: Update information about <format> in git-for-each-ref Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200611022017.31351.jnareb@gmail.com \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=junkio@cox.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.
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 NNTP newsgroup(s).