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

Function parse_new_commit

builtin/fast-import.c:2949–3103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2947}
2948
2949static void parse_new_commit(const char *arg)
2950{
2951 static struct strbuf msg = STRBUF_INIT;
2952 struct signature_data sig_sha1 = { NULL, NULL, STRBUF_INIT };
2953 struct signature_data sig_sha256 = { NULL, NULL, STRBUF_INIT };
2954 struct branch *b;
2955 char *author = NULL;
2956 char *committer = NULL;
2957 char *encoding = NULL;
2958 struct hash_list *merge_list = NULL;
2959 unsigned int merge_count;
2960 unsigned char prev_fanout, new_fanout;
2961 const char *v;
2962
2963 b = lookup_branch(arg);
2964 if (!b)
2965 b = new_branch(arg);
2966
2967 read_next_command();
2968 parse_mark();
2969 parse_original_identifier();
2970 if (skip_prefix(command_buf.buf, "author ", &v)) {
2971 author = parse_ident(v);
2972 read_next_command();
2973 }
2974 if (skip_prefix(command_buf.buf, "committer ", &v)) {
2975 committer = parse_ident(v);
2976 read_next_command();
2977 }
2978 if (!committer)
2979 die(_("expected committer but didn't get one"));
2980
2981 while (skip_prefix(command_buf.buf, "gpgsig ", &v)) {
2982 switch (signed_commit_mode) {
2983
2984 /* First, modes that don't need the signature to be parsed */
2985 case SIGN_ABORT:
2986 die(_("encountered signed commit; use "
2987 "--signed-commits=<mode> to handle it"));
2988 case SIGN_WARN_STRIP:
2989 warning(_("stripping a commit signature"));
2990 /* fallthru */
2991 case SIGN_STRIP:
2992 discard_one_signature();
2993 break;
2994
2995 /* Second, modes that parse the signature */
2996 case SIGN_WARN_VERBATIM:
2997 warning(_("importing a commit signature verbatim"));
2998 /* fallthru */
2999 case SIGN_VERBATIM:
3000 case SIGN_STRIP_IF_INVALID:
3001 case SIGN_SIGN_IF_INVALID:
3002 case SIGN_ABORT_IF_INVALID:
3003 import_one_signature(&sig_sha1, &sig_sha256, v);
3004 break;
3005
3006 /* Third, BUG */

Callers 1

cmd_fast_importFunction · 0.85

Calls 15

lookup_branchFunction · 0.85
new_branchFunction · 0.85
read_next_commandFunction · 0.85
parse_markFunction · 0.85
warningFunction · 0.85
discard_one_signatureFunction · 0.85
import_one_signatureFunction · 0.85
xstrdupFunction · 0.85
parse_dataFunction · 0.85
parse_fromFunction · 0.85
parse_mergeFunction · 0.85

Tested by

no test coverage detected