summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 856665f)
raw | patch | inline | side by side (parent: 856665f)
author | Andy Parkins <andyparkins@gmail.com> | |
Fri, 28 Sep 2007 14:17:39 +0000 (15:17 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 30 Sep 2007 03:31:59 +0000 (20:31 -0700) |
In anticipation of supplying a per-field date format specifier, this
patch makes parse_atom() in builtin-for-each-ref.c allow atoms that have
a valid atom name (as determined by the valid_atom[] table) followed by
a colon, followed by an arbitrary string.
The arbitrary string is where the format for the atom will be specified.
Note, if different formats are specified for the same atom, multiple
entries will be made in the used_atoms table to allow them to be
distinguished by the grab_XXXX() functions.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
patch makes parse_atom() in builtin-for-each-ref.c allow atoms that have
a valid atom name (as determined by the valid_atom[] table) followed by
a colon, followed by an arbitrary string.
The arbitrary string is where the format for the atom will be specified.
Note, if different formats are specified for the same atom, multiple
entries will be made in the used_atoms table to allow them to be
distinguished by the grab_XXXX() functions.
Signed-off-by: Andy Parkins <andyparkins@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-for-each-ref.c | patch | blob | history |
diff --git a/builtin-for-each-ref.c b/builtin-for-each-ref.c
index 0afa1c5c41e79a05ddebb7d874956163510daf0b..74a7337da52ccab6eb25d51eeca4baba486a7a83 100644 (file)
--- a/builtin-for-each-ref.c
+++ b/builtin-for-each-ref.c
/* Is the atom a valid one? */
for (i = 0; i < ARRAY_SIZE(valid_atom); i++) {
int len = strlen(valid_atom[i].name);
- if (len == ep - sp && !memcmp(valid_atom[i].name, sp, len))
+ /*
+ * If the atom name has a colon, strip it and everything after
+ * it off - it specifies the format for this entry, and
+ * shouldn't be used for checking against the valid_atom
+ * table.
+ */
+ const char *formatp = strchr(sp, ':');
+ if (!formatp)
+ formatp = ep;
+ if (len == formatp - sp && !memcmp(valid_atom[i].name, sp, len))
break;
}