Re: [PATCH v2 00/94] libify apply and use lib in am

2016-05-14 Thread Junio C Hamano
r libification Dscho has been making in this thread, and that was why I didn't say much here. Having said all that, as to --quiet/--silent, another way to surface the "even more quiet" used is with "-q -q" (i.e. multiple levels of quietness). I am just saying this for the record

Re: [PATCH v2 48/94] builtin/apply: rename 'prefix_' parameter to 'prefix'

2016-05-14 Thread Junio C Hamano
>> In the early part of patches where it added only "const char *" >> borrowed from the caller and fields of intregral type, the lack of >> clear_apply_state() did not mattter, but with a few fields with >> "string_list" type, anybody who want to make repeated

Re: [PATCH v2 00/94] libify apply and use lib in am

2016-05-14 Thread Christian Couder
On Sat, May 14, 2016 at 8:26 AM, Johannes Schindelin wrote: [...] >> >> By the way there are no tests yet for this new feature, and I am not >> >> sure at all that "--silent" and "be_silent" are good names. >> > >> > If you want to follow existing code's example, we

Re: [PATCH v2 00/94] libify apply and use lib in am

2016-05-14 Thread Johannes Schindelin
Hi Chris, On Fri, 13 May 2016, Christian Couder wrote: > On Fri, May 13, 2016 at 8:32 AM, Johannes Schindelin > <johannes.schinde...@gmx.de> wrote: > > > > On Wed, 11 May 2016, Christian Couder wrote: > > > >> I consider that the apply functionality is prop

Re: [PATCH v2 48/94] builtin/apply: rename 'prefix_' parameter to 'prefix'

2016-05-13 Thread Christian Couder
elds of intregral type, the lack of > clear_apply_state() did not mattter, but with a few fields with > "string_list" type, anybody who want to make repeated call into the > apply machinery would want a way to release the resource the > structure holds. > > Because 49/94 is a

Re: [PATCH v2 48/94] builtin/apply: rename 'prefix_' parameter to 'prefix'

2016-05-13 Thread Christian Couder
On Thu, May 12, 2016 at 9:56 PM, Junio C Hamano wrote: > Christian Couder writes: > >> This is just a small cleanup. > > ... which may have been better happened at 09/94. Ok, I will squash it in 09/94. -- To unsubscribe from this list: send the

Re: [PATCH v2 00/94] libify apply and use lib in am

2016-05-13 Thread Christian Couder
Hi Dscho, On Fri, May 13, 2016 at 8:32 AM, Johannes Schindelin <johannes.schinde...@gmx.de> wrote: > Hi Chris, > > On Wed, 11 May 2016, Christian Couder wrote: > >> I consider that the apply functionality is properly libified before >> these patches, and that they

Re: [PATCH v2 00/94] libify apply and use lib in am

2016-05-13 Thread Johannes Schindelin
Hi Chris, On Wed, 11 May 2016, Christian Couder wrote: > I consider that the apply functionality is properly libified before > these patches, and that they should be in a separate series, but > unfortunately using the libified apply in "git am" unmasks the fact tha

Re: [PATCH v2 22/94] builtin/apply: move 'threeway' global into 'struct apply_state'

2016-05-12 Thread Junio C Hamano
hese control what gets looked at and modified */ int apply; /* this is not a dry-run */ int check_index; /* preimage must match the indexed version */ int cached; /* apply to the index only */ /* These control cosmetic aspect of the output */ int

Re: [PATCH v2 48/94] builtin/apply: rename 'prefix_' parameter to 'prefix'

2016-05-12 Thread Junio C Hamano
counterpart of init_apply_state(). In the early part of patches where it added only "const char *" borrowed from the caller and fields of intregral type, the lack of clear_apply_state() did not mattter, but with a few fields with "string_list" type, anybody who want to make repeat

Re: [PATCH v2 22/94] builtin/apply: move 'threeway' global into 'struct apply_state'

