mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
gpg-interface: refactor 'enum sign_mode' parsing
The definition of 'enum sign_mode' as well as its parsing code are in
"builtin/fast-export.c". This was fine because `git fast-export` was the
only command with '--signed-tags=<mode>' or '--signed-commits=<mode>'
options.
In a following commit, we are going to add a similar option to `git
fast-import`, which will be simpler, easier and cleaner if we can reuse
the 'enum sign_mode' defintion and parsing code.
So let's move that definition and parsing code from
"builtin/fast-export.c" to "gpg-interface.{c,h}".
While at it, let's fix a small indentation issue with the arguments of
parse_opt_sign_mode().
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
4975ec3473
commit
2f8fd208c3
@@ -104,4 +104,19 @@ int check_signature(struct signature_check *sigc,
|
||||
void print_signature_buffer(const struct signature_check *sigc,
|
||||
unsigned flags);
|
||||
|
||||
/* Modes for --signed-tags=<mode> and --signed-commits=<mode> options. */
|
||||
enum sign_mode {
|
||||
SIGN_ABORT,
|
||||
SIGN_WARN_VERBATIM,
|
||||
SIGN_VERBATIM,
|
||||
SIGN_WARN_STRIP,
|
||||
SIGN_STRIP,
|
||||
};
|
||||
|
||||
/*
|
||||
* Return 0 if `arg` can be parsed into an `enum sign_mode`. Return -1
|
||||
* otherwise.
|
||||
*/
|
||||
int parse_sign_mode(const char *arg, enum sign_mode *mode);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user