Re: [PATCH 9/9] rebase -i: rearrange fixup/squash lines using the rebase--helper

2016-09-04 Thread Johannes Schindelin
Hi Josh, On Sat, 3 Sep 2016, Josh Triplett wrote: > On Fri, Sep 02, 2016 at 06:23:42PM +0200, Johannes Schindelin wrote: > > Let's reimplement this with linear complexity (using a hash map to > > match the commits' subject lines) for the common case; Sadly, the > > fixup/squash feature's design

Re: [RFC/PATCH 2/2] WIP xdiff: markup duplicates differently

2016-09-04 Thread Junio C Hamano
Jakub Narębski writes: > Side note: I wonder if the cousin of unified diff, namely context diff[1], > is something that we can and should support. Yes, the lack of support for the copied context (instead of the unified context) diff format has bugged me over the years.

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

2016-09-04 Thread Junio C Hamano
Jeff King writes: >> diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt >> index 92df596..af11cff 100644 >> --- a/Documentation/git-stash.txt >> +++ b/Documentation/git-stash.txt >> @@ -35,11 +35,12 @@ A stash is by default listed as "WIP on >> 'branchname'

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

[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

[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

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

[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

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

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

[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

[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

[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

[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

[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

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

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

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

[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

[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

[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

[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

[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

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

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

[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

[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

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

[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

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

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

[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

[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

[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

[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

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

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

[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

[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

[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

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

[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

[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

[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

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

2016-09-04 Thread 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 "why". I assume it

Re: Fixup of a fixup not working right

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

Re: git add -p—splitting hunks, limit is too large

2016-09-04 Thread Johannes Schindelin
Hi Peff, On Fri, 2 Sep 2016, Jeff King wrote: > The good news (or maybe the bad) is that "add -p" is implemented > entirely in Perl. :) Yeah, you would definitely not call this "good news" if you were in my shoes. There is no question that it has grown way too unwieldy and that we (once again,

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

2016-09-04 Thread Stefan Beller
On Sat, Sep 3, 2016 at 11:41 PM, Junio C Hamano wrote: > Stefan Beller writes: > >>> * On 2/2, doing it at xdiff.c level may be limiting this good idea >>>to flourish to its full potential, as the interface is fed only >>>one diff_filepair at a

Re: [PATCH v2] t/Makefile: add a rule to re-run previously-failed tests

2016-09-04 Thread Matthieu Moy
Johannes Schindelin writes: > Hi, > > On Fri, 2 Sep 2016, Matthieu Moy wrote: > >> Johannes Schindelin writes: >> >> > Hi Ævar, >> > >> > On Fri, 2 Sep 2016, Ævar Arnfjörð Bjarmason wrote: >> > >> >> This might be me missing the point,

Re: [RFC/PATCH 2/2] WIP xdiff: markup duplicates differently

2016-09-04 Thread Jakub Narębski
W dniu 04.09.2016 o 07:31, Stefan Beller pisze: > On Sat, Sep 3, 2016 at 5:25 AM, Jakub Narębski wrote: >> W dniu 03.09.2016 o 05:31, Stefan Beller pisze: >> >>> When moving code (e.g. a function is moved to another part of the file or >>> to a different file), the review

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

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

2016-09-04 Thread Junio C Hamano
Stefan Beller writes: >> * On 2/2, doing it at xdiff.c level may be limiting this good idea >>to flourish to its full potential, as the interface is fed only >>one diff_filepair at a time. > > I realized that after I implemented it. I agree we would want to have > it

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

2016-09-04 Thread Junio C Hamano
Satoshi Yasushima writes: > Signed-off-by: Satoshi Yasushima > --- I couldn't quite read/parse the title, but luckily I read Japanese ;-) You saw different Japanese words used to translate the same original word "remote" in different message

Re: [PATCH] introduce hex2chr() for converting two hexadecimal digits to a character

2016-09-04 Thread Johannes Schindelin
Hi René, On Sat, 3 Sep 2016, René Scharfe wrote: > Add and use a helper function that decodes the char value of two > hexadecimal digits. It returns a negative number on error, avoids > running over the end of the given string and doesn't shift negative > values. I like it! Maybe stress a

Re: [PATCH] compat: move strdup(3) replacement to its own file

2016-09-04 Thread Johannes Schindelin
Hi René, I imagine you Cc:ed me because the nedmalloc stuff came in via the Windows port, contributed by Marius (who is no longer active on the Git project because it works well enough for him)? On Sat, 3 Sep 2016, René Scharfe wrote: > Move our implementation of strdup(3) out of

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

2016-09-04 Thread Jacob Keller
On Fri, Sep 2, 2016 at 8:31 PM, Stefan Beller wrote: > When moving code (e.g. a function is moved to another part of the file or > to a different file), the review process is different than reviewing new > code. When reviewing moved code we are only interested in the diff as >

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

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

Re: git add -p—splitting hunks, limit is too large

2016-09-04 Thread Johannes Schindelin
Hi Beau, On Fri, 2 Sep 2016, Beau Martinez wrote: > Hi git developers and community, > > I'd like to inquire as to why `git add -p` can only split hunks so > much. The limit is too large; why can't you split until each hunk is > only a line? I often have to run `edit` and split them manually >

Re: [PATCH v2] t/Makefile: add a rule to re-run previously-failed tests

2016-09-04 Thread Johannes Schindelin
Hi, On Fri, 2 Sep 2016, Matthieu Moy wrote: > Johannes Schindelin writes: > > > Hi Ævar, > > > > On Fri, 2 Sep 2016, Ævar Arnfjörð Bjarmason wrote: > > > >> On Wed, Aug 31, 2016 at 5:05 PM, Johannes Schindelin > >> wrote: > >> > >> > The

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

[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

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

[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

[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

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

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

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

[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

[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

[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

[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

[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

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

[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

[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

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

[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

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

[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

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

[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

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

[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

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

[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

[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

[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

[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

[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

  1   2   >