2016-05-12 Thread Christian Couder
On Thu, May 12, 2016 at 9:41 PM, Junio C Hamano <gits...@pobox.com> wrote: > Christian Couder <christian.cou...@gmail.com> writes: > >> To libify the apply functionality the 'threeway' variable should >> not be static and global to the file. Let's move

Re: [PATCH v2 10/94] builtin/apply: move 'unidiff_zero' global into 'struct apply_state'

2016-05-12 Thread Christian Couder
On Thu, May 12, 2016 at 9:28 PM, Junio C Hamano <gits...@pobox.com> wrote: > Christian Couder <christian.cou...@gmail.com> writes: > >> To libify the apply functionality the 'unidiff_zero' variable should >> not be static and global to the file. Let's move

Re: [PATCH v2 00/94] libify apply and use lib in am

2016-05-12 Thread Christian Couder
44 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -67,13 +67,15 @@ struct apply_state { /* --numstat does numeric diffstat, and doesn't actually apply */ int numstat; - const char *fake_ancestor; - int summary; - int threeway; - int no_add; + c

Re: [PATCH v2 48/94] builtin/apply: rename 'prefix_' parameter to 'prefix'

2016-05-12 Thread Junio C Hamano
Christian Couder writes: > This is just a small cleanup. ... which may have been better happened at 09/94. Up to this point, the conversion looks quite sensible, even though I think the organization of fields in apply_state do not look logical. -- To unsubscribe

Re: [PATCH v2 40/94] builtin/apply: move 'ws_error_action' into 'struct apply_state'

2016-05-12 Thread Junio C Hamano
Christian Couder writes: > struct apply_state { > const char *prefix; > int prefix_length; > @@ -71,6 +78,8 @@ struct apply_state { > int whitespace_error; > int squelch_whitespace_errors; > int applied_after_fixing_ws; > + > + enum

Re: [PATCH v2 33/94] builtin/apply: move 'p_value_known' global into 'struct apply_state'

2016-05-12 Thread Junio C Hamano
Christian Couder <christian.cou...@gmail.com> writes: > To libify the apply functionality the 'p_value_known' variable should > not be static and global to the file. Let's move it into > 'struct apply_state'. This and p_value belong together, I would think, so this can be squa

Re: [PATCH v2 22/94] builtin/apply: move 'threeway' global into 'struct apply_state'

2016-05-12 Thread Junio C Hamano
Christian Couder <christian.cou...@gmail.com> writes: > To libify the apply functionality the 'threeway' variable should > not be static and global to the file. Let's move it into > 'struct apply_state'. > > Reviewed-by: Stefan Beller <sbel...@google.com> > Signed-of

Re: [PATCH v2 18/94] builtin/apply: move 'cached' global into 'struct apply_state'

2016-05-12 Thread Junio C Hamano
Christian Couder <christian.cou...@gmail.com> writes: > To libify the apply functionality the 'cached' variable should > not be static and global to the file. Let's move it into > 'struct apply_state'. > > Reviewed-by: Stefan Beller <sbel...@google.com> > Signed-of

Re: [PATCH v2 10/94] builtin/apply: move 'unidiff_zero' global into 'struct apply_state'

2016-05-12 Thread Junio C Hamano
Christian Couder <christian.cou...@gmail.com> writes: > To libify the apply functionality the 'unidiff_zero' variable should > not be static and global to the file. Let's move it into > 'struct apply_state'. > > Reviewed-by: Stefan Beller <sbel...@google.com> > S

Re: [PATCH v2 16/94] builtin/apply: move 'update_index' global into 'struct apply_state'

2016-05-12 Thread Junio C Hamano
Christian Couder <christian.cou...@gmail.com> writes: > To libify the apply functionality the 'update_index' variable should > not be static and global to the file. Let's move it into > 'struct apply_state'. > > Reviewed-by: Stefan Beller <sbel...@google.com> > S

Re: [PATCH v2 09/94] builtin/apply: move 'state' init into init_apply_state()

2016-05-12 Thread Junio C Hamano
Christian Couder <christian.cou...@gmail.com> writes: > When the apply functionality will be libified, the 'struct apply_state' > will be used by different pieces of code. > > To properly initialize a 'struct apply_state', let's provide a nice > and easy to use init_a

Re: [PATCH v2 05/94] builtin/apply: extract line_by_line_fuzzy_match() from match_fragment()

2016-05-12 Thread Junio C Hamano
Christian Couder writes: > 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. > > Reviewed-by: Stefan Beller

Re: [PATCH v2 03/94] builtin/apply: avoid parameter shadowing 'linenr' global

2016-05-12 Thread Junio C Hamano
Christian Couder writes: > Let's just rename the global 'state_linenr' as it will become > 'state->linenr' in a following patch. > > This also avoid errors when compiling with -Wshadow and makes > it safer to later move global variables into a "state" struct. Looks

Re: [PATCH v2 02/94] builtin/apply: avoid parameter shadowing 'p_value' global

2016-05-12 Thread Junio C Hamano
Christian Couder writes: > Let's just rename the global 'state_p_value' as it will become > 'state->p_value' in a following patch. > > This also avoid errors when compiling with -Wshadow and makes > it safer to later move global variables into a "state" struct. Looks

Re: [PATCH v2 01/94] builtin/apply: make gitdiff_verify_name() return void

2016-05-12 Thread Junio C Hamano
me(line, NULL, p_value, TERM_TAB); > + return; > + } > > - if (orig_name) { > - int len = strlen(orig_name); > + if (*name) { > + int len = strlen(*name); > char *another; >

Re: [PATCH v2 00/94] libify apply and use lib in am

2016-05-12 Thread Junio C Hamano
Johannes Sixt writes: > I'll also use it in production for a while, although I am not a git-am > consumer nor do I use git-rebase without -i, hence, my tests will > probably only show that there is no bad fall-out. It will probably only show that you do not use the part that was

Re: [PATCH v2 00/94] libify apply and use lib in am

2016-05-12 Thread Christian Couder
On Thu, May 12, 2016 at 7:06 PM, Johannes Sixt <j...@kdbg.org> wrote: > Am 11.05.2016 um 15:16 schrieb Christian Couder: >> >> This is a patch series about libifying `git apply` functionality, and >> using this libified functionality in `git am`, so that no 'git apply'

Re: [PATCH v2 00/94] libify apply and use lib in am

2016-05-12 Thread Johannes Sixt
Am 11.05.2016 um 15:16 schrieb Christian Couder: 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

[PATCH v2 22/94] builtin/apply: move 'threeway' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'threeway' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 14 +

[PATCH v2 19/94] builtin/apply: move 'diffstat' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'diffstat' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 11 ++-

[PATCH v2 16/94] builtin/apply: move 'update_index' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'update_index' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 20/94] builtin/apply: move 'numstat' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'numstat' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 11 ++-

[PATCH v2 28/94] builtin/apply: move 'apply' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'apply' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 14/94] builtin/apply: move 'apply_with_reject' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'apply_with_reject' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 27/94] builtin/apply: move 'p_context' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'p_context' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 8

[PATCH v2 11/94] builtin/apply: move 'check' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'check' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 16 +---

[PATCH v2 21/94] builtin/apply: move 'summary' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
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 <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 9 +

[PATCH v2 51/94] builtin/apply: make apply_patch() return -1 instead of die()ing

2016-05-11 Thread Christian Couder
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

[PATCH v2 40/94] builtin/apply: move 'ws_error_action' into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'ws_error_action' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 62 +++---

[PATCH v2 52/94] builtin/apply: read_patch_file() return -1 instead of die()ing

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. Let's do that by using error() instead of die()ing in read_patch_file(). Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 8 +--- 1 file changed, 5 insertions

[PATCH v2 43/94] builtin/apply: move 'state_linenr' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'state_linenr' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 29/94] builtin/apply: move 'patch_input_file' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'patch_input_file' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 88/94] apply: don't print on stdout when be_silent is set

