MCPcopy Index your code
hub / github.com/git/git / get_commit_format

Function get_commit_format

pretty.c:190–222  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190void get_commit_format(const char *arg, struct rev_info *rev)
191{
192 struct cmt_fmt_map *commit_format;
193
194 rev->use_terminator = 0;
195 if (!arg) {
196 rev->commit_format = CMIT_FMT_DEFAULT;
197 return;
198 }
199 if (skip_prefix(arg, "format:", &arg)) {
200 save_user_format(rev, arg, 0);
201 return;
202 }
203
204 if (!*arg || skip_prefix(arg, "tformat:", &arg) || strchr(arg, '%')) {
205 save_user_format(rev, arg, 1);
206 return;
207 }
208
209 commit_format = find_commit_format(arg);
210 if (!commit_format)
211 die("invalid --pretty format: %s", arg);
212
213 rev->commit_format = commit_format->format;
214 rev->use_terminator = commit_format->is_tformat;
215 rev->expand_tabs_in_log_default = commit_format->expand_tabs_in_log;
216 if (!rev->date_mode_explicit && commit_format->default_date_mode_type)
217 rev->date_mode.type = commit_format->default_date_mode_type;
218 if (commit_format->format == CMIT_FMT_USERFORMAT) {
219 save_user_format(rev, commit_format->user_format,
220 commit_format->is_tformat);
221 }
222}
223
224/*
225 * Generic support for pretty-printing the header

Callers 5

handle_revision_optFunction · 0.85
print_commit_summaryFunction · 0.85
sequencer_make_scriptFunction · 0.85
cmd_log_init_defaultsFunction · 0.85
cmd_format_revFunction · 0.85

Calls 3

save_user_formatFunction · 0.85
find_commit_formatFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected