| 2947 | } |
| 2948 | |
| 2949 | static 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 */ |
no test coverage detected