Re: [PATCH v2 05/38] refs: create a base class "ref_store" for files_ref_store

2016-09-04 Thread Stefan Beller
On 04.09.2016 20:53, Michael Haggerty wrote: > On 09/04/2016 10:40 PM, David Turner wrote: >> On Sun, 2016-09-04 at 18:08 +0200, Michael Haggerty wrote: >> >>> +/* A linked list of ref_stores for submodules: */ >>> +static struct ref_store *submodule_ref_stores; >> >> I don't like the per-submodule

Re: [PATCH v2 7/7] blame: actually use the diff opts parsed from the command line

2016-09-04 Thread Michael Haggerty
On 08/23/2016 11:56 AM, René Scharfe wrote: > Am 22.08.2016 um 13:22 schrieb Michael Haggerty: >> "git blame" already parsed generic diff options from the command line >> via diff_opt_parse(), but instead of passing the resulting xdl_opts to >> xdi_diff(), it sent its own xdl_opts, which only refle

Re: [PATCH v2 05/38] refs: create a base class "ref_store" for files_ref_store

2016-09-04 Thread Michael Haggerty
On 09/04/2016 10:40 PM, David Turner wrote: > On Sun, 2016-09-04 at 18:08 +0200, Michael Haggerty wrote: > >> +/* A linked list of ref_stores for submodules: */ >> +static struct ref_store *submodule_ref_stores; > > I don't like the per-submodule stores being in a linked list, which > requires a

[PATCHv3] diff.c: emit moved lines with a different color

2016-09-04 Thread Stefan Beller
When we color the diff, we'll mark moved lines with a different color. This is achieved by doing a two passes over the diff. The first pass will inspect each line of the diff and store the removed lines and the added lines in its own hash map. The second pass will check for each added line if that

Re: [RFC/PATCH 0/2] Color moved code differently

2016-09-04 Thread Junio C Hamano
Junio C Hamano writes: > I do not think you should step outside diff_flush(). Only when > producing textual diff, you would have to run the textual diff > twice by going over the q twice: > > * The first pass would run diff_flush_patch(), which would call >into xdiff the usual way, but the

Re: [PATCH v2 05/38] refs: create a base class "ref_store" for files_ref_store

2016-09-04 Thread David Turner
On Sun, 2016-09-04 at 18:08 +0200, Michael Haggerty wrote: > +/* A linked list of ref_stores for submodules: */ > +static struct ref_store *submodule_ref_stores; I don't like the per-submodule stores being in a linked list, which requires a linear search. Stefan has, I think, been doing a bunch

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

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", die_on_unsafe_path() should return a negative integer instead of calling die(), so while doing that let's chan

[PATCH v14 37/41] apply: change error_routine when silent

2016-09-04 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. Note that, as we need to res

[PATCH v14 40/41] apply: learn to use a different index file

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

[PATCH v14 41/41] builtin/am: use apply API in run_apply()

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

[PATCH v14 07/41] builtin/apply: make parse_single_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_single_patch() should return a negative integer instead of calling die(). Let's do that by using error()

[PATCH v14 21/41] builtin/apply: make add_conflicted_stages_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", add_conflicted_stages_file() should return -1 instead of calling die(). Helped-by: Eric Sunshine Signed-off-

[PATCH v14 33/41] apply: make it possible to silently apply

2016-09-04 Thread Christian Couder
This changes 'int apply_verbosely' into 'enum apply_verbosity', and changes the possible values of the variable from a bool to a tristate. The previous 'false' state is changed into 'verbosity_normal'. The previous 'true' state is changed into 'verbosity_verbose'. The new added state is 'verbosit

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

2016-09-04 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 v14 39/41] apply: pass apply state to build_fake_ancestor()

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

[PATCH v14 22/41] builtin/apply: make add_index_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", add_index_file() should return -1 instead of calling die(). Signed-off-by: Christian Couder --- builtin/app

[PATCH v14 25/41] builtin/apply: make write_out_results() 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_results() should return -1 instead of calling exit(). Helped-by: Eric Sunshine Signed-off-by: Chr

