mirror of
https://github.com/git/git.git
synced 2024-11-24 18:33:43 +08:00
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. Signed-off-by: Junio C Hamano <junkio@cox.net> Acked-by: Jakub Narebski <jnareb@gmail.com>
This commit is contained in:
parent
34eb33407d
commit
3175aa1ec2
@ -59,6 +59,8 @@ static struct {
|
|||||||
{ "taggername" },
|
{ "taggername" },
|
||||||
{ "taggeremail" },
|
{ "taggeremail" },
|
||||||
{ "taggerdate", FIELD_TIME },
|
{ "taggerdate", FIELD_TIME },
|
||||||
|
{ "creator" },
|
||||||
|
{ "creatordate", FIELD_TIME },
|
||||||
{ "subject" },
|
{ "subject" },
|
||||||
{ "body" },
|
{ "body" },
|
||||||
{ "contents" },
|
{ "contents" },
|
||||||
@ -401,6 +403,29 @@ static void grab_person(const char *who, struct atom_value *val, int deref, stru
|
|||||||
else if (!strcmp(name + wholen, "date"))
|
else if (!strcmp(name + wholen, "date"))
|
||||||
grab_date(wholine, v);
|
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)
|
static void find_subpos(const char *buf, unsigned long sz, const char **sub, const char **body)
|
||||||
|
Loading…
Reference in New Issue
Block a user