On Sun, Apr 24, 2016 at 6:27 PM, Christian Couder
wrote:
> On Sun, Apr 24, 2016 at 5:23 PM, Ramsay Jones
> wrote:
>>
>>
>> On 24/04/16 14:33, Christian Couder wrote:
>>> This is a patch series about libifying `git apply` functionality, and
>>> using t
On Sun, Apr 24, 2016 at 5:23 PM, Ramsay Jones
wrote:
>
>
> On 24/04/16 14:33, Christian Couder wrote:
>> This is a patch series about libifying `git apply` functionality, and
>> using this libified functionality in `git am`, so that no 'git apply'
>> process
On 24/04/16 14:33, Christian Couder wrote:
> This is a patch series about libifying `git apply` functionality, and
> using this libified functionality in `git am`, so that no 'git apply'
> process is spawn anymore. This makes `git am` significantly faster, so
> `git rebase
apply_state {
const char *prefix;
int prefix_length;
+ int apply;
int allow_overlap;
int apply_in_reverse;
int apply_with_reject;
@@ -71,7 +72,7 @@ static int newfd = -1;
static int state_p_value = 1;
static int p_value_known;
-static int apply = 1
char *prefix;
int prefix_length;
+ int allow_overlap;
int apply_in_reverse;
int apply_with_reject;
int apply_verbosely;
@@ -58,7 +59,6 @@ static int diffstat;
static int numstat;
static int summary;
static int apply = 1;
-static int allow_overlap;
static int
modified, but doesn't apply the patch
@@ -48,13 +51,11 @@ struct apply_state {
* --stat does just a diffstat, and doesn't actually apply
* --numstat does numeric diffstat, and doesn't actually apply
* --index-info shows the old and new index info for paths if available
Signed-off-by: Christian Couder
---
builtin/apply.c | 20 ++--
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 7115dc2..78849e4 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -2194,17 +2194,17 @@ static void update_pre
se == 1) {
if (write_out_one_reject(state, l))
errs = 1;
@@ -4458,8 +4466,8 @@ static int apply_patch(struct apply_state *state,
if (whitespace_error && (ws_error_action == die_on_ws_error))
apply = 0;
- upda
The match_fragment() function is very big and contains a big special case
algorithm that does line by line fuzzy matching. So let's extract this
algorithm in a separate line_by_line_fuzzy_match() function.
Signed-off-by: Christian Couder
---
builtin/apply.c | 129
Signed-off-by: Christian Couder
---
apply.c | 6 +++---
apply.h | 5 -
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/apply.c b/apply.c
index 99b7a2d..86e0d20 100644
--- a/apply.c
+++ b/apply.c
@@ -27,7 +27,7 @@ static void git_apply_config(void)
git_config(git_default
state->whitespace_error),
state->whitespace_error);
+ }
if (state->applied_after_fixing_ws && state->apply)
warning("%d line%s applied after"
Signed-off-by: Christian Couder
---
builtin/apply.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index c8b9bf0..0717cd2 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -70,6 +70,7 @@ struct apply_state {
const char *patc
Currently commands that want to use the apply functionality have to launch
a "git apply" process which can be bad for performance.
Let's start libifying the apply functionality and to do that we first need
to get rid of the global variables in "builtin/apply.c".
This
unidiff_zero;
int update_index;
+
+ int unsafe_paths;
};
/*
@@ -67,7 +69,6 @@ static int newfd = -1;
static int state_p_value = 1;
static int p_value_known;
static int apply = 1;
-static int unsafe_paths;
static const char *fake_ancestor;
static int line_termination = '\n'
does just a diffstat, and doesn't actually apply */
int diffstat;
+ /* --numstat does numeric diffstat, and doesn't actually apply */
+ int numstat;
+
/*
* --check turns on checking that the working tree matches the
*files that are bein
@@ struct apply_state {
const char *prefix;
int prefix_length;
+ int apply_in_reverse;
+
/*
* --check turns on checking that the working tree matches the
*files that are being modified, but doesn't apply the patch
@@ -53,7 +55,6 @@ stati
This replaces run_apply() implementation with a new one that
uses the apply api that has been previously prepared in
apply.c and apply.h.
This shoud improve performance a lot in certain cases.
As the previous implementation was creating a new `git apply`
process to apply each patch, it could be
summary;
+ int threeway;
+
/*
* --check turns on checking that the working tree matches the
*files that are being modified, but doesn't apply the patch
@@ -64,7 +66,6 @@ static int state_p_value = 1;
static int p_value_known;
static int apply = 1;
s
{
const char *prefix;
int prefix_length;
+ /*
+* --check turns on checking that the working tree matches the
+*files that are being modified, but doesn't apply the patch
+*/
+ int check;
int unidiff_zero;
};
/*
- * --check turns on che
+struct apply_state {
+ const char *prefix;
+ int prefix_length;
+
+ /*
+* Since lockfile.c keeps a linked list of all created
+* lock_file structures, it isn't safe to free(lock_file).
+*/
+ struct lock_file *lock_file;
+
+ int apply;
+ int a
Signed-off-by: Christian Couder
---
builtin/apply.c | 36 +---
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 32c38f0..5bd5154 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4184,32 +4184,36 @@ static
ce_error),
- state->whitespace_error);
+ return error(Q_("%d line adds whitespace errors.",
+ "%d lines add whitespace errors.",
+ state->whit
ate->prefix = prefix;
state->prefix_length = state->prefix ? strlen(state->prefix) : 0;
state->apply = 1;
state->line_termination = '\n';
@@ -4789,7 +4789,7 @@ static int apply_all_patches(struct apply_state *state,
return !!errs;
}
-int
struct option builtin_apply_options[] = {
- { OPTION_CALLBACK, 0, "exclude", NULL, N_("path"),
+ { OPTION_CALLBACK, 0, "exclude", &state, N_("path"),
N_("don't apply changes matching the given path"),
Signed-off-by: Christian Couder
---
builtin/apply.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 699cabf..be237d1 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -96,7 +96,6 @@ static enum ws_ignore {
static const char *patch
Signed-off-by: Christian Couder
---
builtin/apply.c | 38 ++
1 file changed, 30 insertions(+), 8 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 49ef4c9..32c38f0 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4136,6 +4136,12 @@ static
Signed-off-by: Christian Couder
---
builtin/apply.c | 37 -
1 file changed, 20 insertions(+), 17 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 7d91454..fa07b33 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -28,6 +28,12 @@ enum ws_er
nenr);
+ die(_("unable to find filename in patch at line %d"),
state->linenr);
}
static int gitdiff_hdrend(struct apply_state *state,
@@ -986,17 +986,17 @@ static void gitdiff_verify_name(struct apply_state *state,
char *another;
;, &state, N_("path"),
N_("don't apply changes matching the given path"),
@@ -4703,7 +4702,7 @@ int cmd_apply(int argc, const char **argv, const char
*prefix_)
N_("paths are separated with NUL character"),
patch);
+ if (patchsize < 0)
+ return -1;
+
if (!patchsize) {
static const char git_binary[] = "GIT binary patch\n";
int hd = hdrsize + offset;
diff --git a/t/t4012-diff-binary.sh b/t/t4012-diff-binar
Signed-off-by: Christian Couder
---
builtin/apply.c | 11 ++-
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 268356b..8b7a8e0 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3699,7 +3699,7 @@ static int path_is_beyond_symlink(s
action == die_on_ws_error))
+ if (state->whitespace_error && (ws_error_action == die_on_ws_error))
state->apply = 0;
state->update_index = state->check_index && state->apply;
@@ -4797,11 +4798,11 @@ int cmd_apply(int argc, const ch
Signed-off-by: Christian Couder
---
builtin/apply.c | 49 +
1 file changed, 25 insertions(+), 24 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index fa07b33..bb58174 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -78,6 +78,14 @
d gitdiff_verify_name(const char *line, int
isnull, char **name, int s
if (isnull)
die(_("git apply: bad git-diff - expected /dev/null,
got %s on line %d"),
*name, linenr);
- another = find_name(line, NULL
write_out_one_reject(struct apply_state
*state, struct patch *patch)
return -1;
}
+/*
+ * Returns:
+ * -1 if an error happened
+ * 0 if the patch applied cleanly
+ * 1 if the patch did not apply cleanly
+ */
static int write_out_results(struct apply_state *state, struct patch *list
Signed-off-by: Christian Couder
---
builtin/apply.c | 23 ---
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 1c1ac7d..8d96f70 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -27,34 +27,34 @@ static const char * con
Signed-off-by: Christian Couder
---
builtin/apply.c | 25 +
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index e021fad..ebac9ee 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4253,7 +4253,7 @@ static int add_conf
L, state->p_value, TERM_TAB);
- return;
+ return 0;
}
if (*name) {
int len = strlen(*name);
char *another;
if (isnull)
- die(_("git apply: bad git-diff - expected /dev/null,
g
Signed-off-by: Christian Couder
---
builtin/apply.c | 10 +-
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 259f256..52602af 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -79,6 +79,7 @@ struct apply_state {
const char
len(state->prefix) : 0;
+ state->apply = 1;
+ state->line_termination = '\n';
+ state->p_value = 1;
+ state->p_context = UINT_MAX;
+ state->squelch_whitespace_errors = 5;
+ state->ws_error_action = warn_on_ws_error;
+
@@ -2185,8 +2185,9 @@ static int parse_chunk(struct apply_state *state, char
*buffer, unsigned long si
* empty to us here.
*/
if ((state->apply || state->check) &&
- (!patch->is_binary && !metadata_cha
Signed-off-by: Christian Couder
---
builtin/apply.c | 50 --
1 file changed, 28 insertions(+), 22 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index b4c2bd8..8508607 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -34,6 +34,20
Signed-off-by: Christian Couder
---
builtin/apply.c | 45 +++--
1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index f387340..b4c2bd8 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -93,6 +93,12 @@ st
Signed-off-by: Christian Couder
---
builtin/apply.c | 16 ++--
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 89118c1..5a5be49 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4210,7 +4210,7 @@ static void create_one_file(s
To libify `git apply` functionality we have to signal errors
to the caller instead of die()ing.
As a first step in this direction, let's make apply_patch() return
-1 in case of errors instead of dying. For now its only caller
apply_all_patches() will exit(1) when apply_patch() return -1.
As these functions are going to be part of the libified
apply api, let's give them a name that is more specific
to the apply api.
Signed-off-by: Christian Couder
---
builtin/apply.c | 40
1 file changed, 20 insertions(+), 20 deletions(-)
diff --
*output, const char *fmt,
struct patch *patch)
#define SLOP (16)
-static void read_patch_file(struct strbuf *sb, int fd)
+static int read_patch_file(struct strbuf *sb, int fd)
{
if (strbuf_read(sb, fd, 0) < 0)
- die_errno("git apply: failed to read");
+
y.c
index d26419a..84ff2da 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -141,8 +141,6 @@ struct apply_state {
enum ws_ignore ws_ignore_action;
};
-static int newfd = -1;
-
static const char * const apply_usage[] = {
N_("git apply [] [...]"),
NULL
@@ -4572
Signed-off-by: Christian Couder
---
builtin/apply.c | 48 +++-
1 file changed, 31 insertions(+), 17 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 5a5be49..e021fad 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4085,11 +4085,
Signed-off-by: Christian Couder
---
builtin/apply.c | 15 +--
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 73247c7..6b8ba2a 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -755,10 +755,10 @@ static int has_epoch_timestamp(
Signed-off-by: Christian Couder
---
builtin/apply.c | 17 +++--
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 69bb94c..89118c1 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4071,17 +4071,18 @@ static void patch_stats(st
e_chunk(struct apply_state *state, char
*buffer, unsigned long si
int hdrsize, patchsize;
int offset = find_header(state, buffer, size, &hdrsize, patch);
+ if (offset == -1)
+ exit(1);
+
if (offset < 0)
return offset;
diff --git
Signed-off-by: Christian Couder
---
builtin/apply.c | 14 +++---
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 8d96f70..2f89922 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -57,20 +57,20 @@ static int parse_whitespace_option
+ }
+ if (state->ws_error_action == die_on_ws_error)
+ die(Q_("%d line adds whitespace errors.",
+ "%d lines add whitespace errors.",
+ state->whitespace_error),
+
char *prefix;
int prefix_length;
+ /*
+* Since lockfile.c keeps a linked list of all created
+* lock_file structures, it isn't safe to free(lock_file).
+*/
+ struct lock_file *lock_file;
+
int apply;
int allow_overlap;
int apply
Signed-off-by: Christian Couder
---
builtin/apply.c | 38 --
1 file changed, 16 insertions(+), 22 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index ebac9ee..dae89e2 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4271,36 +4271,29 @@ stat
ply && (state->diffstat || state->numstat ||
state->summary || state->check || state->fake_ancestor))
state->apply = 0;
if (state->check_index && is_not_gitdir)
- die(_("--index outside a repository"));
+ return error(_(
change")) {
+ state->ws_ignore_action = ignore_ws_change;
+ return 0;
+ }
+ return error(_("unrecognized whitespace ignore option '%s'"), option);
+}
+
+void init_apply_state(struct apply_state *state, const char *prefix)
+{
+ memset(
(1<<1)
-
/*
* Try to apply a patch.
*
@@ -4473,8 +4470,8 @@ static int apply_patch(struct apply_state *state,
int nr;
patch = xcalloc(1, sizeof(*patch));
- patch->inaccurate_eof = !!(options & INACCURATE_EOF);
Signed-off-by: Christian Couder
---
builtin/apply.c | 28
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 8b7a8e0..69bb94c 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -3891,7 +3891,7 @@ static int preim
Signed-off-by: Christian Couder
---
apply.c | 7 ---
apply.h | 2 +-
builtin/apply.c | 3 ++-
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/apply.c b/apply.c
index 9c5f258..11bec48 100644
--- a/apply.c
+++ b/apply.c
@@ -56,7 +56,7 @@ int parse_ignorewhitespace
tate->threeway) {
+ if (is_not_gitdir)
+ return error(_("--3way outside a repository"));
+ state->check_index = 1;
+ }
+ if (state->apply_with_reject)
+ state->apply = state->apply_verbosely = 1;
+ if (!force_ap
used together.");
+ if (state->threeway) {
+ if (is_not_gitdir)
+ die(_("--3way outside a repository"));
+ state->check_index = 1;
+ }
+ if (state->apply_with_reject)
+ state->apply = state->apply_v
) {
- *name = find_name(line, NULL, state->p_value, TERM_TAB);
+ *name = find_name(state, line, NULL, state->p_value, TERM_TAB);
return;
}
@@ -967,7 +981,7 @@ static void gitdiff_verify_name(struct apply_state *state,
e(struct apply_state *state)
{
- if (!whitespace_option && !apply_default_whitespace)
+ if (!state->whitespace_option && !apply_default_whitespace)
ws_error_action = (state->apply ? warn_on_ws_error :
nowarn_ws_error);
}
@@ -4790,11 +4789,11 @@
line_termination;
int p_value;
+ int p_value_known;
unsigned int p_context;
const char *patch_input_file;
@@ -76,8 +77,6 @@ struct apply_state {
static int newfd = -1;
-static int p_value_known;
-
static const char * const apply_usage[] = {
N_("git
try_threeway(struct image *image, struct patch
*patch,
img = strbuf_detach(&buf, &len);
prepare_image(&tmp_image, img, len, 1);
/* Apply the patch to get the post image */
- if (apply_fragments(&tmp_image, patch) < 0) {
+ if (apply_fragments(state,
+30,10 @@ struct apply_state {
*files that are being modified, but doesn't apply the patch
*/
int check;
+
+ /* --index updates the cache as well. */
+ int check_index;
+
int unidiff_zero;
};
@@ -37,14 +41,12 @@ struct apply_state {
* -
unsafe_paths;
int line_termination;
+
+ unsigned int p_context;
};
static int newfd = -1;
@@ -70,7 +72,6 @@ static int newfd = -1;
static int state_p_value = 1;
static int p_value_known;
static int apply = 1;
-static unsigned int p_context = UINT_MAX;
static const char * const
By the way remove a comment about '--index-info' that was renamed
'--build-fake-ancestor' in commit 26b28007689d27a921ea90e5a29fc8eb74b0d297
(apply: get rid of --index-info in favor of --build-fake-ancestor,
Sep 17 2007).
Signed-off-by: Christian Couder
---
Signed-off-by: Christian Couder
---
builtin/apply.c | 28 ++--
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index be237d1..ab311c1 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -66,6 +66,8 @@ struct apply_state {
Signed-off-by: Christian Couder
---
builtin/apply.c | 22 +++---
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 401e111..259f256 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -78,6 +78,7 @@ struct apply_state {
update_index;
int unsafe_paths;
+
+ int line_termination;
};
/*
@@ -70,7 +72,6 @@ static int state_p_value = 1;
static int p_value_known;
static int apply = 1;
static const char *fake_ancestor;
-static int line_termination = '\n';
static unsigned int p_context
;
+ *name = find_name(line, NULL, state_p_value, TERM_TAB);
return;
}
@@ -938,7 +938,7 @@ static void gitdiff_verify_name(const char *line, int
isnull, char **name, int s
if (isnull)
die(_("git apply: bad git-diff -
_default_whitespace_mode(struct apply_state *state)
{
if (!state->whitespace_option && !apply_default_whitespace)
- ws_error_action = (state->apply ? warn_on_ws_error :
nowarn_ws_error);
+ state->ws_error_action = (state->apply ? warn_on_ws_error :
no
{
int apply_in_reverse;
int apply_with_reject;
+ int apply_verbosely;
/*
* --check turns on checking that the working tree matches the
@@ -56,7 +57,6 @@ static int diffstat;
static int numstat;
static int summary;
static int apply = 1;
-static int
Signed-off-by: Christian Couder
---
builtin/apply.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index 02239d9..8fd8dbc 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -79,7 +79,6 @@ static enum ws_ignore {
static const char *patch_i
;
+ int no_add;
+
/*
* --check turns on checking that the working tree matches the
*files that are being modified, but doesn't apply the patch
@@ -65,7 +67,6 @@ static int newfd = -1;
static int state_p_value = 1;
static int p_value_known;
static int
This is a patch series about libifying `git apply` functionality, and
using this libified functionality in `git am`, so that no 'git apply'
process is spawn anymore. This makes `git am` significantly faster, so
`git rebase`, when it uses the am backend, is also significantly
faster.
{
/* --cached updates only the cache without ever touching the working
tree. */
int cached;
+ /* --stat does just a diffstat, and doesn't actually apply */
+ int diffstat;
+
/*
* --check turns on checking that the working tree matches the
*files tha
does numeric diffstat, and doesn't actually apply */
int numstat;
+ int summary;
+
/*
* --check turns on checking that the working tree matches the
*files that are being modified, but doesn't apply the patch
@@ -60,7 +62,6 @@ static int
n = strlen(*name);
char *another;
if (isnull)
die(_("git apply: bad git-diff - expected /dev/null,
got %s on line %d"),
- orig_name, linenr);
+ *name, linenr);
another = find_name(lin
prefix_length;
int apply_in_reverse;
+ int apply_with_reject;
/*
* --check turns on checking that the working tree matches the
@@ -55,7 +56,6 @@ static int diffstat;
static int numstat;
static int summary;
static int apply = 1;
-static int apply_with_reject
Signed-off-by: Christian Couder
---
builtin/apply.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/apply.c b/builtin/apply.c
index e133b38..7115dc2 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -1516,7 +1516,7 @@ static int find_header(const char *line, un
Some multi-byte character encodings (such as Shift_JIS and GBK) have
characters whose final bytes is an ASCII '\' (0x5c), and they
will be displayed as funny-characters even if $fallback_encoding is
correct. This is because `highlight` command always expects UTF-8
encoded strings from STDIN.
by "your follow-up patch" you meant the other one that had
also been forgotten and that I also replied to, that is:
[PATCH] builtin/apply: free patch when parse_chunk() fails
I had first sent both of them at around the same time.
Thanks,
Christian.
--
To unsubscribe from this list: s
Christian Couder writes:
> When parse_chunk() fails it can return -1, for example
> when find_header() doesn't find a patch header.
>
> In this case it's better in apply_patch() to free the
> "struct patch" that we just allocated instead of
> leaking it.
>
> Signed-off-by: Christian Couder
> ---
Christian Couder writes:
> On Fri, Mar 18, 2016 at 1:30 PM, Christian Couder
> wrote:
>> In parse_binary() there is:
>>
>> forward = parse_binary_hunk(&buffer, &size, &status, &used);
>> if (!forward && !status)
>> /* there has to be one hunk (forward hunk) */
>>
On Fri, Apr 1, 2016 at 12:56 AM, Junio C Hamano wrote:
> Christian Couder writes:
>
>> On Wed, Mar 16, 2016 at 3:35 PM, Christian Couder
>> wrote:
>>> When parse_chunk() fails it can return -1, for example
>>> when find_header() doesn't find a patch header.
>>>
>>> In this case it's better in ap
Christian Couder writes:
> On Wed, Mar 16, 2016 at 3:35 PM, Christian Couder
> wrote:
>> When parse_chunk() fails it can return -1, for example
>> when find_header() doesn't find a patch header.
>>
>> In this case it's better in apply_patch() to free the
>> "struct patch" that we just allocated
On Wed, Mar 16, 2016 at 3:35 PM, Christian Couder
wrote:
> When parse_chunk() fails it can return -1, for example
> when find_header() doesn't find a patch header.
>
> In this case it's better in apply_patch() to free the
> "struct patch" that we just allocated instead of
> leaking it.
Maybe this
On Fri, Mar 18, 2016 at 1:30 PM, Christian Couder
wrote:
> In parse_binary() there is:
>
> forward = parse_binary_hunk(&buffer, &size, &status, &used);
> if (!forward && !status)
> /* there has to be one hunk (forward hunk) */
> return error(_("unrec
Duy Nguyen writes:
> But your suggestion is good and I can't think of any better. We could
> introduce pathspec as ftiler after "--", but it does not look elegant,
> and it overlaps with --include/--exclude.
I was imagining that we would allow the magic pathspec syntax used
in --include/--exclud
ne explicit "--include" given, we skip this "return 0".
>
> That way, we do not have to commit to turning --include/--exclude to
> pathspec (which I agree is a huge change in behaviour that may not
> be a good idea) and we do not have to add "--full-tree"
redates the pathspec machinery that was
>>>> made reusable in places like this). We should be able to
>>>>
>>>> $ cd d/e/e/p/d/i/r
>>>> $ git apply --include=:/ ../../../../../../../patch
>>>>
>>>> to lift this li
[I've quickly looked at the mailing list archive and didn't see this
issue reported. However I might be wrong.]
The issue is simple: `git apply` does not respect the `--work-tree`
argument when called outside the repository.
The version of Git I used is OpenSUSE's official
t; given, we skip this "return 0".
>
> That way, we do not have to commit to turning --include/--exclude to
> pathspec (which I agree is a huge change in behaviour that may not
> be a good idea) and we do not have to add "--full-tree" that is only
> understood by "
like this). We should be able to
>>>
>>> $ cd d/e/e/p/d/i/r
>>> $ git apply --include=:/ ../../../../../../../patch
>>>
>>> to lift this limitation. IOW, we can think of the use_patch() to
>>> include only the paths in the subdirect
Duy Nguyen writes:
>> The include/exclude mechanism does use wildmatch() but does not use
>> the pathspec mechanism (it predates the pathspec machinery that was
>> made reusable in places like this). We should be able to
>>
>> $ cd d/e/e/p/d/i/
Signed-off-by: Nguyễn Thái Ngọc Duy
---
builtin/apply.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/builtin/apply.c b/builtin/apply.c
index 01e1d5e..9cbb186 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -4384,6 +4384,8 @@ static int apply_patch(int fd, const char *filename, int
1001 - 1100 of 1632 matches
Mail list logo