mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
add-patch: respect diff.context configuration
Various builtins that use add-patch infrastructure do not respect the user's diff.context and diff.interHunkContext file configurations. The user may be used to seeing their diffs with customized context size, but not in the patches "git add -p" shows them to pick from. Teach add-patch infrastructure to read these configuration variables and pass their values when spawning the underlying plumbing commands as their command line option. Signed-off-by: Leon Michalak <leonmichalak6@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
97b99a9eb6
commit
2b0a2db2c0
@@ -414,7 +414,6 @@ static int normalize_marker(const char *p)
|
||||
static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
|
||||
{
|
||||
struct strvec args = STRVEC_INIT;
|
||||
const char *diff_algorithm = s->s.interactive_diff_algorithm;
|
||||
struct strbuf *plain = &s->plain, *colored = NULL;
|
||||
struct child_process cp = CHILD_PROCESS_INIT;
|
||||
char *p, *pend, *colored_p = NULL, *colored_pend = NULL, marker = '\0';
|
||||
@@ -424,8 +423,12 @@ static int parse_diff(struct add_p_state *s, const struct pathspec *ps)
|
||||
int res;
|
||||
|
||||
strvec_pushv(&args, s->mode->diff_cmd);
|
||||
if (diff_algorithm)
|
||||
strvec_pushf(&args, "--diff-algorithm=%s", diff_algorithm);
|
||||
if (s->s.context != -1)
|
||||
strvec_pushf(&args, "--unified=%i", s->s.context);
|
||||
if (s->s.interhunkcontext != -1)
|
||||
strvec_pushf(&args, "--inter-hunk-context=%i", s->s.interhunkcontext);
|
||||
if (s->s.interactive_diff_algorithm)
|
||||
strvec_pushf(&args, "--diff-algorithm=%s", s->s.interactive_diff_algorithm);
|
||||
if (s->revision) {
|
||||
struct object_id oid;
|
||||
strvec_push(&args,
|
||||
|
||||
Reference in New Issue
Block a user