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

2016-06-27 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(). Signed-off-by: Christian Couder --- builtin/apply.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --

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

2016-06-27 Thread Christian Couder
The constants for the "inaccurate-eof" and the "recount" options will be used in both "apply.c" and "builtin/apply.c", so they need to go into "apply.h", and therefore they need a name that is more specific to the API they belong to. Signed-o

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

2016-06-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(+)

[PATCH v8 37/41] usage: add set_warn_routine()

2016-06-27 Thread Christian Couder
There are already set_die_routine() and set_error_routine(), so let's add set_warn_routine() as this will be needed in a following commit. Signed-off-by: Christian Couder --- git-compat-util.h | 1 + usage.c | 5 + 2 files changed, 6 insertions(+) diff --git a/git-compat-uti

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

2016-06-27 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 v8 36/41] apply: don't print on stdout when be_silent is set

2016-06-27 Thread Christian Couder
This variable should prevent anything to be printed on both stderr and stdout. Signed-off-by: Christian Couder --- apply.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apply.c b/apply.c index 1435f85..e2acc18 100644 --- a/apply.c +++ b/apply.c @@ -4698,13 +4698,13

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

2016-06-27 Thread Christian Couder
instead of calling exit(). 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 bce3988..6ec87e6 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @

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

2016-06-27 Thread Christian Couder
urns -1 to signal a recoverable error. To fix that, let's make it return 1 in case of a recoverable error and -1 in case of an unrecoverable error. Helped-by: Eric Sunshine Signed-off-by: Christian Couder --- builtin/apply.c | 41 ++--- 1 file changed

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

2016-06-27 Thread Christian Couder
returning instead of calling exit(). 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 eadff4d..bce3988 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4269

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

2016-06-27 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 v8 21/41] builtin/apply: make add_conflicted_stages_file() return -1 on error

2016-06-27 Thread Christian Couder
Signed-off-by: Christian Couder --- builtin/apply.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index cb3ef1c..b0fd5f7 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4224,7 +4224,7 @@ static void create_one_f

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

2016-06-27 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 v8 34/41] apply: add 'be_silent' variable to 'struct apply_state'

2016-06-27 Thread Christian Couder
This variable should prevent anything to be printed on both stderr and stdout. Let's not take care of stdout and apply_verbosely for now though, as that will be taken care of in following patches. Signed-off-by: Christian Couder --- apply.c

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

2016-06-27 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 v8 39/41] apply: change error_routine when be_silent is set

2016-06-27 Thread Christian Couder
To avoid printing anything when applying with be_silent set, let's save the existing warn and error routines before applying and replace them with a routine that does nothing. Then after applying, let's restore the saved routines. Signed-off-by: Christian Couder --- ap

[PATCH v8 38/41] usage: add get_error_routine() and get_warn_routine()

2016-06-27 Thread Christian Couder
Let's make it possible to get the current error_routine and warn_routine, so that we can store them before using set_error_routine() or set_warn_routine() to use new ones. This way we will be able put back the original routines, when we are done with using new ones. Signed-off-by: Chri

[PATCH v8 35/41] apply: make 'be_silent' incompatible with 'apply_verbosely'

2016-06-27 Thread Christian Couder
It should be an error to have both be_silent and apply_verbosely set, so let's check that in check_apply_state(). And by the way let's not automatically set apply_verbosely when be_silent is set. Signed-off-by: Christian Couder --- apply.c | 9 +++-- 1 file changed, 7 insert

[PATCH v8 32/41] environment: add set_index_file()

2016-06-27 Thread Christian Couder
*/ ... /* When finished reset the index file */ set_index_file(old_index_file); Signed-off-by: Christian Couder --- cache.h | 1 + environment.c | 10 ++ 2 files changed, 11 insertions(+) diff --git a/cache.h b/cache.h index c73becb..8854365 100644 --- a/cache.h +++ b/cache.h