[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 returning instead

[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| 1 + apply.c | 94 +

[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 returns -1 to

[PATCH v14 35/41] usage: add set_warn_routine()

2016-09-04 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-util.h b/

[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 --- buil

[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 poss

[PATCH v14 36/41] usage: add get_error_routine() and get_warn_routine()

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

[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 --git a/bui

[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 instead of calli

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

2016-09-04 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. Helped-by: Stefan Beller Signed-off-by: Christian Couder ---

[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 --- builtin/

[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, unfortunately find_h

[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: Christian Couder -

[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 --- builtin/

[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: Christian Couder --- apply.c

[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 possible for gitdif

[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 Signed-off-by: Chr

[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 | 1 + builtin/apply.c | 32 -

[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 --- builtin/apply.

[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 that we

[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: Christian Couder --- bu

[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(+), 3 d

[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: Christian Couder --- apply.h | 100

[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() return -12

[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 significantly faster. Pre

[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 v2 04/38] refs: add a backend method structure

2016-09-04 Thread David Turner
On Sun, 2016-09-04 at 18:08 +0200, Michael Haggerty wrote: > From: Ronnie Sahlberg > > Add a `struct ref_storage_be` to represent types of reference stores. In > OO notation, this is the class, and will soon hold some class > methods (e.g., a factory to create new ref_store instances) and will >

[WIP PATCH v2] diff.c: emit moved lines with a different color

2016-09-04 Thread Stefan Beller
From: Stefan Beller When we color the diff, we'll mark moved lines with a different color. This is achieved by doing a two passes over the diff. The first pass will inspect each line of the diff and store the removed lines and the added lines in its own hash map. The second pass will check for e

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

[PATCH v2 19/38] refs: make read_raw_ref() virtual

2016-09-04 Thread Michael Haggerty
Reference backends will be able to customize this function to implement reference reading. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 4 ++-- refs/files-backend.c | 14 -- refs/refs-internal.h | 36 +++-

[PATCH v2 28/38] lock_ref_sha1_basic(): add a files_ref_store argument

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 2f8eb54..ab2c1de 100644 --- a/refs/files-backend.c +++ b/refs/

[PATCH v2 11/38] refs: reorder definitions

2016-09-04 Thread Michael Haggerty
Move resolve_gitlink_ref() and related functions lower in the file to avoid the need for forward declarations in the next step. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 166 +-- 1 file changed, 83 in

[PATCH v2 25/38] lock_raw_ref(): add a files_ref_store argument

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 363f306..ae425c5 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.

[PATCH v2 24/38] repack_without_refs(): add a files_ref_store argument

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 8d43e0b..363f306 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c

[PATCH v2 21/38] refs: make pack_refs() virtual

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 7 +++ refs/files-backend.c | 6 -- refs/refs-internal.h | 4 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index 662c417..961927a 100644 --- a/refs.c +++ b/ref

[PATCH v2 20/38] refs: make verify_refname_available() virtual

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 10 ++ refs/files-backend.c | 14 -- refs/refs-internal.h | 7 +++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index 7a7adeb..662c417 100644 --- a

[PATCH v2 36/38] refs: add method to rename refs

2016-09-04 Thread Michael Haggerty
From: David Turner This removes the last caller of function get_files_ref_store(), so remove it. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 7 +++ refs/files-backend.c | 24 ++---

[PATCH v2 34/38] refs: make delete_refs() virtual

2016-09-04 Thread Michael Haggerty
From: David Turner In the file-based backend, delete_refs has some special optimization to deal with packed refs. In other backends, we might be able to make ref deletion faster by putting all deletions into a single transaction. So we need a special backend function for this. Signed-off-by: D

[PATCH v2 27/38] lock_ref_for_update(): add a files_ref_store argument

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 001b8ef..2f8eb54 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @

[PATCH v2 32/38] refs: add methods for reflog

2016-09-04 Thread Michael Haggerty
From: David Turner In the file-based backend, the reflog piggybacks on the ref lock. Since other backends won't have the same sort of ref lock, ref backends must also handle reflogs. Signed-off-by: Ronnie Sahlberg Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michae

[PATCH v2 26/38] commit_ref_update(): add a files_ref_store argument

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index ae425c5..001b8ef 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.

[PATCH v2 15/38] resolve_ref_recursively(): new function

2016-09-04 Thread Michael Haggerty
Add a new function, resolve_ref_recursively(), which is basically like the old resolve_ref_unsafe() except that it takes a (ref_store *) argument and also works for submodules. Re-implement resolve_ref_unsafe() as a thin wrapper around resolve_ref_recursively(). Signed-off-by: Michael Haggerty S

[PATCH v2 12/38] resolve_packed_ref(): rename function from resolve_missing_loose_ref()

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 7673342..32ca5ff 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @

[PATCH v2 17/38] resolve_gitlink_ref(): avoid memory allocation in many cases

2016-09-04 Thread Michael Haggerty
If we don't have to strip trailing '/' from the submodule path, then don't allocate and copy the submodule name. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c inde

[PATCH v2 09/38] {lock,commit,rollback}_packed_refs(): add files_ref_store arguments

2016-09-04 Thread Michael Haggerty
These functions currently only work in the main repository, so add an assert_main_repository() check to each function. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 32 1 file changed, 16 insertions(+), 16 deletions(-)

[PATCH v2 23/38] refs: make peel_ref() virtual

2016-09-04 Thread Michael Haggerty
For now it only supports the main reference store. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 7 +++ refs/files-backend.c | 6 -- refs/refs-internal.h | 3 +++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c i

[PATCH v2 05/38] refs: create a base class "ref_store" for files_ref_store

2016-09-04 Thread Michael Haggerty
We want ref_stores to be polymorphic, so invent a base class of which files_ref_store is a derived class. For now there is exactly one ref_store for the main repository and one for any submodules whose references have been accessed. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano -

[PATCH v2 13/38] resolve_gitlink_packed_ref(): remove function

2016-09-04 Thread Michael Haggerty
Now that resolve_packed_ref() can work with an arbitrary files_ref_store, there is no need to have a separate resolve_gitlink_packed_ref() function. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 26 +- 1 file changed, 5 insertio

[PATCH v2 37/38] refs: make lock generic

2016-09-04 Thread Michael Haggerty
From: David Turner Instead of including a files-backend-specific struct ref_lock, change the generic ref_update struct to include a void pointer that backends can use for their own arbitrary data. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty Signed

[PATCH v2 35/38] refs: add methods to init refs db

2016-09-04 Thread Michael Haggerty
From: David Turner Alternate refs backends might not need the refs/heads directory and so on, so we make ref db initialization part of the backend. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- builtin/init-db.c

[PATCH v2 38/38] refs: implement iteration over only per-worktree refs

2016-09-04 Thread Michael Haggerty
From: David Turner Alternate refs backends might still use files to store per-worktree refs. So provide a way to iterate over only the per-worktree references in a ref_store. The other backend can set up a files ref_store and iterate using the new DO_FOR_EACH_PER_WORKTREE_ONLY flag when iterating

[PATCH v2 22/38] refs: make create_symref() virtual

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 9 + refs/files-backend.c | 7 ++- refs/refs-internal.h | 5 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/refs.c b/refs.c index 961927a..74874e5 100644 --- a/refs.c +++ b/

[PATCH v2 33/38] refs: add method for initial ref transaction commit

2016-09-04 Thread Michael Haggerty
From: David Turner Signed-off-by: Ronnie Sahlberg Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 8 refs/files-backend.c | 8 +--- refs/refs-internal.h | 1 + 3 files changed, 14

[PATCH v2 29/38] split_symref_update(): add a files_ref_store argument

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index ab2c1de..3a0db5a 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -340

[PATCH v2 30/38] files_ref_iterator_begin(): take a ref_store argument

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 2 +- refs/files-backend.c | 4 ++-- refs/refs-internal.h | 8 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index f10f86a..d00126b 100644 --- a/refs.c +++ b/refs.c

[PATCH v2 31/38] refs: add method iterator_begin

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 2 +- refs/files-backend.c | 3 ++- refs/refs-internal.h | 24 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/refs.c b/refs.c index d00126b..798b08a 100644 --- a/

[PATCH v2 02/38] rename_ref_available(): add docstring

2016-09-04 Thread Michael Haggerty
From: David Turner And improve the internal variable names. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 12 ++-- refs/refs-internal.h | 12 +++- 2 files changed, 17 inserti

[PATCH v2 14/38] read_raw_ref(): take a (struct ref_store *) argument

2016-09-04 Thread Michael Haggerty
And make the function work for submodules. Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 4 +++- refs/files-backend.c | 18 +- refs/refs-internal.h | 9 ++--- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/refs.c

[PATCH v2 00/38] Virtualization of the refs API

2016-09-04 Thread Michael Haggerty
This is v2 of the patch series to virtualize the references API (though earlier patch series similar in spirit were submitted by Ronnie Sahlberg and David Turner). Thanks to Junio, Eric, and Ramsay for their comments about v1 [1]. Nobody pointed out any fundamental problems with v1, but this versi

[PATCH v2 08/38] resolve_missing_loose_ref(): add a files_ref_store argument

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 2fc8ec9..0c92ace 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c

[PATCH v2 01/38] resolve_gitlink_ref(): eliminate temporary variable

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 12290d2..74c2c47 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1387

[PATCH v2 07/38] get_packed_ref(): add a files_ref_store argument

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index c544de8..2fc8ec9 100644 --- a/refs/files-backend.c +++ b/refs/files-backen

[PATCH v2 10/38] refs: add a transaction_commit() method

2016-09-04 Thread Michael Haggerty
From: Ronnie Sahlberg Signed-off-by: Ronnie Sahlberg Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Jeff King Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 9 + refs/files-backend.c | 10 ++ refs/refs-int

[PATCH v2 18/38] resolve_gitlink_ref(): rename path parameter to submodule

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs.c | 13 +++-- refs.h | 9 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/refs.c b/refs.c index 34c0c5e..e881874 100644 --- a/refs.c +++ b/refs.c @@ -1299,26 +1299,27 @@ const char *resolve

[PATCH v2 16/38] resolve_gitlink_ref(): implement using resolve_ref_recursively()

2016-09-04 Thread Michael Haggerty
resolve_ref_recursively() can handle references in arbitrary files reference stores, so use it to resolve "gitlink" (i.e., submodule) references. Aside from removing redundant code, this allows submodule lookups to benefit from the much more robust code that we use for reading non-submodule referen

[PATCH v2 04/38] refs: add a backend method structure

2016-09-04 Thread Michael Haggerty
From: Ronnie Sahlberg Add a `struct ref_storage_be` to represent types of reference stores. In OO notation, this is the class, and will soon hold some class methods (e.g., a factory to create new ref_store instances) and will also serve as the vtable for ref_store instances of that type. As yet,

[PATCH v2 03/38] refs: rename struct ref_cache to files_ref_store

2016-09-04 Thread Michael Haggerty
The greater goal of this patch series is to develop the concept of a reference store, which is a place that references, their values, and their reflogs are stored, and to virtualize the reference interface so that different types of ref_stores can be implemented. We will then, for example, use ref_

[PATCH v2 06/38] add_packed_ref(): add a files_ref_store argument

2016-09-04 Thread Michael Haggerty
Signed-off-by: Michael Haggerty Signed-off-by: Junio C Hamano --- refs/files-backend.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 439c500..c544de8 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -

Re: [PATCH 1/6] git-gui: The term unified for remote in Japanese

2016-09-04 Thread Jakub Narębski
W dniu 03.09.2016 o 16:43, Satoshi Yasushima pisze: > msgid "Tracking branch %s is not a branch in the remote repository." > -msgstr "トラッキング・ブランチ %s は遠隔リポジトリのブランチではありません。" > +msgstr "" What for is the above part of change (empty string)? > +"トラッキング・ブランチ %s はリモートリポジトリのブランチではありません。" -- Jakub Na

Re: Fixup of a fixup not working right

2016-09-04 Thread Philip Oakley
From: "Johannes Schindelin" Hi Junio & Philip, On Fri, 2 Sep 2016, Junio C Hamano wrote: "Philip Oakley" writes: > As I understand this it's implied by design. The issue is that the > rebase is looking for that named commit within its current rebase > range, and can't find it, so ignores it

[PATCH 1/4] add: document the chmod option

2016-09-04 Thread Thomas Gummerer
The git add --chmod option was introduced in 4e55ed3 ("add: add --chmod=+x / --chmod=-x options", 2016-05-31), but was never documented. Document the feature. Signed-off-by: Thomas Gummerer --- Documentation/git-add.txt | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/D

[PATCH 0/4] git add --chmod: always change the file

2016-09-04 Thread Thomas Gummerer
Thanks to Peff and Junio for your inputs on the best way to solve this problem. The patch series is made up as follows: [1/4]: Documentation for the chmod option [2,3/4]: Small refactoring to simplify the final step [4/4]: The actual change that introduces the new behaviour. Thomas Gummerer (4):

[PATCH 2/4] update-index: use the same structure for chmod as add

2016-09-04 Thread Thomas Gummerer
While the chmod options for update-index and the add have the same functionality, they are using different ways to parse and handle the option internally. Unify these modes in order to make further refactoring simpler. Signed-off-by: Thomas Gummerer --- builtin/update-index.c | 49 +

[PATCH 3/4] read-cache: introduce chmod_index_entry

2016-09-04 Thread Thomas Gummerer
As there are chmod options for both add and update-index, introduce a new chmod_index_entry function to do the work. Use it in update-index, while it will be used in add in the next patch. Signed-off-by: Thomas Gummerer --- builtin/update-index.c | 8 +--- cache.h| 2 ++ r

[PATCH 4/4] add: modify already added files when --chmod is given

2016-09-04 Thread Thomas Gummerer
When the chmod option was added to git add, it was hooked up to the diff machinery, meaning that it only works when the version in the index differs from the version on disk. As the option was supposed to mirror the chmod option in update-index, which always changes the mode in the index, regardle

Re: [PATCH] stash: allow ref of a stash by index

2016-09-04 Thread Philip Oakley
From: "Johannes Schindelin" Hi, On Sat, 3 Sep 2016, Jeff King wrote: On Sat, Sep 03, 2016 at 07:21:18PM -0400, Aaron M Watson wrote: > Allows stashes to be referenced by index only. Instead of referencing > "stash@{n}" explicitly, it can simply be referenced as "n". This says "what" but not

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 >>>

  1   2   >