From: Michael Witten <mfwitten@gmail.com>
To: git@vger.kernel.org
Subject: [RFC 1/5] Light refactoring of date infrastructure
Date: Wed, 20 Apr 2011 02:45:03 +0000 [thread overview]
Message-ID: <650ac72c-fa55-491e-a2e8-427b04d8bee3-mfwitten@gmail.com> (raw)
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
next prev parent reply other threads:[~2011-04-20 2:57 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-20 2:53 [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local Michael Witten
2011-04-20 2:45 ` Michael Witten [this message]
2011-04-20 2:45 ` [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL Michael Witten
2011-04-21 22:34 ` Junio C Hamano
2011-04-22 14:08 ` Dates in Commits and other issues of style (Re: [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL) Michael Witten
2011-04-25 1:26 ` Miles Bader
2011-04-25 3:57 ` Junio C Hamano
2011-04-25 10:45 ` Jakub Narebski
2011-04-25 18:29 ` Junio C Hamano
2011-04-22 14:36 ` [RFC 2/5] Pretty Print: show tz when using DATE_LOCAL Michael Witten
2011-04-22 15:06 ` Junio C Hamano
2011-04-20 2:45 ` [RFC 3/5] Date Mode: Implementation Michael Witten
2011-04-21 22:44 ` Junio C Hamano
2011-04-20 2:45 ` [RFC 4/5] Date Mode: Documentation Michael Witten
2011-04-20 2:45 ` [RFC 5/5] Date Mode: Tests Michael Witten
2011-04-21 22:44 ` Junio C Hamano
2011-04-23 3:42 ` Michael Witten
2011-04-23 5:06 ` Michael Witten
2011-04-23 3:45 ` Time zone option name (Re: [RFC 5/5] Date Mode: Tests) Michael Witten
2011-04-23 5:27 ` Junio C Hamano
2011-04-23 3:59 ` [RFC 5/5] Date Mode: Tests Michael Witten
2011-04-20 6:43 ` [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local Jeff King
2011-04-20 14:21 ` Michael Witten
2011-04-21 1:50 ` Junio C Hamano
2011-04-21 2:14 ` Michael Witten
2011-04-21 3:57 ` Junio C Hamano
2011-04-21 4:09 ` Michael Witten
2011-04-20 14:22 ` Michael Witten
2011-04-20 14:22 ` Michael Witten
2011-04-20 14:23 ` Michael Witten
2011-04-21 0:07 ` Tabs and spaces (Re: [RFC 0/5] Date Mode: Add --time-zone; deprecate --date=local) Jonathan Nieder
2011-04-21 1:51 ` Tabs and spaces Michael Witten
2011-04-21 2:18 ` Jonathan Nieder
2011-04-21 3:15 ` Michael Witten
2011-04-21 3:25 ` Thiago Farina
2011-04-21 10:46 ` Alex Riesen
2011-04-21 12:57 ` Michael Witten
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=650ac72c-fa55-491e-a2e8-427b04d8bee3-mfwitten@gmail.com \
--to=mfwitten@gmail.com \
--cc=git@vger.kernel.org \
/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).