Merge branch 'master' into js/fmt-patch
* master: (119 commits) diff family: add --check option Document that "git add" only adds non-ignored files. Add a conversion tool to migrate remote information into the config fetch, pull: ask config for remote information Fix build procedure for builtin-init-db read-tree -m -u: do not overwrite or remove untracked working tree files. apply --cached: do not check newly added file in the working tree Implement a --dry-run option to git-quiltimport Implement git-quiltimport Revert "builtin-grep: workaround for non GNU grep." builtin-grep: workaround for non GNU grep. builtin-grep: workaround for non GNU grep. git-am: use apply --cached apply --cached: apply a patch without using working tree. apply --numstat: show new name, not old name. Documentation/Makefile: create tarballs for the man pages and html files Allow pickaxe and diff-filter options to be used by git log. Libify the index refresh logic Builtin git-init-db Remove unnecessary local in get_ref_sha1. ...
This commit is contained in:
41
commit.c
41
commit.c
@ -22,25 +22,34 @@ struct sort_node
|
||||
|
||||
const char *commit_type = "commit";
|
||||
|
||||
struct cmt_fmt_map {
|
||||
const char *n;
|
||||
size_t cmp_len;
|
||||
enum cmit_fmt v;
|
||||
} cmt_fmts[] = {
|
||||
{ "raw", 1, CMIT_FMT_RAW },
|
||||
{ "medium", 1, CMIT_FMT_MEDIUM },
|
||||
{ "short", 1, CMIT_FMT_SHORT },
|
||||
{ "email", 1, CMIT_FMT_EMAIL },
|
||||
{ "full", 5, CMIT_FMT_FULL },
|
||||
{ "fuller", 5, CMIT_FMT_FULLER },
|
||||
{ "oneline", 1, CMIT_FMT_ONELINE },
|
||||
};
|
||||
|
||||
enum cmit_fmt get_commit_format(const char *arg)
|
||||
{
|
||||
if (!*arg)
|
||||
int i;
|
||||
|
||||
if (!arg || !*arg)
|
||||
return CMIT_FMT_DEFAULT;
|
||||
if (!strcmp(arg, "=raw"))
|
||||
return CMIT_FMT_RAW;
|
||||
if (!strcmp(arg, "=medium"))
|
||||
return CMIT_FMT_MEDIUM;
|
||||
if (!strcmp(arg, "=short"))
|
||||
return CMIT_FMT_SHORT;
|
||||
if (!strcmp(arg, "=full"))
|
||||
return CMIT_FMT_FULL;
|
||||
if (!strcmp(arg, "=fuller"))
|
||||
return CMIT_FMT_FULLER;
|
||||
if (!strcmp(arg, "=email"))
|
||||
return CMIT_FMT_EMAIL;
|
||||
if (!strcmp(arg, "=oneline"))
|
||||
return CMIT_FMT_ONELINE;
|
||||
die("invalid --pretty format");
|
||||
if (*arg == '=')
|
||||
arg++;
|
||||
for (i = 0; i < ARRAY_SIZE(cmt_fmts); i++) {
|
||||
if (!strncmp(arg, cmt_fmts[i].n, cmt_fmts[i].cmp_len))
|
||||
return cmt_fmts[i].v;
|
||||
}
|
||||
|
||||
die("invalid --pretty format: %s", arg);
|
||||
}
|
||||
|
||||
static struct commit *check_commit(struct object *obj,
|
||||
|
||||
Reference in New Issue
Block a user