[PATCH v8 33/41] write_or_die: use warning() instead of fprintf(stderr, ...)

2016-06-27 Thread Christian Couder
ff-by: Christian Couder --- write_or_die.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/write_or_die.c b/write_or_die.c index 49e80aa..c29f677 100644 --- a/write_or_die.c +++ b/write_or_die.c @@ -87,8 +87,7 @@ int write_or_whine_pipe(int fd, const void *buf, size_t

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

2016-06-27 Thread Christian Couder
ot; with split index: 1m22.476s This series on top of "next" without split index: 1m12.034s This series on top of "next" with split index: 0m15.678s (using branch "next" from mid April 2016.) Benchmarked-by: Ævar Arnfjörð Bjarmason Signe

[PATCH v8 07/41] builtin/apply: make parse_single_patch() return -1 on error

2016-06-27 Thread Christian Couder
error() and let's adjust the related test cases accordingly. Signed-off-by: Christian Couder --- builtin/apply.c| 17 + t/t4012-diff-binary.sh | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index b10a7e

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

2016-06-27 Thread Christian Couder
ssible for gitdiff_*() functions to return -1 in case of error. Let's take advantage of that to make gitdiff_verify_name() return -1 on error, and to have gitdiff_oldname() and gitdiff_newname() directly return what gitdiff_verify_name() returns. Helped-by: Nguyễn Thái Ngọc Duy Signed-off-by: C

[PATCH v8 10/41] builtin/apply: move init_apply_state() to apply.c

2016-06-27 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 v8 18/41] builtin/apply: change die_on_unsafe_path() to check_unsafe_path()

2016-06-27 Thread Christian Couder
that let's change its name to check_unsafe_path(). Signed-off-by: Christian Couder --- builtin/apply.c | 32 +--- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index b48b526..d3a9da2 100644 --- a/builtin/apply.

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

2016-06-27 Thread Christian Couder
ately find_header() already returns -1 when no header is found. Signed-off-by: Christian Couder --- builtin/apply.c | 40 t/t4254-am-corrupt.sh | 2 +- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c

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

2016-06-27 Thread Christian Couder
On Mon, Jun 27, 2016 at 8:23 PM, Christian Couder wrote: > > I will send a diff between this version and the previous one, as a > reply to this email. Here is the diff: diff --git a/apply.c b/apply.c index 98a..2ac22d3 100644 --- a/apply.c +++ b/apply.c @@ -1516,8 +1516,8 @@ s

Re: [RFC] Native access to Git LFS cache

2016-06-28 Thread Christian Couder
On Tue, Jun 28, 2016 at 3:22 PM, Lars Schneider wrote: > > @Christian/Peff: > Is there a place to look for more info about your remote-object-store idea? You may want to take a look at: https://github.com/chriscool/git/commits/external-odb I just updated it and I may send an updated RFC series

[RFC/PATCH v2 07/10] external-odb: accept only blobs for now

