summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2016-05-24 08:10:58 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-06-01 17:10:16 (GMT)
commit79a3efda795a88403cea3e9ff321b4b668f393d9 (patch)
treee6dac7163c5f79ae8fba80cb0a56a46350570740
parent179070b91c0ae1baf889f083596398a4f72286ea (diff)
downloadgit-79a3efda795a88403cea3e9ff321b4b668f393d9.zip
git-79a3efda795a88403cea3e9ff321b4b668f393d9.tar.gz
git-79a3efda795a88403cea3e9ff321b4b668f393d9.tar.bz2
builtin/apply: move 'summary' global into 'struct apply_state'
To libify the apply functionality the 'summary' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/apply.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/apply.c b/builtin/apply.c
index 47a45a7..f174a42 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -34,6 +34,7 @@ struct apply_state {
/* These control cosmetic aspect of the output */
int diffstat; /* just show a diffstat, and don't actually apply */
int numstat; /* just show a numeric diffstat, and don't actually apply */
+ int summary; /* just report creation, deletion, etc, and don't actually apply */
/* These boolean parameters control how the apply is done */
int allow_overlap;
@@ -50,7 +51,6 @@ static int newfd = -1;
static int state_p_value = 1;
static int p_value_known;
-static int summary;
static int apply = 1;
static int no_add;
static int threeway;
@@ -4492,7 +4492,7 @@ static int apply_patch(struct apply_state *state,
if (state->numstat)
numstat_patch_list(list);
- if (summary)
+ if (state->summary)
summary_patch_list(list);
free_patch_list(list);
@@ -4608,7 +4608,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix)
OPT_NOOP_NOARG(0, "binary"),
OPT_BOOL(0, "numstat", &state.numstat,
N_("show number of added and deleted lines in decimal notation")),
- OPT_BOOL(0, "summary", &summary,
+ OPT_BOOL(0, "summary", &state.summary,
N_("instead of applying the patch, output a summary for the input")),
OPT_BOOL(0, "check", &state.check,
N_("instead of applying the patch, see if the patch is applicable")),
@@ -4675,7 +4675,7 @@ int cmd_apply(int argc, const char **argv, const char *prefix)
}
if (state.apply_with_reject)
apply = state.apply_verbosely = 1;
- if (!force_apply && (state.diffstat || state.numstat || summary || state.check || fake_ancestor))
+ if (!force_apply && (state.diffstat || state.numstat || state.summary || state.check || fake_ancestor))
apply = 0;
if (state.check_index && is_not_gitdir)
die(_("--index outside a repository"));