[PATCH v14 23/41] builtin/apply: make create_file() return -1 on error

2016-09-04 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 v14 10/41] builtin/apply: move init_apply_state() to apply.c

2016-09-04 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 Signed-off-by: Christian Couder --- Makefile|

[PATCH v14 26/41] builtin/apply: make try_create_file() return -1 on error

2016-09-04 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 ret

[PATCH v14 32/41] apply: use error_errno() where possible

2016-09-04 Thread Christian Couder
To avoid possible mistakes and to uniformly show the errno related messages, let's use error_errno() where possible. Signed-off-by: Christian Couder --- apply.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/apply.c b/apply.c index a4dfc64..41a33d3 100644 --

[PATCH v14 08/41] builtin/apply: make parse_whitespace_option() return -1 instead of die()ing

2016-09-04 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 instead of calling die(). Signed-off-by: Christian Couder

[PATCH v14 38/41] apply: refactor `git apply` option parsing

2016-09-04 Thread Christian Couder
Parsing `git apply` options can be useful to other commands that want to call the libified apply functionality, because this way they can easily pass some options from their own command line to the libified apply functionality. This will be used by `git am` in a following patch. To make this

[PATCH v14 28/41] builtin/apply: rename option parsing functions

2016-09-04 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 --- builtin/apply.c | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --

[PATCH v14 31/41] apply: make some parsing functions static again

2016-09-04 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 deletions(-) diff --git a/apply.

[PATCH v14 24/41] builtin/apply: make write_out_one_result() return -1 on error

2016-09-04 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 returning

[PATCH v14 29/41] apply: rename and move opt constants to apply.h

