Merge branch 'jk/color-variable-fixes'
Some places in the code confused a variable that is *not* a boolean to enable color but is an enum that records what the user requested to do about color. A couple of bugs of this sort have been fixed, while the code has been cleaned up to prevent similar bugs in the future. * jk/color-variable-fixes: config: store want_color() result in a separate bool add-interactive: retain colorbool values longer color: return bool from want_color() color: use git_colorbool enum type to store colorbools pretty: use format_commit_context.auto_color as colorbool diff: stop passing ecbdata->use_color as boolean diff: pass o->use_color directly to fill_metainfo() diff: don't use diff_options.use_color as a strict bool diff: simplify color_moved check when flushing grep: don't treat grep_opt.color as a strict bool color: return enum from git_config_colorbool() color: use GIT_COLOR_* instead of numeric constants
This commit is contained in:
5
diff.h
5
diff.h
@@ -7,6 +7,7 @@
|
||||
#include "hash.h"
|
||||
#include "pathspec.h"
|
||||
#include "strbuf.h"
|
||||
#include "color.h"
|
||||
|
||||
struct oidset;
|
||||
|
||||
@@ -283,7 +284,7 @@ struct diff_options {
|
||||
/* diff-filter bits */
|
||||
unsigned int filter, filter_not;
|
||||
|
||||
int use_color;
|
||||
enum git_colorbool use_color;
|
||||
|
||||
/* Number of context lines to generate in patch output. */
|
||||
int context;
|
||||
@@ -469,7 +470,7 @@ enum color_diff {
|
||||
DIFF_FILE_NEW_BOLD = 22,
|
||||
};
|
||||
|
||||
const char *diff_get_color(int diff_use_color, enum color_diff ix);
|
||||
const char *diff_get_color(enum git_colorbool diff_use_color, enum color_diff ix);
|
||||
#define diff_get_color_opt(o, ix) \
|
||||
diff_get_color((o)->use_color, ix)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user