git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] Use parse_date_format() in revisions.c to parse the --date parameter

From
APAndy Parkins <andyparkins@gmail.com>
Date
Sep 28, 2007, 14:17 UTC
Message-ID
<200709281517.32030.andyparkins@gmail.com>
In-Reply-To
<200709281516.05438.andyparkins@gmail.com>

The --date parameter was previously handled in revisions.c with a list of if(strcmp()) calls; now parse_date_format() is called instead.

Signed-off-by: Andy Parkins <andyparkins@gmail.com>
---
 revision.c |   17 +----------------
 1 files changed, 1 insertions(+), 16 deletions(-)
diff --git a/revision.c b/revision.c
index 33d092c..75cd0c6 100644
--- a/revision.c
+++ b/revision.c
@@ -1134,22 +1134,7 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
 				continue;
 			}
 			if (!strncmp(arg, "--date=", 7)) {
-				if (!strcmp(arg + 7, "relative"))
-					revs->date_mode = DATE_RELATIVE;
-				else if (!strcmp(arg + 7, "iso8601") ||
-					 !strcmp(arg + 7, "iso"))
-					revs->date_mode = DATE_ISO8601;
-				else if (!strcmp(arg + 7, "rfc2822") ||
-					 !strcmp(arg + 7, "rfc"))
-					revs->date_mode = DATE_RFC2822;
-				else if (!strcmp(arg + 7, "short"))
-					revs->date_mode = DATE_SHORT;
-				else if (!strcmp(arg + 7, "local"))
-					revs->date_mode = DATE_LOCAL;
-				else if (!strcmp(arg + 7, "default"))
-					revs->date_mode = DATE_NORMAL;
-				else
-					die("unknown date format %s", arg);
+				revs->date_mode = parse_date_format(arg + 7);
 				continue;
 			}
 			if (!strcmp(arg, "--log-size")) {
-- 
1.5.3.2.105.gf47f2-dirty
Previous: Andy ParkinsNext: Johannes Schindelin
Message 5 of 15 in “Add a --dateformat= option to git-for-each-ref”
  1. Add a --dateformat= option to git-for-each-refAndy Parkins, Sep 26, 2007
  2. Jeff KingSep 26, 2007
  3. Andy ParkinsSep 28, 2007
  4. 1/4 Add parse_date_format() convenience function for converting a format string to an enum date_modeAndy Parkins, Sep 28, 2007
  5. 2/4 Use parse_date_format() in revisions.c to parse the --date parameterAndy Parkins, Sep 28, 2007
  6. Johannes SchindelinSep 28, 2007
  7. Andy ParkinsSep 28, 2007
  8. Junio C HamanoSep 28, 2007
  9. 1/3 Use parse_date_format() convenience function for converting a format string to an enum date_mode in revisions.cAndy Parkins, Sep 29, 2007
  10. 2/3 Make for-each-ref allow atom names like "<name>:<something>"Andy Parkins, Sep 29, 2007
  11. 3/3 Make for-each-ref's grab_date() support per-atom formattingAndy Parkins, Sep 29, 2007
  12. 3/4 Make for-each-ref allow atom names like "<name>:<something>"Andy Parkins, Sep 28, 2007
  13. 4/4 Make for-each-ref's grab_date() support per-atom formattingAndy Parkins, Sep 28, 2007
  14. Junio C HamanoSep 29, 2007
  15. Jeff KingSep 28, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.