MCPcopy Create free account
hub / github.com/git/git / parse_date_format

Function parse_date_format

date.c:1022–1050  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1020}
1021
1022void parse_date_format(const char *format, struct date_mode *mode)
1023{
1024 const char *p;
1025
1026 /* "auto:foo" is "if tty/pager, then foo, otherwise normal" */
1027 if (skip_prefix(format, "auto:", &p)) {
1028 if (isatty(1) || pager_in_use())
1029 format = p;
1030 else
1031 format = "default";
1032 }
1033
1034 /* historical alias */
1035 if (!strcmp(format, "local"))
1036 format = "default-local";
1037
1038 mode->type = parse_date_type(format, &p);
1039 mode->local = 0;
1040
1041 if (skip_prefix(p, "-local", &p))
1042 mode->local = 1;
1043
1044 if (mode->type == DATE_STRFTIME) {
1045 if (!skip_prefix(p, ":", &p))
1046 die("date format missing colon separator: %s", format);
1047 mode->strftime_fmt = xstrdup(p);
1048 } else if (*p)
1049 die("unknown date format %s", format);
1050}
1051
1052void date_mode_release(struct date_mode *mode)
1053{

Callers 5

grab_dateFunction · 0.85
handle_revision_optFunction · 0.85
show_datesFunction · 0.85
cmd_log_init_defaultsFunction · 0.85
git_blame_configFunction · 0.85

Calls 4

pager_in_useFunction · 0.85
parse_date_typeFunction · 0.85
xstrdupFunction · 0.85
dieFunction · 0.70

Tested by 1

show_datesFunction · 0.68