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

Function cmd_commit

builtin/commit.c:1698–1994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1696}
1697
1698int cmd_commit(int argc,
1699 const char **argv,
1700 const char *prefix,
1701 struct repository *repo UNUSED)
1702{
1703 static struct wt_status s;
1704 static const char *cleanup_arg = NULL;
1705 static struct option builtin_commit_options[] = {
1706 OPT__QUIET(&quiet, N_("suppress summary after successful commit")),
1707 OPT__VERBOSE(&verbose, N_("show diff in commit message template")),
1708
1709 OPT_GROUP(N_("Commit message options")),
1710 OPT_FILENAME('F', "file", &logfile, N_("read message from file")),
1711 OPT_STRING(0, "author", &force_author, N_("author"), N_("override author for commit")),
1712 OPT_STRING(0, "date", &force_date, N_("date"), N_("override date for commit")),
1713 OPT_CALLBACK('m', "message", &message, N_("message"), N_("commit message"), opt_parse_m),
1714 OPT_STRING('c', "reedit-message", &edit_message, N_("commit"), N_("reuse and edit message from specified commit")),
1715 OPT_STRING('C', "reuse-message", &use_message, N_("commit"), N_("reuse message from specified commit")),
1716 /*
1717 * TRANSLATORS: Leave "[(amend|reword):]" as-is,
1718 * and only translate <commit>.
1719 */
1720 OPT_STRING(0, "fixup", &fixup_message, N_("[(amend|reword):]commit"), N_("use autosquash formatted message to fixup or amend/reword specified commit")),
1721 OPT_STRING(0, "squash", &squash_message, N_("commit"), N_("use autosquash formatted message to squash specified commit")),
1722 OPT_BOOL(0, "reset-author", &renew_authorship, N_("the commit is authored by me now (used with -C/-c/--amend)")),
1723 OPT_STRVEC(0, "trailer", &trailer_args, N_("trailer"),
1724 N_("add custom trailer(s)")),
1725 OPT_BOOL('s', "signoff", &signoff, N_("add a Signed-off-by trailer")),
1726 OPT_FILENAME('t', "template", &template_file, N_("use specified template file")),
1727 OPT_BOOL('e', "edit", &edit_flag, N_("force edit of commit")),
1728 OPT_CLEANUP(&cleanup_arg),
1729 OPT_BOOL(0, "status", &include_status, N_("include status in commit message template")),
1730 {
1731 .type = OPTION_STRING,
1732 .short_name = 'S',
1733 .long_name = "gpg-sign",
1734 .value = &sign_commit,
1735 .argh = N_("key-id"),
1736 .help = N_("GPG sign commit"),
1737 .flags = PARSE_OPT_OPTARG,
1738 .defval = (intptr_t) "",
1739 },
1740 /* end commit message options */
1741
1742 OPT_GROUP(N_("Commit contents options")),
1743 OPT_BOOL('a', "all", &all, N_("commit all changed files")),
1744 OPT_BOOL('i', "include", &also, N_("add specified files to index for commit")),
1745 OPT_BOOL(0, "interactive", &interactive, N_("interactively add files")),
1746 OPT_BOOL('p', "patch", &patch_interactive, N_("interactively add changes")),
1747 OPT_DIFF_UNIFIED(&interactive_opts.context),
1748 OPT_DIFF_INTERHUNK_CONTEXT(&interactive_opts.interhunkcontext),
1749 OPT_BOOL('o', "only", &only, N_("commit only specified files")),
1750 OPT_BOOL('n', "no-verify", &no_verify, N_("bypass pre-commit and commit-msg hooks")),
1751 OPT_BOOL(0, "dry-run", &dry_run, N_("show what would be committed")),
1752 OPT_SET_INT(0, "short", &status_format, N_("show status concisely"),
1753 STATUS_FORMAT_SHORT),
1754 OPT_BOOL(0, "branch", &s.show_branch, N_("show branch information")),
1755 OPT_BOOL(0, "ahead-behind", &s.ahead_behind_flags,

Callers 1

cmd_mergeFunction · 0.85

Calls 15

prepare_repo_settingsFunction · 0.85
status_init_configFunction · 0.85
repo_get_oidFunction · 0.85
lookup_commit_or_dieFunction · 0.85
repo_parse_commitFunction · 0.85
trailer_config_initFunction · 0.85
xstrdupFunction · 0.85
get_cleanup_modeFunction · 0.85
dry_run_commitFunction · 0.85
prepare_indexFunction · 0.85

Tested by

no test coverage detected