author | Junio C Hamano <gitster@pobox.com> | |
Thu, 5 Jan 2012 19:00:38 +0000 (11:00 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 5 Jan 2012 19:00:49 +0000 (11:00 -0800) |
They both use the extended headers in commit objects, and the former has
necessary infrastructure to show them that is useful to view the result of
the latter.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
necessary infrastructure to show them that is useful to view the result of
the latter.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 | 2 | |||
---|---|---|---|---|
builtin/commit.c | patch | | diff1 | | diff2 | | blob | history |
diff --combined builtin/commit.c
index 0c64c880d5fe7106e391e677f6a32dd46e73b36b,7e8a1cf4e074053a78f2f029e8c03f17c9053bf0..fa41ec8c878a6af63e17b79996148be85dcfccef
--- 1/builtin/commit.c
--- 2/builtin/commit.c
+++ b/builtin/commit.c
#include "unpack-trees.h"
#include "quote.h"
#include "submodule.h"
+ #include "gpg-interface.h"
static const char * const builtin_commit_usage[] = {
"git commit [options] [--] <filepattern>...",
static int quiet, verbose, no_verify, allow_empty, dry_run, renew_authorship;
static int no_post_rewrite, allow_empty_message;
static char *untracked_files_arg, *force_date, *ignore_submodule_arg;
+ static char *sign_commit;
+
/*
* The default commit message cleanup mode will remove the lines
* beginning with # (shell comments) and leading and trailing
OPT_BOOLEAN('e', "edit", &edit_flag, "force edit of commit"),
OPT_STRING(0, "cleanup", &cleanup_arg, "default", "how to strip spaces and #comments from message"),
OPT_BOOLEAN(0, "status", &include_status, "include status in commit message template"),
+ { OPTION_STRING, 'S', "gpg-sign", &sign_commit, "key id",
+ "GPG sign commit", PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
/* end commit message options */
OPT_GROUP("Commit contents options"),
static int git_commit_config(const char *k, const char *v, void *cb)
{
struct wt_status *s = cb;
+ int status;
if (!strcmp(k, "commit.template"))
return git_config_pathname(&template_file, k, v);
return 0;
}
+ status = git_gpg_config(k, v, NULL);
+ if (status)
+ return status;
return git_status_config(k, v, s);
}
exit(1);
}
- if (amend)
+ if (amend) {
extra = read_commit_extra_headers(current_head);
+ } else {
+ struct commit_extra_header **tail = &extra;
+ append_merge_tag_headers(parents, &tail);
+ }
if (commit_tree_extended(sb.buf, active_cache_tree->sha1, parents, sha1,
- author_ident.buf, extra)) {
+ author_ident.buf, sign_commit, extra)) {
rollback_index_files();
die(_("failed to write commit object"));
}