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

[RFC 1/5] Light refactoring of date infrastructure

From
Michael Witten <mfwitten@gmail.com>
Date
Apr 20, 2011, 02:45 UTC
Message-ID
<650ac72c-fa55-491e-a2e8-427b04d8bee3-mfwitten@gmail.com>
In-Reply-To
<0f30e048-7dd2-4aff-8c1f-00bf0dfa3d34-mfwitten@gmail.com>
Date: Fri, 11 Feb 2011 18:34:29 +0000
date_mode_explicit -> date_mode_from_command_line
    It's more understandable by itself now.
DATE_NORMAL -> DATE_DEFAULT
    The user input to select this value is `default'.
Signed-off-by: Michael Witten <mfwitten@gmail.com>
---
 archive.c              |    2 +-
 builtin/blame.c        |    3 +--
 builtin/commit.c       |    2 +-
 builtin/for-each-ref.c |    2 +-
 builtin/shortlog.c     |    2 +-
 cache.h                |    2 +-
 date.c                 |    2 +-
 log-tree.c             |    6 +++---
 revision.c             |    4 ++--
 revision.h             |    2 +-
 submodule.c            |    2 +-
 11 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/archive.c b/archive.c
index 42f2d2f..dd871ca 100644
--- a/archive.c
+++ b/archive.c
@@ -32,7 +32,7 @@ static void format_subst(const struct commit *commit,
 	char *to_free = NULL;
 	struct strbuf fmt = STRBUF_INIT;
 	struct pretty_print_context ctx = {0};
-	ctx.date_mode = DATE_NORMAL;
+	ctx.date_mode = DATE_DEFAULT;
 	ctx.abbrev = DEFAULT_ABBREV;
 
 	if (src == buf->buf)
diff --git a/builtin/blame.c b/builtin/blame.c
index 4639788..dd597f4 100644
--- a/builtin/blame.c
+++ b/builtin/blame.c
@@ -2377,9 +2377,8 @@ parse_done:
 		blame_date_width = sizeof("2006-10-19");
 		break;
 	case DATE_RELATIVE:
-		/* "normal" is used as the fallback for "relative" */
 	case DATE_LOCAL:
-	case DATE_NORMAL:
+	case DATE_DEFAULT:
 		blame_date_width = sizeof("Thu Oct 19 16:00:04 2006 -0700");
 		break;
 	}
diff --git a/builtin/commit.c b/builtin/commit.c
index 67757e9..194db99 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -933,7 +933,7 @@ static const char *find_author_by_nickname(const char *name)
 	commit = get_revision(&revs);
 	if (commit) {
 		struct pretty_print_context ctx = {0};
-		ctx.date_mode = DATE_NORMAL;
+		ctx.date_mode = DATE_DEFAULT;
 		strbuf_release(&buf);
 		format_commit_message(commit, "%an <%ae>", &buf, &ctx);
 		return strbuf_detach(&buf, NULL);
diff --git a/builtin/for-each-ref.c b/builtin/for-each-ref.c
index 89e75c6..60d6b32 100644
--- a/builtin/for-each-ref.c
+++ b/builtin/for-each-ref.c
@@ -367,7 +367,7 @@ static void grab_date(const char *buf, struct atom_value *v, const char *atomnam
 	char *zone;
 	unsigned long timestamp;
 	long tz;
-	enum date_mode date_mode = DATE_NORMAL;
+	enum date_mode date_mode = DATE_DEFAULT;
 	const char *formatp;
 
 	/*
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index f5efc67..5815f55 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -165,7 +165,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
 		ctx.abbrev = log->abbrev;
 		ctx.subject = "";
 		ctx.after_subject = "";
-		ctx.date_mode = DATE_NORMAL;
+		ctx.date_mode = DATE_DEFAULT;
 		pretty_print_commit(CMIT_FMT_USERFORMAT, commit, &ufbuf, &ctx);
 		buffer = ufbuf.buf;
 	} else if (*buffer) {
diff --git a/cache.h b/cache.h
index 5b896d9..bf639f7 100644
--- a/cache.h
+++ b/cache.h
@@ -829,7 +829,7 @@ extern struct object *peel_to_type(const char *name, int namelen,
 				   struct object *o, enum object_type);
 
 enum date_mode {
-	DATE_NORMAL = 0,
+	DATE_DEFAULT = 0,
 	DATE_RELATIVE,
 	DATE_SHORT,
 	DATE_LOCAL,
diff --git a/date.c b/date.c
index 00f9eb5..096468f 100644
--- a/date.c
+++ b/date.c
@@ -669,7 +669,7 @@ enum date_mode parse_date_format(const char *format)
 	else if (!strcmp(format, "local"))
 		return DATE_LOCAL;
 	else if (!strcmp(format, "default"))
-		return DATE_NORMAL;
+		return DATE_DEFAULT;
 	else if (!strcmp(format, "raw"))
 		return DATE_RAW;
 	else
diff --git a/log-tree.c b/log-tree.c
index 2a1e3a9..b059446 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -272,7 +272,7 @@ void get_patch_filename(struct commit *commit, int nr, const char *suffix,
 	if (commit) {
 		int max_len = start_len + FORMAT_PATCH_NAME_MAX - suffix_len;
 		struct pretty_print_context ctx = {0};
-		ctx.date_mode = DATE_NORMAL;
+		ctx.date_mode = DATE_DEFAULT;
 
 		format_commit_message(commit, "%f", buf, &ctx);
 		if (max_len < buf->len)
@@ -465,9 +465,9 @@ void show_log(struct rev_info *opt)
 			 */
 			show_reflog_message(opt->reflog_info,
 				    opt->commit_format == CMIT_FMT_ONELINE,
-				    opt->date_mode_explicit ?
+				    opt->date_mode_from_command_line ?
 					opt->date_mode :
-					DATE_NORMAL);
+					DATE_DEFAULT);
 			if (opt->commit_format == CMIT_FMT_ONELINE)
 				return;
 		}
diff --git a/revision.c b/revision.c
index 541f09e..462c311 100644
--- a/revision.c
+++ b/revision.c
@@ -1434,10 +1434,10 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
 		revs->simplify_history = 0;
 	} else if (!strcmp(arg, "--relative-date")) {
 		revs->date_mode = DATE_RELATIVE;
-		revs->date_mode_explicit = 1;
+		revs->date_mode_from_command_line = 1;
 	} else if ((argcount = parse_long_opt("date", argv, &optarg))) {
 		revs->date_mode = parse_date_format(optarg);
-		revs->date_mode_explicit = 1;
+		revs->date_mode_from_command_line = 1;
 		return argcount;
 	} else if (!strcmp(arg, "--log-size")) {
 		revs->show_log_size = 1;
diff --git a/revision.h b/revision.h
index 9fd8f30..e5ca939 100644
--- a/revision.h
+++ b/revision.h
@@ -92,7 +92,7 @@ struct rev_info {
 			abbrev_commit:1,
 			use_terminator:1,
 			missing_newline:1,
-			date_mode_explicit:1;
+			date_mode_from_command_line:1;
 	unsigned int	disable_stdin:1;
 
 	enum date_mode date_mode;
diff --git a/submodule.c b/submodule.c
index 5294cef..0a45da9 100644
--- a/submodule.c
+++ b/submodule.c
@@ -605,7 +605,7 @@ static void print_commit(struct commit *commit)
 {
 	struct strbuf sb = STRBUF_INIT;
 	struct pretty_print_context ctx = {0};
-	ctx.date_mode = DATE_NORMAL;
+	ctx.date_mode = DATE_DEFAULT;
 	format_commit_message(commit, " %h: %m %s", &sb, &ctx);
 	fprintf(stderr, "%s\n", sb.buf);
 	strbuf_release(&sb);
-- 
1.7.4.18.g68fe8
Previous: Michael WittenNext: Michael Witten
Message 2 of 37 in “[RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local”
  1. Michael WittenApr 20, 2011
  2. 1/5 Light refactoring of date infrastructureMichael Witten, Apr 20, 2011
  3. 2/5 Pretty Print: show tz when using DATE_LOCALMichael Witten, Apr 20, 2011
  4. Junio C HamanoApr 21, 2011
  5. Dates in Commits and other issues of style (Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL)Michael Witten, Apr 22, 2011
  6. Miles BaderApr 25, 2011
  7. Junio C HamanoApr 25, 2011
  8. Jakub NarebskiApr 25, 2011
  9. Junio C HamanoApr 25, 2011
  10. Michael WittenApr 22, 2011
  11. Junio C HamanoApr 22, 2011
  12. 3/5 Date Mode: ImplementationMichael Witten, Apr 20, 2011
  13. Junio C HamanoApr 21, 2011
  14. 4/5 Date Mode: DocumentationMichael Witten, Apr 20, 2011
  15. 5/5 Date Mode: TestsMichael Witten, Apr 20, 2011
  16. Junio C HamanoApr 21, 2011
  17. Michael WittenApr 23, 2011
  18. Michael WittenApr 23, 2011
  19. Time zone option name (Re: [RFC 5/5] Date Mode: Tests)Michael Witten, Apr 23, 2011
  20. Junio C HamanoApr 23, 2011
  21. Michael WittenApr 23, 2011
  22. Jeff KingApr 20, 2011
  23. Michael WittenApr 20, 2011
  24. Junio C HamanoApr 21, 2011
  25. Michael WittenApr 21, 2011
  26. Junio C HamanoApr 21, 2011
  27. Michael WittenApr 21, 2011
  28. Michael WittenApr 20, 2011
  29. Michael WittenApr 20, 2011
  30. Michael WittenApr 20, 2011
  31. Tabs and spaces (Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local)Jonathan Nieder, Apr 21, 2011
  32. Michael WittenApr 21, 2011
  33. Jonathan NiederApr 21, 2011
  34. Michael WittenApr 21, 2011
  35. Thiago FarinaApr 21, 2011
  36. Alex RiesenApr 21, 2011
  37. Michael WittenApr 21, 2011

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.