2016-06-28 Thread Christian Couder
Signed-off-by: Christian Couder --- external-odb.c | 4 1 file changed, 4 insertions(+) diff --git a/external-odb.c b/external-odb.c index bb70fe3..6dd7b25 100644 --- a/external-odb.c +++ b/external-odb.c @@ -133,6 +133,10 @@ int external_odb_write_object(const void *buf, unsigned long

[RFC/PATCH v2 08/10] t0400: add test for external odb write support

2016-06-28 Thread Christian Couder
Signed-off-by: Christian Couder --- t/t0400-external-odb.sh | 8 1 file changed, 8 insertions(+) diff --git a/t/t0400-external-odb.sh b/t/t0400-external-odb.sh index 6c6da5c..3c868ca 100755 --- a/t/t0400-external-odb.sh +++ b/t/t0400-external-odb.sh @@ -66,4 +66,12

[RFC/PATCH v2 05/10] t0400: add test for 'put' command

2016-06-28 Thread Christian Couder
Signed-off-by: Christian Couder --- t/t0400-external-odb.sh | 9 + 1 file changed, 9 insertions(+) diff --git a/t/t0400-external-odb.sh b/t/t0400-external-odb.sh index 0f1bb97..6c6da5c 100755 --- a/t/t0400-external-odb.sh +++ b/t/t0400-external-odb.sh @@ -57,4 +57,13

[RFC/PATCH v2 04/10] t0400: add 'put' command to odb-helper script

2016-06-28 Thread Christian Couder
Signed-off-by: Christian Couder --- t/t0400-external-odb.sh | 14 ++ 1 file changed, 14 insertions(+) diff --git a/t/t0400-external-odb.sh b/t/t0400-external-odb.sh index fe85413..0f1bb97 100755 --- a/t/t0400-external-odb.sh +++ b/t/t0400-external-odb.sh @@ -7,6 +7,10

[RFC/PATCH v2 10/10] Add t0410 to test external ODB transfer

2016-06-28 Thread Christian Couder
Signed-off-by: Christian Couder --- t/t0410-transfer-e-odb.sh | 136 ++ 1 file changed, 136 insertions(+) create mode 100755 t/t0410-transfer-e-odb.sh diff --git a/t/t0410-transfer-e-odb.sh b/t/t0410-transfer-e-odb.sh new file mode 100755 index

[RFC/PATCH v2 06/10] external odb: add write support

2016-06-28 Thread Christian Couder
Signed-off-by: Christian Couder --- external-odb.c | 15 +++ external-odb.h | 2 ++ odb-helper.c | 41 + odb-helper.h | 3 +++ sha1_file.c| 2 ++ 5 files changed, 59 insertions(+), 4 deletions(-) diff --git a/external-odb.c b

[RFC/PATCH v2 09/10] Add GIT_NO_EXTERNAL_ODB env variable

2016-06-28 Thread Christian Couder
Signed-off-by: Christian Couder --- cache.h| 9 + environment.c | 4 external-odb.c | 6 ++ sha1_file.c| 3 +++ 4 files changed, 22 insertions(+) diff --git a/cache.h b/cache.h index cc0a934..b0fe2bc 100644 --- a/cache.h +++ b/cache.h @@ -420,6 +420,7 @@ static

[RFC/PATCH v2 03/10] t0400: use --batch-all-objects to get all objects

2016-06-28 Thread Christian Couder
Signed-off-by: Christian Couder --- t/t0400-external-odb.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/t/t0400-external-odb.sh b/t/t0400-external-odb.sh index 2b01617..fe85413 100755 --- a/t/t0400-external-odb.sh +++ b/t/t0400-external-odb.sh @@ -10,9 +10,7

[RFC/PATCH v2 00/10] Add initial experimental external ODB support

2016-06-28 Thread Christian Couder
g/gmane.comp.version-control.git/288151/focus=295160 Version 1 of this RFC/PATCH series is here: http://thread.gmane.org/gmane.comp.version-control.git/297164 Links ~~~~~ This patch series is available here: https://github.com/chriscool/git/commits/external-odb Version 1 is here: https://github

[RFC/PATCH v2 01/10] Add initial external odb support

2016-06-28 Thread Christian Couder
From: Jeff King Signed-off-by: Christian Couder --- Makefile| 2 + cache.h | 9 ++ external-odb.c | 115 +++ external-odb.h | 8 ++ odb-helper.c| 239 odb

[RFC/PATCH v2 02/10] external odb foreach

2016-06-28 Thread Christian Couder
From: Jeff King --- external-odb.c | 14 ++ external-odb.h | 6 ++ odb-helper.c | 15 +++ odb-helper.h | 4 4 files changed, 39 insertions(+) diff --git a/external-odb.c b/external-odb.c index 1ccfa99..42978a3 100644 --- a/external-odb.c +++ b/external-odb

Re: [PATCH] builtin/apply: include declaration of cmd_apply()

2016-06-30 Thread Christian Couder
Hi Ramsay, On Thu, Jun 30, 2016 at 3:47 AM, Ramsay Jones wrote: > > Hi Christian, > > If you need to re-roll your 'cc/apply-am' branch, could you please > squash this into the relevant patch. Commit 95a3b0ba ("apply: move > libified code from builtin/apply.c to apply.{c,h}", 22-04-2016) > removed

Re: [PATCH v8 33/41] write_or_die: use warning() instead of fprintf(stderr, ...)

2016-06-30 Thread Christian Couder
On Tue, Jun 28, 2016 at 11:39 PM, Junio C Hamano wrote: > Christian Couder writes: > >> @@ -98,8 +97,7 @@ int write_or_whine_pipe(int fd, const void *buf, size_t >> count, const char *msg) >> int write_or_whine(int fd, const void *buf, size_t count, const char

Re: [RFC/PATCH v2 00/10] Add initial experimental external ODB support

2016-06-30 Thread Christian Couder
On Wed, Jun 29, 2016 at 10:01 PM, Eric Wong wrote: > Christian Couder wrote: >> Design discussion about performance >> ~~~ >> >> Yeah, it is not efficient to fork/exec a command to just read or write >> one object to or from the

[RFC/PATCH 2/8] split-index: add {add,remove}_split_index() functions

2016-07-11 Thread Christian Couder
Also use the functions in cmd_update_index() in builtin/update-index.c. Signed-off-by: Christian Couder --- builtin/update-index.c | 17 - split-index.c | 18 ++ split-index.h | 2 ++ 3 files changed, 24 insertions(+), 13 deletions(-) diff

[RFC/PATCH 3/8] read-cache: add and then use tweak_split_index()

2016-07-11 Thread Christian Couder
This will make us use the split-index feature or not depending on the value of the core.splitIndex config variable. Signed-off-by: Christian Couder --- read-cache.c | 17 + 1 file changed, 17 insertions(+) diff --git a/read-cache.c b/read-cache.c index db27766..ae292d6 100644

[RFC/PATCH 0/8] Add configuration options for split-index

2016-07-11 Thread Christian Couder
l.git/298344/ This patch series is also available here: https://github.com/chriscool/git/commits/config-split-index Christian Couder (8): config: add git_config_get_split_index() split-index: add {add,remove}_split_index() functions read-cache: add and then use tweak_split_index() update-index:

[RFC/PATCH 7/8] t1700: add tests for core.splitIndex

2016-07-11 Thread Christian Couder
Signed-off-by: Christian Couder --- t/t1700-split-index.sh | 37 + 1 file changed, 37 insertions(+) diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh index 8aef49f..f1af0d5 100755 --- a/t/t1700-split-index.sh +++ b/t/t1700-split-index.sh @@ -200,4

[RFC/PATCH 6/8] Documentation/git-update-index: talk about core.splitIndex config var

2016-07-11 Thread Christian Couder
Signed-off-by: Christian Couder --- Documentation/git-update-index.txt | 6 ++ 1 file changed, 6 insertions(+) diff --git a/Documentation/git-update-index.txt b/Documentation/git-update-index.txt index c6cbed1..2293140 100644 --- a/Documentation/git-update-index.txt +++ b/Documentation/git

[RFC/PATCH 5/8] Documentation/config: add information for core.splitIndex

2016-07-11 Thread Christian Couder
Signed-off-by: Christian Couder --- Documentation/config.txt | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/config.txt b/Documentation/config.txt index e208af1..aec8ecb 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -324,6 +324,10

[RFC/PATCH 4/8] update-index: warn in case of split-index incoherency

2016-07-11 Thread Christian Couder
Signed-off-by: Christian Couder --- builtin/update-index.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/builtin/update-index.c b/builtin/update-index.c index f06fe80..2b8aaa6 100644 --- a/builtin/update-index.c +++ b/builtin/update-index.c @@ -1108,10

[RFC/PATCH 1/8] config: add git_config_get_split_index()

2016-07-11 Thread Christian Couder
Signed-off-by: Christian Couder --- cache.h | 1 + config.c | 10 ++ 2 files changed, 11 insertions(+) diff --git a/cache.h b/cache.h index f1dc289..5296a50 100644 --- a/cache.h +++ b/cache.h @@ -1695,6 +1695,7 @@ extern int git_config_get_bool_or_int(const char *key, int *is_bool

[RFC/PATCH 8/8] read-cache: unlink old sharedindex files

2016-07-11 Thread Christian Couder
Everytime split index is turned on, it creates a "sharedindex." file in the git directory. This makes sure that old sharedindex files are removed after a new one has been created. Signed-off-by: Christian Couder --- read-cache.c | 27 ++- t/t

Re: [RFC/PATCH 8/8] read-cache: unlink old sharedindex files

2016-07-12 Thread Christian Couder
On Mon, Jul 11, 2016 at 8:27 PM, Duy Nguyen wrote: > On Mon, Jul 11, 2016 at 7:22 PM, Christian Couder > wrote: >> Everytime split index is turned on, it creates a "sharedindex." >> file in the git directory. This makes sure that old sharedindex >> files ar

Re: [RFC/PATCH 8/8] read-cache: unlink old sharedindex files

2016-07-12 Thread Christian Couder
On Tue, Jul 12, 2016 at 5:12 PM, Duy Nguyen wrote: > > No. People could create an index file anywhere in theory. So you don't > know how many index files there are. Maybe when an index file is created, its path and its sharedindex file could be appended into a log file. We could check this log fi

Re: [PATCH 0/9] Resend of gitster/pb/bisect

2016-07-13 Thread Christian Couder
Hi Pranit, On Wed, Jul 13, 2016 at 12:35 AM, Pranit Bauva wrote: > Hey Junio, > > A small mistake got unnoticed by me which Lars recently pointed out. > The naming convention is "git_path_" and underscore > instead of spaces. It's a good thing to resend when you find mistakes, but please use a v

Re: [RFC/PATCH 8/8] read-cache: unlink old sharedindex files

2016-07-13 Thread Christian Couder
On Wed, Jul 13, 2016 at 5:16 PM, Duy Nguyen wrote: > On Tue, Jul 12, 2016 at 9:45 PM, Christian Couder > wrote: >> On Tue, Jul 12, 2016 at 5:12 PM, Duy Nguyen wrote: >>> >>> No. People could create an index file anywhere in theory. So you don't >

Plugin mechanism(s) for Git?

2016-07-14 Thread Christian Couder
Hi, It seems to me that there are many current topics/patch series in flight that are about making Git interact with external code/processes and that it could be interesting to step back a bit and see if we could find a common approach/mechanism for at least some of these current topics. (This is

Draft of Git Rev News edition 17

2016-07-17 Thread Christian Couder
Hi, A draft of a new Git Rev News edition is available here: https://github.com/git/git.github.io/blob/master/rev_news/drafts/edition-17.md Everyone is welcome to contribute in any section either by editing the above page on GitHub and sending a pull request, or by commenting on this GitHub is

[ANNOUNCE] GitRev News edition 17

2016-07-20 Thread Christian Couder
Hi everyone, I'm happy announce that the 17th edition of Git Rev News is now published: https://git.github.io/rev_news/2016/07/20/edition-17/ Thanks a lot to all the contributors and helpers, especially Jakub and Dscho! Enjoy, Christian, Thomas and Nicola. -- To unsubscribe from this list: send

Re: [ANNOUNCE] GitRev News edition 17

2016-07-20 Thread Christian Couder
On Wed, Jul 20, 2016 at 8:05 PM, Junio C Hamano wrote: > On Wed, Jul 20, 2016 at 5:58 AM, Christian Couder > wrote: >> Hi everyone, >> >> I'm happy announce that the 17th edition of Git Rev News is now published: >> >> https://git.github.io/rev_news/2016/

Re: [ANNOUNCE] GitRev News edition 17

2016-07-20 Thread Christian Couder
On Wed, Jul 20, 2016 at 10:40 PM, Junio C Hamano wrote: > On Wed, Jul 20, 2016 at 1:38 PM, Christian Couder > wrote: >>> Micronit. 2.9.1 (or 2.9.2) would not be a "major release". 2.9.0 was, >>> and x.y.z (z > 0) are "maintenance releases"

Re: [RFC/PATCH 0/8] Add configuration options for split-index

2016-07-23 Thread Christian Couder
On Tue, Jul 12, 2016 at 6:01 PM, Duy Nguyen wrote: > On Mon, Jul 11, 2016 at 7:22 PM, Christian Couder > wrote: >> Future work >> ~~~ >> >> One thing that is probably missing is a mechanism to avoid having too >> many changes accumulating in the (split

Re: [RFC/PATCH 0/8] Add configuration options for split-index

2016-07-25 Thread Christian Couder
On Mon, Jul 25, 2016 at 6:04 PM, Duy Nguyen wrote: > > Hmm.. can you do the counting separately? A shared cache_entry must > have its field "index" greater than zero. By counting the number of > entries whose index is zero (i.e. not shared) against the total number > of real (*) entries, you shoul

Re: [PATCH v10 12/12] bisect--helper: `get_terms` & `bisect_terms` shell function in C

2016-07-25 Thread Christian Couder
On Mon, Jul 25, 2016 at 6:53 PM, Junio C Hamano wrote: > Pranit Bauva writes: > >>> And why are the defines 1,2,4,8 ? >>> It looks as if a #define bitmap may be a better choice here ? >>> How do we do these kind of bit-wise opions otherwise ? > > We might want to ask if these should even be bitwi

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

2016-07-26 Thread Christian Couder
On Tue, Jul 26, 2016 at 11:18 PM, Junio C Hamano wrote: > Christian Couder writes: > >> Sorry if this patch series is still long. I can split it into two or >> more series if it is prefered. >> ... >> Christian Couder (41): >> apply: make some names mo

Re: Small trivial annoyance with the nice new builtin "git am"

2016-07-29 Thread Christian Couder
On Fri, Jul 29, 2016 at 2:32 AM, Linus Torvalds wrote: > On Thu, Jul 28, 2016 at 5:21 PM, Jeff King wrote: >> >> I do wonder if you would be happier giving each commit a "fake" >> monotonically increasing time, so they are correctly ordered by commit >> date. > > No, that would be nasty, partly f

Re: [PATCH v8 32/41] environment: add set_index_file()

2016-07-29 Thread Christian Couder
On Wed, Jul 27, 2016 at 5:14 PM, Duy Nguyen wrote: > On Tue, Jul 26, 2016 at 9:28 PM, Junio C Hamano wrote: >> Christian Couder writes: >> >>> Introduce set_index_file() to be able to temporarily change the index file. >>> >>> It should be used like th

Re: [PATCH v8 32/41] environment: add set_index_file()

2016-07-29 Thread Christian Couder
On Fri, Jul 29, 2016 at 5:34 PM, Duy Nguyen wrote: > > Yeah. If the libification movement is going strong, we can start > converting and at some point should be able to define > NO_THE_INDEX_COMPATIBILITY_MACROS globally (and avoid the_index along > the way) > > Without that, there is a risk. I lo

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

2016-07-30 Thread Christian Couder
ex: 0m15.678s Ævar used his Debian laptop with SSD. - Around mid April I tested rebasing 13 commits in Booking.com's monorepo on a Red Hat 6.5 server with split-index and GIT_TRACE_PERFORMANCE=1. With Git v2.8.0, the rebase took 6.375888383 s, with the git am command launched by

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

2016-07-30 Thread Christian Couder
eturn -128 and it will exit(1) when it returns -1. We exit() with code 128 because that was what die() was doing and we want to keep the distinction between exiting with code 1 and exiting with code 128. Helped-by: Eric Sunshine Signed-off-by: Christian Couder --- builtin/apply.c

[PATCH v9 07/41] builtin/apply: make parse_single_patch() return -1 on error

2016-07-30 Thread Christian Couder
error() and let's adjust the related test cases accordingly. Signed-off-by: Christian Couder --- builtin/apply.c| 17 + t/t4012-diff-binary.sh | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index 5c73a3

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

2016-07-30 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 v9 01/41] apply: make some names more specific

2016-07-30 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 th global namespace. Signed-off-by: Christian Couder --- builtin/apply.c | 20 ++-- 1 file changed, 10

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

2016-07-30 Thread Christian Couder
ately find_header() already returns -1 when no header is found. Signed-off-by: Christian Couder --- builtin/apply.c | 40 t/t4254-am-corrupt.sh | 2 +- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c

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

2016-07-30 Thread Christian Couder
() is called only by apply_patch() which already returns either -1 or -128 when an error happened, let's make it also return -1 or -128. This makes it compatible with what find_header() and parse_binary() already return. Helped-by: Eric Sunshine Signed-off-by: Christian Couder --- bu

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

2016-07-30 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(). Signed-off-by: Christian Couder --- builtin/apply.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --

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

2016-07-30 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 v9 16/41] builtin/apply: make gitdiff_*() return 1 at end of header

2016-07-30 Thread Christian Couder
ase of a real error. This will be done in a following patch. Helped-by: Nguyễn Thái Ngọc Duy Signed-off-by: Christian Couder --- builtin/apply.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index 0148c2e..877610c 100644 --

[PATCH v9 21/41] builtin/apply: make add_conflicted_stages_file() return -1 on error

2016-07-30 Thread Christian Couder
Signed-off-by: Christian Couder --- builtin/apply.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index 6ffd4c0..1f405b4 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4224,7 +4224,7 @@ static void create_one_f

[PATCH v9 25/41] builtin/apply: make write_out_results() return -1 on error

2016-07-30 Thread Christian Couder
ned-off-by: Christian Couder --- builtin/apply.c | 27 +-- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index 815ba77..0834ad2 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4383,6 +4383,12 @@ static int write_out_

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

2016-07-30 Thread Christian Couder
The constants for the "inaccurate-eof" and the "recount" options will be used in both "apply.c" and "builtin/apply.c", so they need to go into "apply.h", and therefore they need a name that is more specific to the API they belong to. Signed-o

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

2016-07-30 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 v9 23/41] builtin/apply: make create_file() return -1 on error

2016-07-30 Thread Christian Couder
returning instead of calling exit(). 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 a87ca0b..4b4ed40 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -4269

[PATCH v9 18/41] builtin/apply: change die_on_unsafe_path() to check_unsafe_path()

2016-07-30 Thread Christian Couder
that let's change its name to check_unsafe_path(). Signed-off-by: Christian Couder --- builtin/apply.c | 32 +--- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index 6a0818b..55f6e48 100644 --- a/builtin/apply.

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

2016-07-30 Thread Christian Couder
instead of calling exit(). 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 4b4ed40..815ba77 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @

[PATCH v9 40/41] apply: refactor `git apply` option parsing

2016-07-30 Thread Christian Couder
possible, let's refactor the `git apply` option parsing code into a new libified apply_parse_options() function. Signed-off-by: Christian Couder --- apply.c | 77 + apply.h | 4 +++ builtin/apply.c

[PATCH v9 41/41] builtin/am: use apply api in run_apply()

2016-07-30 Thread Christian Couder
ot; with split index: 1m22.476s This series on top of "next" without split index: 1m12.034s This series on top of "next" with split index: 0m15.678s (using branch "next" from mid April 2016.) Benchmarked-by: Ævar Arnfjörð Bjarmason Signe

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

2016-07-30 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(+)

[PATCH v9 22/41] builtin/apply: make add_index_file() return -1 on error

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

[PATCH v9 34/41] write_or_die: use warning() instead of fprintf(stderr, ...)

2016-07-30 Thread Christian Couder
ff-by: Christian Couder --- write_or_die.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/write_or_die.c b/write_or_die.c index 9816879..26eeec8 100644 --- a/write_or_die.c +++ b/write_or_die.c @@ -87,8 +87,7 @@ int write_or_whine_pipe(int fd, const void *buf, size_t count,

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

2016-07-30 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 12cad24..7ccb6b5 1

[PATCH v9 36/41] apply: don't print on stdout in verbosity_silent mode

2016-07-30 Thread Christian Couder
values and calls printing functions, - summary_patch_list() calls show_file_mode_name(), printf(), show_rename_copy(), show_mode_change() that are only printing. Signed-off-by: Christian Couder --- apply.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apply.c b/apply.c

[PATCH v9 35/41] apply: make it possible to silently apply

2016-07-30 Thread Christian Couder
on stdout, and calls to warning() or error() are not taken care of in this patch, as that will be done in following patches. Signed-off-by: Christian Couder --- apply.c | 62 + apply.h | 8 +++- builtin/apply.c |

[PATCH v9 33/41] environment: add set_index_file()

2016-07-30 Thread Christian Couder
another index file to be used instead. And yeah this is a short cut and this new function should not be used by other code. Signed-off-by: Christian Couder --- cache.h | 1 + environment.c | 12 2 files changed, 13 insertions(+) diff --git a/cache.h b/cache.h index b5f76a4

[PATCH v9 37/41] usage: add set_warn_routine()

2016-07-30 Thread Christian Couder
There are already set_die_routine() and set_error_routine(), so let's add set_warn_routine() as this will be needed in a following commit. Signed-off-by: Christian Couder --- git-compat-util.h | 1 + usage.c | 5 + 2 files changed, 6 insertions(+) diff --git a/git-compat-uti

[PATCH v9 39/41] apply: change error_routine when silent

2016-07-30 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 replace them with a routine that does nothing. Then after applying, let's restore the saved routines. Signed-off-by: Chr

[PATCH v9 38/41] usage: add get_error_routine() and get_warn_routine()

2016-07-30 Thread Christian Couder
Let's make it possible to get the current error_routine and warn_routine, so that we can store them before using set_error_routine() or set_warn_routine() to use new ones. This way we will be able put back the original routines, when we are done with using new ones. Signed-off-by: Chri

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

2016-07-30 Thread Christian Couder
ssible for gitdiff_*() functions to return -1 in case of error. Let's take advantage of that to make gitdiff_verify_name() return -1 on error, and to have gitdiff_oldname() and gitdiff_newname() directly return what gitdiff_verify_name() returns. Helped-by: Nguyễn Thái Ngọc Duy Signed-off-by: C

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

2016-07-30 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 v9 26/41] builtin/apply: make try_create_file() return -1 on error

2016-07-30 Thread Christian Couder
urns -1 to signal a recoverable error. To fix that, let's make it return 1 in case of a recoverable error and -1 in case of an unrecoverable error. Helped-by: Eric Sunshine Signed-off-by: Christian Couder --- builtin/apply.c | 41 ++--- 1 file changed

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

2016-07-30 Thread Christian Couder
ned-off-by: Christian Couder --- builtin/apply.c | 41 ++--- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index 55f6e48..6087195 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -3900,11 +3900,12 @@

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

2016-07-30 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

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