2016-05-11 Thread Christian Couder
Signed-off-by: Christian Couder --- apply.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apply.c b/apply.c index 5459ee1..e0fdd1d 100644 --- a/apply.c +++ b/apply.c @@ -4669,13 +4669,13 @@ static int apply_patch(struct apply_state *state,

[PATCH v2 68/94] builtin/apply: make build_fake_ancestor() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", build_fake_ancestor() should return -1 using error() instead of calling die(). Helped-by: Eri

[PATCH v2 86/94] apply: add 'be_silent' variable to 'struct apply_state'

2016-05-11 Thread Christian Couder
* of context lines. */ - if ((leading != frag->leading) || - (trailing != frag->trailing)) + if ((leading != frag->leading || +trailing != frag->trailing) && !

[PATCH v2 67/94] builtin/apply: change die_on_unsafe_path() to check_unsafe_path()

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", die_on_unsafe_path() should return -1 using error() instead of calling die(), so while doing

[PATCH v2 70/94] builtin/apply: make add_conflicted_stages_file() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", add_conflicted_stages_file() should return -1 using error() instead of calling die(). Helpe

[PATCH v2 91/94] apply: change error_routine when be_silent is set

2016-05-11 Thread Christian Couder
Signed-off-by: Christian Couder --- apply.c | 29 + apply.h | 3 +++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/apply.c b/apply.c index e0fdd1d..1dafc82 100644 --- a/apply.c +++ b/apply.c @@ -100,6 +100,11 @@ int

[PATCH v2 77/94] builtin/apply: rename option parsing functions

2016-05-11 Thread Christian Couder
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 <chrisc...@tuxfamily.org> --- builtin/apply.c | 40 1 file changed, 20 insertions(

[PATCH v2 94/94] builtin/apply: add a cli option for be_silent

2016-05-11 Thread Christian Couder
Let's make it possible to request a silent operation on the command line. Signed-off-by: Christian Couder --- builtin/apply.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builtin/apply.c b/builtin/apply.c index ce12769..397ef26 100644 --- a/builtin/apply.c +++

[PATCH v2 73/94] builtin/apply: make write_out_one_result() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of exit()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", write_out_one_result() should just return what remove_file() and create_file() are returni

[PATCH v2 53/94] builtin/apply: make find_header() return -1 instead of die()ing

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in builtin/apply.c, find_header() should return -1 using error() instead of calling die(). Unfortunately find_header() already

[PATCH v2 87/94] apply: make 'be_silent' incomatible with 'apply_verbosely'

2016-05-11 Thread Christian Couder
repository")); state->check_index = 1; } - if (state->apply_with_reject) - state->apply = state->apply_verbosely = 1; + if (state->apply_with_reject) { + state->apply = 1; + if (!state->be_silent) +

[PATCH v2 50/94] builtin/apply: move 'newfd' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'newfd' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff

[PATCH v2 84/94] builtin/am: use apply api in run_apply()

2016-05-11 Thread Christian Couder
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

[PATCH v2 55/94] builtin/apply: make parse_single_patch() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in builtin/apply.c, parse_single_patch() should return -1 instead of calling die(). Let's do that by using error() and let's

[PATCH v2 45/94] builtin/apply: move 'symlink_changes' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'symlink_changes' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 66/94] builtin/apply: make gitdiff_*() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", gitdiff_*() functions should return -1 using error() instead of calling die(). A previous

[PATCH v2 74/94] builtin/apply: make write_out_results() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of exit()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", write_out_results() should return -1 instead of calling exit(). Helped-by: Eric Sunsh

[PATCH v2 82/94] apply: roll back index lock file in case of error

2016-05-11 Thread Christian Couder
According to the lockfile API, when finished with a lockfile, one should either commit it or roll it back. This is even more important now that the same lockfile can be passed to init_apply_state() many times to be reused by series of calls to the apply lib functions. Helped-by: Johannes

[PATCH v2 71/94] builtin/apply: make add_index_file() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", add_index_file() should return -1 using error() instead of calling die(). Signed-off-by: Christ

[PATCH v2 75/94] builtin/apply: make try_create_file() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", try_create_file() should return -1 in case of error. Unfortunately try_create_file() currently

[PATCH v2 78/94] apply: rename and move opt constants to apply.h

2016-05-11 Thread Christian Couder
it a/builtin/apply.c b/builtin/apply.c index f05dc96..9ce177b 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4448,9 +4448,6 @@ static int write_out_results(struct apply_state *state, struct patch *list) return errs; } -#define INACCURATE_EOF (1<<0) -#define RECOUNT(

[PATCH v2 80/94] apply: make some parsing functions static again

2016-05-11 Thread Christian Couder
Some parsing functions that were used in both "apply.c" and "builtin/apply.c" are now only used in the former, so they can be made static to "apply.c". Signed-off-by: Christian Couder --- apply.c | 6 +++--- apply.h | 5 - 2 files changed, 3 insertions(+), 8

[PATCH v2 76/94] builtin/apply: make create_one_file() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of exit()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", create_one_file() should return -1 instead of calling exit(). Signed-off-by: Christian Coud

[PATCH v2 65/94] builtin/apply: make gitdiff_*() return 1 at end of header

2016-05-11 Thread Christian Couder
The gitdiff_*() functions that are called as p->fn() in parse_git_header() should return 1 instead of -1 in case of end of header or unrecognized input, as these are not real errors. It just instructs the parser to break out. This makes it possible for gitdiff_*() functions to return -1 in case

[PATCH v2 54/94] builtin/apply: make parse_chunk() return a negative integer on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing or exit()ing. To do that in a compatible manner with the rest of the error handling in builtin/apply.c, find_header() should return -1 instead of calling die() or exit(). As parse_chunk() is called

[PATCH v2 62/94] builtin/apply: move check_apply_state() to apply.c

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we must make check_apply_state() usable outside "builtin/apply.c". Let's do that by moving it into "apply.c". Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- apply.c | 29 + apply

[PATCH v2 42/94] builtin/apply: move 'max_change' and 'max_len' into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'max_change' and 'max_len' variables should not be static and global to the file. Let's move them into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 32/94] builtin/apply: move 'p_value' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'p_value' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/a

[PATCH v2 59/94] builtin/apply: move init_apply_state() to apply.c

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we must make init_apply_state() usable outside "builtin/apply.c". Let's do that by moving it into a new "apply.c". Helped-by: Eric Sunshine <sunsh...@sunshineco.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> ---

[PATCH v2 63/94] builtin/apply: make apply_all_patches() return -1 on error

2016-05-11 Thread Christian Couder
To finish libifying the apply functionality, apply_all_patches() should not die() or exit() in case of error, but return -1. While doing that we must take care that file descriptors are properly closed and, if needed, reset a sensible value. Helped-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.

[PATCH v2 72/94] builtin/apply: make create_file() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of exit()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", create_file() should just return what add_conflicted_stages_file() and add_index_file() are

[PATCH v2 57/94] builtin/apply: make parse_whitespace_option() return -1 instead of die()ing

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in builtin/apply.c, parse_whitespace_option() should return -1 using error() instead of calling die(). Signed-off-by: Christian

[PATCH v2 58/94] builtin/apply: make parse_ignorewhitespace_option() return -1 instead of die()ing

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", parse_ignorewhitespace_option() should return -1 using error() instead of calling die().

[PATCH v2 69/94] builtin/apply: make remove_file() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", remove_file() should return -1 using error() instead of calling die(). Signed-off-by: Christ

[PATCH v2 49/94] builtin/apply: move 'lock_file' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
refix_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_in_reverse; @@ -4504,8 +4510,6 @

[PATCH v2 64/94] builtin/apply: make parse_traditional_patch() return -1 on error

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", parse_traditional_patch() should return -1 using error() instead of calling die(). Signed-off-by:

[PATCH v2 61/94] builtin/apply: make check_apply_state() return -1 instead of die()ing

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of die()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", check_apply_state() should return -1 using error() instead of calling die(). Signed-off-by: Christ

[PATCH v2 56/94] apply: move 'struct apply_state' to apply.h

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we must make 'struct apply_state' usable outside "builtin/apply.c". Let's do that by creating a new "apply.h" and moving 'struct apply_state' there. Signed-off-by: Christian Couder <chrisc...@tuxfamily.org>

[PATCH v2 60/94] apply: make init_apply_state() return -1 instead of exit()ing

2016-05-11 Thread Christian Couder
To libify `git apply` functionality we have to signal errors to the caller instead of exit()ing. To do that in a compatible manner with the rest of the error handling in "builtin/apply.c", init_apply_state() should return -1 using error() instead of calling exit(). Signed-off-by:

[PATCH v2 31/94] builtin/apply: move 'has_include' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'has_include' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 6 ++

[PATCH v2 26/94] builtin/apply: move 'fake_ancestor' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'fake_ancestor' variable should not be static and global to the file. Let's move it into 'struct apply_state'. By the way remove a comment about '--index-info' that was renamed '--build-fake-ancestor' in commit 26b28007689d27a921ea90e5a29fc8eb74b0d297 (apply

[PATCH v2 48/94] builtin/apply: rename 'prefix_' parameter to 'prefix'

2016-05-11 Thread Christian Couder
This is just a small cleanup. 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 67c64a5..2aea8ba 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@

[PATCH v2 41/94] builtin/apply: move 'ws_ignore_action' into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'ws_ignore_action' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 25/94] builtin/apply: move 'line_termination' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'line_termination' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 17/94] builtin/apply: move 'allow_overlap' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'allow_overlap' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 11 ++