2016-09-04 Thread Christian Couder
pply_state(struct apply_state *state, extern void clear_apply_state(struct apply_state *state); extern int check_apply_state(struct apply_state *state, int force_apply); +/* + * Some aspects of the apply behavior are controlled by the following + * bits in the "options" parameter passed to

[PATCH v14 06/41] builtin/apply: make parse_chunk() return a negative integer on error

2016-09-04 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, parse_chunk() should return a negative integer instead of calling die() or exit(). As parse_chunk

[PATCH v14 27/41] builtin/apply: make create_one_file() return -1 on error

2016-09-04 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 Couder --

[PATCH v14 05/41] builtin/apply: make find_header() return -128 instead of die()ing

2016-09-04 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, let's make find_header() return -128 instead of calling die(). We could make it return -1, unfortun

[PATCH v14 16/41] builtin/apply: make gitdiff_*() return 1 at end of header

2016-09-04 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 of

[PATCH v14 09/41] builtin/apply: make parse_ignorewhitespace_option() return -1 instead of die()ing

2016-09-04 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 instead of calling die(). Signed-off-by: Christ

[PATCH v14 12/41] builtin/apply: make check_apply_state() return -1 instead of die()ing

2016-09-04 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 instead of calling die(). Signed-off-by: Christian Couder --

[PATCH v14 11/41] apply: make init_apply_state() return -1 instead of exit()ing

2016-09-04 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 instead of calling exit(). Signed-off-by: Christ

[PATCH v14 17/41] builtin/apply: make gitdiff_*() return -1 on error

2016-09-04 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 instead of calling die(). A previous patch made it po

[PATCH v14 19/41] builtin/apply: make build_fake_ancestor() return -1 on error

2016-09-04 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 instead of calling die(). Helped-by: Eric Sunshine Sig

[PATCH v14 13/41] builtin/apply: move check_apply_state() to apply.c

2016-09-04 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 --- apply.c | 32 apply.h |

[PATCH v14 20/41] builtin/apply: make remove_file() return -1 on error

2016-09-04 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 instead of calling die(). Signed-off-by: Christian Couder --

[PATCH v14 14/41] builtin/apply: make apply_all_patches() return 128 or 1 on error

2016-09-04 Thread Christian Couder
To finish libifying the apply functionality, apply_all_patches() should not die() or exit() in case of error, but return either 128 or 1, so that it gives the same exit code as when die() or exit(1) is called. This way scripts relying on the exit code don't need to be changed. While doing th

[PATCH v14 15/41] builtin/apply: make parse_traditional_patch() return -1 on error

2016-09-04 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 instead of calling die(). Signed-off-by: Christ

[PATCH v14 04/41] builtin/apply: read_patch_file() return -1 instead of die()ing

2016-09-04 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 returning -1 instead of die()ing in read_patch_file(). Helped-by: Stefan Beller Signed-off-by: Christian Couder --- builtin/apply.c | 8 +--- 1 file changed, 5 insertions(

[PATCH v14 02/41] apply: move 'struct apply_state' to apply.h

2016-09-04 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:

[PATCH v14 03/41] builtin/apply: make apply_patch() return -1 or -128 instead of die()ing

2016-09-04 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 or -128 in case of errors instead of dying. For now its only caller apply_all_patches() will exit(128) when apply_patch() r

[PATCH v14 00/41] libify apply and use lib in am, part 2

2016-09-04 Thread Christian Couder
Goal 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 significan

[PATCH v14 01/41] apply: make some names more specific

2016-09-04 Thread Christian Couder
To prepare for some structs and constants being moved from builtin/apply.c to apply.h, we should give them some more specific names to avoid possible name collisions in the global namespace. Signed-off-by: Christian Couder --- builtin/apply.c | 20 ++-- 1 file changed, 10 inserti

Re: [PATCH v13 00/14] libify apply and use lib in am, part 3

2016-09-04 Thread Christian Couder
On Thu, Sep 1, 2016 at 7:48 PM, Junio C Hamano wrote: > Christian Couder writes: > >> Following Stefan's review, it looks like I will need to resend at >> least 02/14, 10/14 and 14/14. >> What do you prefer me to resend: >> 1) all the last 40 or so patches >> 2) the last 14 patches >> 3) only the

Re: [PATCH v13 10/14] apply: change error_routine when silent

2016-09-04 Thread Christian Couder
On Sun, Sep 4, 2016 at 6:31 PM, Ramsay Jones wrote: > > > On 04/09/16 11:54, Christian Couder wrote: >> On Thu, Sep 1, 2016 at 10:19 AM, Christian Couder >> wrote: >>> On Thu, Sep 1, 2016 at 12:20 AM, Stefan Beller wrote: > > +static void mute_routine(const char *bla, va_list params) >>>

Re: [PATCH v13 10/14] apply: change error_routine when silent

2016-09-04 Thread Ramsay Jones
On 04/09/16 11:54, Christian Couder wrote: > On Thu, Sep 1, 2016 at 10:19 AM, Christian Couder > wrote: >> On Thu, Sep 1, 2016 at 12:20 AM, Stefan Beller wrote: >>> On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder >>> wrote: To avoid printing anything when applying with `state->app

Re: [PATCH v13 10/14] apply: change error_routine when silent

2016-09-04 Thread Christian Couder
On Thu, Sep 1, 2016 at 10:19 AM, Christian Couder wrote: > On Thu, Sep 1, 2016 at 12:20 AM, Stefan Beller wrote: >> On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder >> wrote: >>> To avoid printing anything when applying with >>> `state->apply_verbosity == verbosity_silent`, let's save the >>>

Re: [PATCH v13 06/14] apply: make it possible to silently apply

2016-09-01 Thread Stefan Beller
On Thu, Sep 1, 2016 at 1:01 AM, Christian Couder wrote: > On Thu, Sep 1, 2016 at 12:07 AM, Stefan Beller wrote: >>> Printing on stdout, and calls to warning() or error() are not >>> taken care of in this patch, as that will be done in following >>> patches. >> >>> - if (state->apply

Re: [PATCH v13 00/14] libify apply and use lib in am, part 3

2016-09-01 Thread Junio C Hamano
Christian Couder writes: > Following Stefan's review, it looks like I will need to resend at > least 02/14, 10/14 and 14/14. > What do you prefer me to resend: > 1) all the last 40 or so patches > 2) the last 14 patches > 3) only the few patches that changed If this reroll is to be the candidate

Re: [PATCH v13 00/14] libify apply and use lib in am, part 3

2016-09-01 Thread Christian Couder
On Thu, Sep 1, 2016 at 12:15 AM, Junio C Hamano wrote: > Christian Couder writes: > >> On Mon, Aug 29, 2016 at 9:04 PM, Junio C Hamano wrote: >>> Christian Couder writes: >>> Highlevel view of the patches in the series ~~~ This is "par

Re: [PATCH v13 10/14] apply: change error_routine when silent

2016-09-01 Thread Christian Couder
On Thu, Sep 1, 2016 at 12:20 AM, Stefan Beller wrote: > On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder > wrote: >> To avoid printing anything when applying with >> `state->apply_verbosity == verbosity_silent`, let's save the >> existing warn and error routines before applying, and let's >> re

Re: [PATCH v13 02/14] apply: rename and move opt constants to apply.h

2016-09-01 Thread Christian Couder
On Wed, Aug 31, 2016 at 11:46 PM, Stefan Beller wrote: > On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder > wrote: >> extern int check_apply_state(struct apply_state *state, int force_apply); >> > > With greater scope comes greater responsibility. Nit of the day: > In case a reroll is necessar

Re: [PATCH v13 06/14] apply: make it possible to silently apply

2016-09-01 Thread Christian Couder
On Thu, Sep 1, 2016 at 12:07 AM, Stefan Beller wrote: >> Printing on stdout, and calls to warning() or error() are not >> taken care of in this patch, as that will be done in following >> patches. > >> - if (state->apply_verbosely) >> + if (state->apply_verbosity > verb

Re: [PATCH v13 03/14] Move libified code from builtin/apply.c to apply.{c,h}

2016-09-01 Thread Christian Couder
On Wed, Aug 31, 2016 at 11:57 PM, Stefan Beller wrote: > On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder > wrote: >> As most of the apply code in builtin/apply.c has been libified by a number of >> previous commits, it can now be moved to apply.{c,h}, so that more

Re: [PATCH v13 14/14] builtin/am: use apply API in run_apply()

2016-09-01 Thread Christian Couder
On Thu, Sep 1, 2016 at 12:33 AM, Stefan Beller wrote: > On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder > wrote: >> + >> + if (opts_left != 0) >> + die("unknown option passed thru to git apply"); > > Through and thru are different s

Re: [PATCH v13 14/14] builtin/am: use apply API in run_apply()

2016-08-31 Thread Stefan Beller
On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder wrote: > + > + if (opts_left != 0) > + die("unknown option passed thru to git apply"); Through and thru are different spellings of the same word. Thru is the less preferred form, however, and it might b

Re: [PATCH v13 10/14] apply: change error_routine when silent

2016-08-31 Thread Stefan Beller
On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder wrote: > To avoid printing anything when applying with > `state->apply_verbosity == verbosity_silent`, let's save the > existing warn and error routines before applying, and let's > replace them with a routine that does nothing. > > Then after app

Re: [PATCH v13 00/14] libify apply and use lib in am, part 3

2016-08-31 Thread Junio C Hamano
Christian Couder writes: > On Mon, Aug 29, 2016 at 9:04 PM, Junio C Hamano wrote: >> Christian Couder writes: >> >>> Highlevel view of the patches in the series >>> ~~~ >>> >>> This is "part 3" of the full patch series. I am resending only the >>> last 14

Re: [PATCH v13 06/14] apply: make it possible to silently apply

2016-08-31 Thread Stefan Beller
> Printing on stdout, and calls to warning() or error() are not > taken care of in this patch, as that will be done in following > patches. > - if (state->apply_verbosely) > + if (state->apply_verbosity > verbosity_normal) > error(_("while search

Re: [PATCH v13 05/14] apply: use error_errno() where possible

2016-08-31 Thread Stefan Beller
On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder wrote: > To avoid possible mistakes and to uniformly show the errno > related messages, let's use error_errno() where possible. > > Signed-off-by: Christian Couder > --- Looks good, Thanks for these cleanups! Stefan

Re: [PATCH v13 04/14] apply: make some parsing functions static again

2016-08-31 Thread Stefan Beller
On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder wrote: > 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 --

Re: [PATCH v13 03/14] Move libified code from builtin/apply.c to apply.{c,h}

2016-08-31 Thread Stefan Beller
On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder wrote: > As most of the apply code in builtin/apply.c has been libified by a number of > previous commits, it can now be moved to apply.{c,h}, so that more code can > use it. > > Helped-by: Nguyễn Thái Ngọc Duy > Helpe

Re: [PATCH v13 02/14] apply: rename and move opt constants to apply.h

2016-08-31 Thread Stefan Beller
On Sat, Aug 27, 2016 at 11:45 AM, Christian Couder wrote: > extern int check_apply_state(struct apply_state *state, int force_apply); > With greater scope comes greater responsibility. Nit of the day: In case a reroll is necessary, consider putting a comment here. (What are these constants? what

Apply Today

2016-08-30 Thread Loan Firm
Dear Sir/Madam, We give out urgent loan for business and personal purpose with 3% intrest rate applicable to all amount. Kindly get back to us via email: loa...@foxmail.com for further details on how to apply.

Re: [PATCH v13 00/14] libify apply and use lib in am, part 3

2016-08-30 Thread Christian Couder
On Mon, Aug 29, 2016 at 9:04 PM, Junio C Hamano wrote: > Christian Couder writes: > >> Highlevel view of the patches in the series >> ~~~ >> >> This is "part 3" of the full patch series. I am resending only the >> last 14 patches of the full series as "part

Re: [PATCH v13 00/14] libify apply and use lib in am, part 3

2016-08-29 Thread Junio C Hamano
Junio C Hamano writes: > Christian Couder writes: > >> Highlevel view of the patches in the series >> ~~~ >> >> This is "part 3" of the full patch series. I am resending only the >> last 14 patches of the full series as "part 3", because I don't want >> to

Re: [PATCH v13 00/14] libify apply and use lib in am, part 3

2016-08-29 Thread Junio C Hamano
Christian Couder writes: > Highlevel view of the patches in the series > ~~~ > > This is "part 3" of the full patch series. I am resending only the > last 14 patches of the full series as "part 3", because I don't want > to resend the first 27 patches of v1

[PATCH 02/20] builtin/apply: convert static functions to struct object_id

2016-08-28 Thread brian m. carlson
1_prefix) != GIT_SHA1_HEXSZ || + get_oid_hex(patch->old_sha1_prefix, &oid) || + get_oid_hex(patch->new_sha1_prefix, &oid)) return error("cannot apply binary patch to '%s' " "without full index line", name

Re: [PATCH v13 00/14] libify apply and use lib in am, part 3

2016-08-27 Thread Christian Couder
On Sat, Aug 27, 2016 at 8:45 PM, Christian Couder wrote: > > I will send a diff between this version and v12 as a reply to this > email. Here is the diff: diff --git a/apply.c b/apply.c index 7e561a4..5cd037d 100644 --- a/apply.c +++ b/apply.c @@ -3993,12 +3993,21 @@ static int check_patch_list(

[PATCH v13 11/14] apply: refactor `git apply` option parsing

2016-08-27 Thread Christian Couder
Parsing `git apply` options can be useful to other commands that want to call the libified apply functionality, because this way they can easily pass some options from their own command line to the libified apply functionality. This will be used by `git am` in a following patch. To make this

[PATCH v13 00/14] libify apply and use lib in am, part 3

2016-08-27 Thread Christian Couder
Goal 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 significan

[PATCH v13 14/14] builtin/am: use apply API in run_apply()

2016-08-27 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 be

[PATCH v13 13/14] apply: learn to use a different index file

2016-08-27 Thread Christian Couder
Sometimes we want to apply in a different index file. Before the apply functionality was libified it was possible to use the GIT_INDEX_FILE environment variable, for this purpose. But now, as the apply functionality has been libified, it should be possible to do that in a libified way. Signed

[PATCH v13 12/14] apply: pass apply state to build_fake_ancestor()

2016-08-27 Thread Christian Couder
To libify git apply functionality, we will need to read from a different index file in get_current_sha1(). This index file will be stored in "struct apply_state", so let's pass the state to build_fake_ancestor() which will later pass it to get_current_sha1(). Signed-off-by: C

[PATCH v13 01/14] builtin/apply: rename option parsing functions

2016-08-27 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 --- builtin/apply.c | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --

[PATCH v13 05/14] apply: use error_errno() where possible

2016-08-27 Thread Christian Couder
To avoid possible mistakes and to uniformly show the errno related messages, let's use error_errno() where possible. Signed-off-by: Christian Couder --- apply.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apply.c b/apply.c index c0cb3f5..41a33d3 100644

[PATCH v13 06/14] apply: make it possible to silently apply

2016-08-27 Thread Christian Couder
into 'verbosity_verbose'. The new added state is 'verbosity_silent'. It should prevent anything to be printed on both stderr and stdout. This is needed because `git am` wants to first call apply functionality silently, if it can then fall back on 3-way merge in case of error. Printing

[PATCH v13 10/14] apply: change error_routine when silent

2016-08-27 Thread Christian Couder
To avoid printing anything when applying with `state->apply_verbosity == verbosity_silent`, let's save the existing warn and error routines before applying, and let's replace them with a routine that does nothing. Then after applying, let's restore the saved routines. Helped-by: Stefan Beller Si

[PATCH v13 07/14] apply: don't print on stdout in verbosity_silent mode

2016-08-27 Thread Christian Couder
When apply_verbosity is set to verbosity_silent nothing should be printed on both stderr and stdout. To avoid printing on stdout, we can just skip calling the following functions: - stat_patch_list(), - numstat_patch_list(), - summary_patch_list(). It is safe to do that b

[PATCH v13 04/14] apply: make some parsing functions static again

2016-08-27 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 deletions(-) diff --git a/apply.

[PATCH v13 02/14] apply: rename and move opt constants to apply.h

2016-08-27 Thread Christian Couder
ly.c index 429fe44..9c396bb 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4463,9 +4463,6 @@ static int write_out_results(struct apply_state *state, struct patch *list) static struct lock_file lock_file; -#define INACCURATE_EOF (1<<0) -#define RECOUNT(1<<1) - /*

Re: [PATCH v12 12/13] apply: learn to use a different index file

2016-08-26 Thread Christian Couder
On Thu, Aug 11, 2016 at 10:17 PM, Junio C Hamano wrote: > Christian Couder writes: > >> Sometimes we want to apply in a different index file. >> >> Before the apply functionality was libified it was possible to >> use the GIT_INDEX_FILE environment variable, for t

Re: [PATCH v12 12/13] apply: learn to use a different index file

2016-08-11 Thread Junio C Hamano
Christian Couder writes: > Sometimes we want to apply in a different index file. > > Before the apply functionality was libified it was possible to > use the GIT_INDEX_FILE environment variable, for this purpose. > > But now, as the apply functionality has been libified, it sh

[PATCH v12 13/13] builtin/am: use apply API in run_apply()

2016-08-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 be

[PATCH v12 10/13] apply: change error_routine when silent

2016-08-11 Thread Christian Couder
To avoid printing anything when applying with `state->apply_verbosity == verbosity_silent`, let's save the existing warn and error routines before applying, and let's replace them with a routine that does nothing. Then after applying, let's restore the saved routines. Helped-by: Stefan Beller Si

[PATCH v12 11/13] apply: refactor `git apply` option parsing

2016-08-11 Thread Christian Couder
Parsing `git apply` options can be useful to other commands that want to call the libified apply functionality, because this way they can easily pass some options from their own command line to the libified apply functionality. This will be used by `git am` in a following patch. To make this

[PATCH v12 12/13] apply: learn to use a different index file

2016-08-11 Thread Christian Couder
Sometimes we want to apply in a different index file. Before the apply functionality was libified it was possible to use the GIT_INDEX_FILE environment variable, for this purpose. But now, as the apply functionality has been libified, it should be possible to do that in a libified way. Signed

[PATCH v12 06/13] apply: make it possible to silently apply

2016-08-11 Thread Christian Couder
into 'verbosity_verbose'. The new added state is 'verbosity_silent'. It should prevent anything to be printed on both stderr and stdout. This is needed because `git am` wants to first call apply functionality silently, if it can then fall back on 3-way merge in case of error. Printing

[PATCH v12 01/13] builtin/apply: rename option parsing functions

2016-08-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 --- builtin/apply.c | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --

[PATCH v12 02/13] apply: rename and move opt constants to apply.h

2016-08-11 Thread Christian Couder
ly.c index 429fe44..9c396bb 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4463,9 +4463,6 @@ static int write_out_results(struct apply_state *state, struct patch *list) static struct lock_file lock_file; -#define INACCURATE_EOF (1<<0) -#define RECOUNT(1<<1) - /*

[PATCH v12 00/13] libify apply and use lib in am, part 3

2016-08-11 Thread Christian Couder
Goal 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 significan

[PATCH v12 04/13] apply: make some parsing functions static again

2016-08-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 deletions(-) diff --git a/apply.

[PATCH v12 05/13] apply: use error_errno() where possible

2016-08-11 Thread Christian Couder
To avoid possible mistakes and to uniformly show the errno related messages, let's use error_errno() where possible. Signed-off-by: Christian Couder --- apply.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apply.c b/apply.c index c0cb3f5..41a33d3 100644

[PATCH v12 07/13] apply: don't print on stdout in verbosity_silent mode

2016-08-11 Thread Christian Couder
When apply_verbosity is set to verbosity_silent nothing should be printed on both stderr and stdout. To avoid printing on stdout, we can just skip calling the following functions: - stat_patch_list(), - numstat_patch_list(), - summary_patch_list(). It is safe to do that b

Re: [PATCH v11 28/40] builtin/apply: rename option parsing functions

2016-08-11 Thread Christian Couder
On Thu, Aug 11, 2016 at 10:58 AM, wrote: > Am 11.08.2016 um 10:52 schrieb 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 > > s/api/API/ > > ;-) Ooops. Anyway as this is patch

Re: [PATCH v11 28/40] builtin/apply: rename option parsing functions

2016-08-11 Thread stefan.naewe
Am 11.08.2016 um 10:52 schrieb 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 s/api/API/ ;-) > to the apply API. > > Signed-off-by: Christian Couder > ---

Re: [PATCH v10 01/40] apply: make some names more specific

2016-08-11 Thread stefan.naewe
Am 11.08.2016 um 10:40 schrieb Christian Couder: > On Tue, Aug 9, 2016 at 4:51 PM, wrote: >> Am 08.08.2016 um 23:02 schrieb Christian Couder: >>> To prepare for some structs and constants being moved from >>> builtin/apply.c to apply.h, we should give them some more >>> specific names to avoid po

Re: [PATCH v10 01/40] apply: make some names more specific

2016-08-11 Thread Christian Couder
On Tue, Aug 9, 2016 at 4:51 PM, wrote: > Am 08.08.2016 um 23:02 schrieb Christian Couder: >> To prepare for some structs and constants being moved from >> builtin/apply.c to apply.h, we should give them some more >> specific names to avoid possible name collisions in th global > > s/th/the/ > >>

[PATCH v11 28/40] builtin/apply: rename option parsing functions

2016-08-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 --- builtin/apply.c | 40 1 file changed, 20 insertions(+), 20 deletions(-) diff --

[PATCH v11 01/40] apply: make some names more specific

2016-08-11 Thread Christian Couder
message updates in those 2 patches. I hope that it will make it possible to merge the first 32 patches or so of this series. As usual cou can get the full series from: https://github.com/chriscool/git/commits/libify-apply-use-in-am builtin/apply.c | 20 ++-- 1 file changed, 10

Re: [PATCH v10 01/40] apply: make some names more specific

2016-08-09 Thread stefan.naewe
Am 08.08.2016 um 23:02 schrieb Christian Couder: > To prepare for some structs and constants being moved from > builtin/apply.c to apply.h, we should give them some more > specific names to avoid possible name collisions in th global s/th/the/ > namespace. > > Signed-off-by: Christian Couder >

Re: [PATCH v10 28/40] builtin/apply: rename option parsing functions

2016-08-09 Thread stefan.naewe
Am 08.08.2016 um 23:03 schrieb 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. s/api/API/ > > Signed-off-by: Christian Couder > ---

Re: [PATCH v10 00/40] libify apply and use lib in am, part 2

2016-08-08 Thread Junio C Hamano
Christian Couder writes: > diff --git a/apply.h b/apply.h > index 27a3a7a..e2b89e8 100644 > --- a/apply.h > +++ b/apply.h > @@ -16,7 +16,7 @@ enum apply_ws_ignore { > enum apply_verbosity { > verbosity_silent = -1, > verbosity_normal = 0, > -verbosity_verbose = 1, > +verbosity_

Re: [PATCH v10 00/40] libify apply and use lib in am, part 2

2016-08-08 Thread Christian Couder
r *get_index_file(void); extern char *get_graft_file(void); extern int set_git_dir(const char *path); @@ -472,6 +471,19 @@ extern const char *strip_namespace(const char *namespaced_ref); extern const char *get_git_work_tree(void); /* + * Hack to temporarily change the index. + * Yeah, the

[PATCH v10 24/40] builtin/apply: make write_out_one_result() return -1 on error

2016-08-08 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 returning

[PATCH v10 38/40] apply: change error_routine when silent

2016-08-08 Thread Christian Couder
To avoid printing anything when applying with `state->apply_verbosity == verbosity_silent`, let's save the existing warn and error routines before applying, and let's replace them with a routine that does nothing. Then after applying, let's restore the saved routines. Helped-by: Stefan Beller Si

[PATCH v10 26/40] builtin/apply: make try_create_file() return -1 on error

2016-08-08 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 ret

[PATCH v10 27/40] builtin/apply: make create_one_file() return -1 on error

2016-08-08 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 Couder --

[PATCH v10 32/40] apply: use error_errno() where possible

2016-08-08 Thread Christian Couder
To avoid possible mistakes and to uniformly show the errno related messages, let's use error_errno() where possible. Signed-off-by: Christian Couder --- apply.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apply.c b/apply.c index c0cb3f5..41a33d3 100644

[PATCH v10 29/40] apply: rename and move opt constants to apply.h

2016-08-08 Thread Christian Couder
ly.c index 429fe44..9c396bb 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4463,9 +4463,6 @@ static int write_out_results(struct apply_state *state, struct patch *list) static struct lock_file lock_file; -#define INACCURATE_EOF (1<<0) -#define RECOUNT(1<<1) - /*

[PATCH v10 34/40] apply: make it possible to silently apply

2016-08-08 Thread Christian Couder
into 'verbosity_verbose'. The new added state is 'verbosity_silent'. It should prevent anything to be printed on both stderr and stdout. This is needed because `git am` wants to first call apply functionality silently, if it can then fall back on 3-way merge in case of error. Printing

[PATCH v10 39/40] apply: refactor `git apply` option parsing

2016-08-08 Thread Christian Couder
Parsing `git apply` options can be useful to other commands that want to call the libified apply functionality, because this way they can easily pass some options from their own command line to the libified apply functionality. This will be used by `git am` in a following patch. To make this

[PATCH v10 16/40] builtin/apply: make gitdiff_*() return 1 at end of header

2016-08-08 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 of

[PATCH v10 40/40] builtin/am: use apply api in run_apply()

2016-08-08 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 be

[PATCH v10 08/40] builtin/apply: make parse_whitespace_option() return -1 instead of die()ing

2016-08-08 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 instead of calling die(). Signed-off-by: Christian Couder

<    1   2   3   4   5   6   7   8   9   10   >