[PATCH v2 23/94] builtin/apply: move 'no_add' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'no_add' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 6 +++--- 1

[PATCH v2 18/94] builtin/apply: move 'cached' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'cached' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 30/94] builtin/apply: move 'limit_by_name' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'limit_by_name' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 24/94] builtin/apply: move 'unsafe_paths' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'unsafe_paths' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 8

[PATCH v2 33/94] builtin/apply: move 'p_value_known' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'p_value_known' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/apply.c | 9 -

[PATCH v2 44/94] builtin/apply: move 'fn_table' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'fn_table' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 47/94] builtin/apply: move applying patches into apply_all_patches()

2016-05-11 Thread Christian Couder
To libify the apply functionality we should provide a function to apply many patches. Let's move the code to do that into a new apply_all_patches() function. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/a

[PATCH v2 15/94] builtin/apply: move 'apply_verbosely' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'apply_verbosely' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 35/94] builtin/apply: move 'whitespace_error' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'whitespace_error' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 46/94] builtin/apply: move 'state' check into check_apply_state()

2016-05-11 Thread Christian Couder
To libify the apply functionality we should provide a function to check that the values in a 'struct apply_state' instance are coherent. Let's move the code to do that into a new check_apply_state() function. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder &

[PATCH v2 34/94] builtin/apply: move 'root' global into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'root' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 39/94] builtin/apply: move 'applied_after_fixing_ws' into 'struct apply_state'

2016-05-11 Thread Christian Couder
To libify the apply functionality the 'applied_after_fixing_ws' variable should not be static and global to the file. Let's move it into 'struct apply_state'. Reviewed-by: Stefan Beller <sbel...@google.com> Signed-off-by: Christian Couder <chrisc...@tuxfamily.org> --- builtin/

[PATCH v2 36/94] builtin/apply: move 'whitespace_option' into 'struct apply_state'

2016-05-11 Thread Christian Couder
gv, const char *prefix_) int read_stdin = 1; struct apply_state state; - const char *whitespace_option = NULL; - struct option builtin_apply_options[] = { { OPTION_CALLBACK, 0, "exclude", , N_("path"), N_(

<    3   4   5   6   7   8   9   10   11   12   >