[PATCH 31/38] refs: add method iterator_begin

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 bda8fc1..d1ab20b 100644 --- a/refs.c +++ b/refs.c @@ -1157,7

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

2016-06-03 Thread Michael Haggerty
-submodule references. And, since the code is now agnostic about reference backends, it will work for any future references backend (so move its definition to refs.c). Signed-off-by: Michael Haggerty --- refs.c | 24 +++ refs/files-back

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

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs.c | 11 ++- refs.h | 9 + 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/refs.c b/refs.c index 7a8ef6d..c39f85a 100644 --- a/refs.c +++ b/refs.c @@ -1299,22 +1299,23 @@ const char *resolve_ref_unsafe(const char *refname

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

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 5bfa912..57f1965 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1407,11 +1407,9 @@ int

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

2016-06-03 Thread Michael Haggerty
ff-by: Michael Haggerty --- This patch doesn't fix the known problem [1] that worktree reflogs are not considered when considering reachability, but I think this whole patch series will make the problem easier to fix in a relatively elegant way. [1] http://thread.gmane.org/gmane.comp.version-c

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

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 79ef443..f4f5f32 100644 --- a/refs.c +++ b/refs.c @@ -1418,6 +1418,13

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

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 1798f66..79ef443 100644 --- a/refs.c +++ b/refs.c

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

2016-06-03 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 --- refs/files-backend.c | 26 +- 1 file changed, 5 insertions(+), 21 deletions(-) diff

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

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 2d84c5c..bda8fc1 100644 --- a/refs.c +++ b/refs.c @@ -1157,7 +1157,7 @@ static

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

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 91dcfcb..48b37fa 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2388,14 +2388,14 @@ static

[PATCH 34/38] refs: add method for delete_refs

2016-06-03 Thread Michael Haggerty
: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- I think that we could get away without this method if we make ref_transactions a bit smarter (for example, by supporting best-effort updates that can fail without causing the entire transaction to be aborted). But that

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

2016-06-03 Thread Michael Haggerty
iterating. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- refs/files-backend.c | 4 refs/refs-internal.h | 10 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 53d0ba1

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

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 bc7d250..225e0af 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -3485,20 +3485,21 @@ static

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

2016-06-03 Thread Michael Haggerty
, the backends cannot do anything. 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 --- refs.c | 19 +++ refs.h | 2 ++ refs/files-backend.c | 5

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

2016-06-03 Thread Michael Haggerty
From: David Turner Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- refs/refs-internal.h | 5 + 1 file changed, 5 insertions(+) diff --git a/refs/refs-internal.h b/refs/refs-internal.h index efe5847..d8a2606 100644 --- a/refs/refs-internal.h

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

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 8ef79c2..5bfa912 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1196,10 +1196,9 @@ static

[PATCH 00/38] Virtualization of the refs API

2016-06-03 Thread Michael Haggerty
e refs refs: make lock generic refs: implement iteration over only per-worktree refs Michael Haggerty (28): resolve_gitlink_ref(): eliminate temporary variable refs: rename struct ref_cache to files_ref_store refs: create a base class "ref_store" for files_ref_store add_packed_r

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

2016-06-03 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 12/38] resolve_packed_ref(): rename function from resolve_missing_loose_ref()

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 50bfe97..b54355d 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1333,10 +1333,9 @@ static

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

2016-06-03 Thread Michael Haggerty
Reference backends will be able to customize this function to implement reference reading. Signed-off-by: Michael Haggerty --- refs.c | 4 ++-- refs/files-backend.c | 14 -- refs/refs-internal.h | 36 +++- 3 files changed, 29 insertions

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

2016-06-03 Thread Michael Haggerty
And make the function work for submodules. Signed-off-by: Michael Haggerty --- 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 b/refs.c index 904e758

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

2016-06-03 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 --- refs/files-backend.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/refs/files

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

2016-06-03 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 --- refs.c | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/refs.c b/refs.c index 5e0

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

2016-06-03 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 --- refs.c | 9 + refs/files-backend.c | 10 ++ refs/refs-internal.h | 5 + 3 files

[PATCH 11/38] refs: reorder definitions

2016-06-03 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 --- refs/files-backend.c | 166 +-- 1 file changed, 83 insertions(+), 83 deletions

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

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- 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 36bf128..2f9d79a 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1387,7 +1387,7 @@ static int

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

2016-06-03 Thread Michael Haggerty
to hold the reference caches. So let's treat ref_caches as embryo ref_stores, and build them out from there. As the first step, simply rename `ref_cache` to `files_ref_store`, and rename some functions and attributes correspondingly. Signed-off-by: Michael Haggerty --- refs/files-backend.c

[PATCH v2 07/13] entry_resolves_to_object(): rename function from ref_resolves_to_object()

2016-06-03 Thread Michael Haggerty
Free up the old name for a more general purpose. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 142c977..1a46f32 100644 --- a/refs/files-backend.c +++ b/refs

[PATCH v2 02/13] do_for_each_ref(): move docstring to the header file

2016-06-03 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 9 - refs/refs-internal.h | 10 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 1230dfb..68db3e8 100644 --- a/refs/files-backend.c +++ b/refs/files

[PATCH v2 06/13] get_ref_cache(): only create an instance if there is a submodule

2016-06-03 Thread Michael Haggerty
If there is not a nonbare repository where a submodule is supposedly located, then don't instantiate a ref_cache for it. The analogous check can be removed from resolve_gitlink_ref(). Signed-off-by: Michael Haggerty --- refs/files-backend.c | 33 ++--- 1

[PATCH v2 00/13] Reference iterators

2016-06-03 Thread Michael Haggerty
tHub repo [2] as branch "ref-iterators". Michael [1] http://thread.gmane.org/gmane.comp.version-control.git/295860 [2] https://github.com/mhagger/git Michael Haggerty (13): refs: remove unnecessary "extern" keywords do_for_each_ref(): move docstring to the header file refs: use

[PATCH v2 05/13] remote rm: handle symbolic refs correctly

2016-06-03 Thread Michael Haggerty
option set to REF_NODEREF. Signed-off-by: Michael Haggerty --- builtin/remote.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index 1bbf9b4..c4b4d67 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -539,10 +539,6 @@ static int

[PATCH v2 09/13] refs: introduce an iterator interface

2016-06-03 Thread Michael Haggerty
trees and possibly other types of iterators in the future. Signed-off-by: Michael Haggerty --- Makefile | 1 + iterator.h | 81 refs.h | 4 +- refs/files-backend.c | 281 +

[PATCH v2 12/13] dir_iterator: new API for iterating over a directory tree

2016-06-03 Thread Michael Haggerty
. Signed-off-by: Michael Haggerty --- Makefile | 1 + dir-iterator.c | 185 + dir-iterator.h | 86 +++ 3 files changed, 272 insertions(+) create mode 100644 dir-iterator.c create mode 100644 dir-iterator.h

[PATCH v2 04/13] delete_refs(): add a flags argument

2016-06-03 Thread Michael Haggerty
This will be useful for passing REF_NODEREF through. Signed-off-by: Michael Haggerty --- builtin/fetch.c | 2 +- builtin/remote.c | 4 ++-- refs.h | 5 +++-- refs/files-backend.c | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/builtin/fetch.c b

[PATCH v2 08/13] ref_resolves_to_object(): new function

2016-06-03 Thread Michael Haggerty
Extract new function ref_resolves_to_object() from entry_resolves_to_object(). It can be used even if there is no ref_entry at hand. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 33 +++-- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a

[PATCH v2 10/13] do_for_each_ref(): reimplement using reference iteration

2016-06-03 Thread Michael Haggerty
ation in a more straightforward manner. If we rewrite all callers to use the reference iteration API, then we can remove the current_ref_iter hack permanently. Signed-off-by: Michael Haggerty --- refs.c | 20 + refs/files-backend.c | 206 ++

[PATCH v2 03/13] refs: use name "prefix" consistently

2016-06-03 Thread Michael Haggerty
In the context of the for_each_ref() functions, call the prefix that references must start with "prefix". (In some places it was called "base".) This is clearer, and also prevents confusion with another planned use of the word "base". Signed-off-by: Michael Hagge

[PATCH v2 13/13] for_each_reflog(): reimplement using iterators

2016-06-03 Thread Michael Haggerty
fter this patch). Signed-off-by: Michael Haggerty --- refs/files-backend.c | 113 --- refs/refs-internal.h | 7 2 files changed, 78 insertions(+), 42 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index e8dd9d1..36bf1

[PATCH v2 11/13] for_each_reflog(): don't abort for bad references

2016-06-03 Thread Michael Haggerty
es for the purpose of determining object reachability!) and wouldn't benefit from a truncated iteration anyway. So instead, emit an error message and skip the "broken" reflog, but continue with the iteration. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 2 +- 1

[PATCH v2 01/13] refs: remove unnecessary "extern" keywords

2016-06-03 Thread Michael Haggerty
There's continuing work in this area, so clean up unneeded "extern" keywords rather than schlepping them around. Also split up some overlong lines and add parameter names in a couple of places. Signed-off-by: Michael Haggerty --

Re: [PATCH 12/13] dir_iterator: new API for iterating over a directory tree

2016-06-03 Thread Michael Haggerty
On 06/01/2016 02:12 AM, David Turner wrote: > On Mon, 2016-05-30 at 09:55 +0200, Michael Haggerty wrote: >> +struct dir_iterator_level { >> +int initialized; >> + >> +DIR *dir; >> + >> +/* >> + * The length of the directory part of r

Re: [PATCH 09/13] refs: introduce an iterator interface

2016-06-03 Thread Michael Haggerty
On 06/01/2016 01:12 AM, Eric Sunshine wrote: > On Tue, May 31, 2016 at 3:59 AM, Michael Haggerty > wrote: >> On 05/31/2016 07:29 AM, Eric Sunshine wrote: >>> On Mon, May 30, 2016 at 3:55 AM, Michael Haggerty >>> wrote: >>>> +struct r

Re: [PATCH 09/13] refs: introduce an iterator interface

2016-06-02 Thread Michael Haggerty
On 06/02/2016 12:08 PM, Duy Nguyen wrote: > On Mon, May 30, 2016 at 2:55 PM, Michael Haggerty > wrote: >> Currently, the API for iterating over references is via a family of >> for_each_ref()-type functions that invoke a callback function for each >> selected reference.

Re: [RFC/PATCH] Triangular Workflow UI improvement: Documentation

2016-06-02 Thread Michael Haggerty
e it fit better with the rest of the Git documentation, and because having verbatim copies of the same text in two places seems a little bit silly. But that's up to you. Signed-off-by: Michael Haggerty Michael -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH 0/4] Fix prune/gc problem with multiple worktrees

2016-06-02 Thread Michael Haggerty
On 06/02/2016 11:53 AM, Duy Nguyen wrote: > (from patch 4/4 mail) > > On Wed, Jun 1, 2016 at 10:51 PM, Michael Haggerty > wrote: >>> + path = xstrdup(worktree_git_path(wt, "logs/refs/bisect")); >>> + if (file_exists(path)) >>> +

Re: [PATCH 0/2] strbuf: improve API

2016-06-02 Thread Michael Haggerty
On 06/01/2016 11:07 PM, Jeff King wrote: > On Wed, Jun 01, 2016 at 03:42:18AM -0400, Jeff King wrote: > >> I have no idea if those ideas would work. But I wouldn't want to start >> looking into either of them without some idea of how much time we're >> actually spending on strbuf mallocs (or how m

Re: git gc and worktrees

2016-06-01 Thread Michael Haggerty
On 06/01/2016 09:39 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> I argue that the fundamental concept in terms of the implementation >> should be the individual physical reference stores, and these should be >> compounded together to form the logical refer

Re: git gc and worktrees

2016-06-01 Thread Michael Haggerty
On 06/01/2016 05:15 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> I think reference stores are going to need two distinct types of >> reference iteration: one to iterate over the *logical* reference space >> of a single repo or worktree, and one to find all *

Re: [PATCH 4/4] reachable.c: make reachable reflogs for all per-worktree reflogs

2016-06-01 Thread Michael Haggerty
On 06/01/2016 12:45 PM, Nguyễn Thái Ngọc Duy wrote: > [...] > +void add_worktree_reflogs_to_pending(struct rev_info *revs, unsigned flags, > + struct worktree *wt) > +{ > + struct all_refs_cb cb; > + char *path; > + > + cb.all_revs = revs; > + cb.all

Re: git gc and worktrees

2016-06-01 Thread Michael Haggerty
On 06/01/2016 12:14 AM, Jeff King wrote: > [...] > Michael (cc'd) noted to me off-list recently that there may be some > special cases there regarding reflogs in other worktrees (i.e., that we > don't always include them for our reachability checks). I don't know the > details, though. That's corr

Re: [PATCH 09/13] refs: introduce an iterator interface

2016-05-31 Thread Michael Haggerty
On 05/31/2016 08:10 AM, Junio C Hamano wrote: > Michael Haggerty writes: > >> This commit introduces a new iteration primitive for references: a >> ref_iterator. A ref_iterator is a polymorphic object that a reference >> storage backend can be asked to instantiate. T

Re: [PATCH 2/2] strbuf: allow to use preallocated memory

2016-05-31 Thread Michael Haggerty
On 05/31/2016 08:41 AM, Johannes Schindelin wrote: > Hi Michael, > > On Tue, 31 May 2016, Michael Haggerty wrote: > >> On 05/30/2016 02:13 PM, Johannes Schindelin wrote: >>> [...] >>>> @@ -38,7 +67,11 @@ char *strbuf_detach(struct strbuf *sb

Re: [PATCH 09/13] refs: introduce an iterator interface

2016-05-31 Thread Michael Haggerty
On 05/31/2016 07:29 AM, Eric Sunshine wrote: > On Mon, May 30, 2016 at 3:55 AM, Michael Haggerty > wrote: >> [...] > [...] > Either: > > s/false/something other than ITER_OK/ > > or: > > s/false/ITER_DONE or ITER_ERROR/ Thanks. >> +in

Re: [RFC/PATCH] bisect--helper: `bisect_clean_state` shell function in C

2016-05-30 Thread Michael Haggerty
On 05/30/2016 08:21 PM, Pranit Bauva wrote: > Reimplement `bisect_clean_state` shell function in C and add a > `bisect-clean-state` subcommand to `git bisect--helper` to call it from > git-bisect.sh . > > Using `bisect_clean_state` subcommand is a measure to port shell > function to C so as to use

Re: [PATCH 2/2] strbuf: allow to use preallocated memory

2016-05-30 Thread Michael Haggerty
On 05/30/2016 02:52 PM, Matthieu Moy wrote: > [...] I feel bad bikeshedding about names, especially since you took some of the original names from my RFC. But names are very important, so I think it's worth considering whether the current names could be improved upon. When reading this patch seri

Re: [PATCH 2/2] strbuf: allow to use preallocated memory

2016-05-30 Thread Michael Haggerty
On 05/30/2016 02:13 PM, Johannes Schindelin wrote: > [...] >> @@ -38,7 +67,11 @@ char *strbuf_detach(struct strbuf *sb, size_t *sz) >> { >> char *res; >> strbuf_grow(sb, 0); >> -res = sb->buf; >> +if (sb->flags & STRBUF_OWNS_MEMORY) >> +res = sb->buf; >> +else >>

Re: [PATCH 1/2] strbuf: add tests

2016-05-30 Thread Michael Haggerty
Hi, Cool that you are working on this! See my comments below. On 05/30/2016 12:36 PM, William Duclot wrote: > Test the strbuf API. Being used throughout all Git the API could be > considered tested, but adding specific tests makes it easier to improve > and extend the API. > --- > Makefile

Re: [PATCH 09/13] refs: introduce an iterator interface

2016-05-30 Thread Michael Haggerty
On 05/30/2016 06:57 PM, Ramsay Jones wrote: > > > On 30/05/16 16:22, Ramsay Jones wrote: >> >> >> On 30/05/16 08:55, Michael Haggerty wrote: >> [snip] >> >>> /* Reference is a symbolic reference. */ >>> diff --git a/refs/files-backend.c

[PATCH 05/13] remote rm: handle symbolic refs correctly

2016-05-30 Thread Michael Haggerty
option set to REF_NODEREF. Signed-off-by: Michael Haggerty --- builtin/remote.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/builtin/remote.c b/builtin/remote.c index 1bbf9b4..c4b4d67 100644 --- a/builtin/remote.c +++ b/builtin/remote.c @@ -539,10 +539,6 @@ static int

[PATCH 02/13] do_for_each_ref(): move docstring to the header file

2016-05-30 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 9 - refs/refs-internal.h | 10 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 1230dfb..68db3e8 100644 --- a/refs/files-backend.c +++ b/refs/files

[PATCH 09/13] refs: introduce an iterator interface

2016-05-30 Thread Michael Haggerty
trees and possibly other types of iterators in the future. Signed-off-by: Michael Haggerty --- Makefile | 1 + iterator.h | 81 refs.h | 4 +- refs/files-backend.c | 282 ++

[PATCH 04/13] delete_refs(): add a flags argument

2016-05-30 Thread Michael Haggerty
This will be useful for passing REF_NODEREF through. Signed-off-by: Michael Haggerty --- builtin/fetch.c | 2 +- builtin/remote.c | 4 ++-- refs.h | 5 +++-- refs/files-backend.c | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/builtin/fetch.c b

[PATCH 03/13] refs: use name "prefix" consistently

2016-05-30 Thread Michael Haggerty
In the context of the for_each_ref() functions, call the prefix that references must start with "prefix". (In some places it was called "base".) This is clearer, and also prevents confusion with another planned use of the word "base". Signed-off-by: Michael Hagge

[PATCH 01/13] refs: remove unnecessary "extern" keywords

2016-05-30 Thread Michael Haggerty
There's continuing work in this area, so clean up unneeded "extern" keywords rather than schlepping them around. Also split up some overlong lines and add parameter names in a couple of places. Signed-off-by: Michael Haggerty --

[PATCH 10/13] do_for_each_ref(): reimplement using reference iteration

2016-05-30 Thread Michael Haggerty
ation in a more straightforward manner. If we rewrite all callers to use the reference iteration API, then we can remove the current_ref_iter hack permanently. Signed-off-by: Michael Haggerty --- refs.c | 20 + refs/files-backend.c | 206 ++

[PATCH 06/13] get_ref_cache(): only create an instance if there is a submodule

2016-05-30 Thread Michael Haggerty
If there is not a nonbare repository where a submodule is supposedly located, then don't instantiate a ref_cache for it. The analogous check can be removed from resolve_gitlink_ref(). Signed-off-by: Michael Haggerty --- This doesn't actually reduce the number of ref_cache instances ge

[PATCH 08/13] ref_resolves_to_object(): new function

2016-05-30 Thread Michael Haggerty
Extract new function ref_resolves_to_object() from entry_resolves_to_object(). It can be used even if there is no ref_entry at hand. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 33 +++-- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a

[PATCH 11/13] for_each_reflog(): don't abort for bad references

2016-05-30 Thread Michael Haggerty
es for the purpose of determining object reachability!) and wouldn't benefit from a truncated iteration anyway. So instead, emit an error message and skip the "broken" reflog, but continue with the iteration. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 2 +- 1

[PATCH 00/13] Reference iterators

2016-05-30 Thread Michael Haggerty
f these changes, but I will work on that next. Michael [1] http://thread.gmane.org/gmane.comp.version-control.git/290409 [2] http://mid.gmane.org/89634d216544d1102dafd5d18247bff2581d48a8.1464537050.git.mhag...@alum.mit.edu [3] https://github.com/mhagger/git Michael Haggerty (13): refs: remove un

[PATCH 12/13] dir_iterator: new API for iterating over a directory tree

2016-05-30 Thread Michael Haggerty
. Signed-off-by: Michael Haggerty --- Makefile | 1 + dir-iterator.c | 180 + dir-iterator.h | 86 +++ 3 files changed, 267 insertions(+) create mode 100644 dir-iterator.c create mode 100644 dir-iterator.h

[PATCH 13/13] for_each_reflog(): reimplement using iterators

2016-05-30 Thread Michael Haggerty
fter this patch). Signed-off-by: Michael Haggerty --- refs/files-backend.c | 113 --- refs/refs-internal.h | 7 2 files changed, 78 insertions(+), 42 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index a7cc0e2..2e0d0

[PATCH 07/13] entry_resolves_to_object(): rename function from ref_resolves_to_object()

2016-05-30 Thread Michael Haggerty
Free up the old name for a more general purpose. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 142c977..1a46f32 100644 --- a/refs/files-backend.c +++ b/refs

[PATCH v3 29/33] refs: resolve symbolic refs first

2016-05-13 Thread Michael Haggerty
flogs for symbolic references if there is a concurrent update by another process, since the old_oid of a symref is determined before the lock on the pointed-to ref is held. Both problems will soon be fixed. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Mi

Re: [PATCH v2 29/33] refs: resolve symbolic refs first

2016-05-13 Thread Michael Haggerty
On 05/12/2016 10:25 AM, Jeff King wrote: > On Thu, May 12, 2016 at 03:45:28AM -0400, Jeff King wrote: > >> So I'd expect us to hit that lock_ref_for_update() for each of the new >> refs. But then we end up in verify_refname_available_dir(), which wants >> to read all of the loose refs again. So we

Re: [PATCH v2 00/33] Yet more preparation for reference backends

2016-05-09 Thread Michael Haggerty
On 05/09/2016 11:05 PM, Junio C Hamano wrote: > David Turner writes: >> [...] >> I generally like to put the bug fixes before the tests for those fixes >> (so that bisect on the complete suite works). But maybe the git policy >> is different. > > The Git policy only asks not to break bisection.

[PATCH v2 33/33] lock_ref_sha1_basic(): only handle REF_NODEREF mode

2016-05-06 Thread Michael Haggerty
_lock::orig_ref_name * Remove local variable orig_refname from lock_ref_sha1_basic() * ref_name can be initialize once and its value reused * commit_ref_update() never has to write to the reflog for lock->orig_ref_name Signed-off-by: Michael Haggerty --- refs/files-backen

[PATCH v2 22/33] refs: allow log-only updates

2016-05-06 Thread Michael Haggerty
From: David Turner The refs infrastructure learns about log-only ref updates, which only update the reflog. Later, we will use this to separate symbolic reference resolution from ref updating. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty

[PATCH v2 20/33] ref_transaction_commit(): correctly report close_ref() failure

2016-05-06 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/refs/files-backend.c b/refs/files-backend.c index 7cc680a..f4f7953 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -3139,6 +3139,7 @@ int ref_transaction_commit(struct

[PATCH v2 30/33] lock_ref_for_update(): don't re-read non-symbolic references

2016-05-06 Thread Michael Haggerty
e the read_ref_full() call into the (update->type & REF_ISSYMREF) block. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 52 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/refs/files-backend.c b/refs/files-bac

[PATCH v2 11/33] ref_transaction_commit(): remove local variable n

2016-05-06 Thread Michael Haggerty
ff-by: Michael Haggerty --- refs/files-backend.c | 20 +--- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 80d346f..93a94af 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -3076,7 +3076,6 @

[PATCH v2 19/33] ref_transaction_create(): disallow recursive pruning

2016-05-06 Thread Michael Haggerty
It is nonsensical (and a little bit dangerous) to use REF_ISPRUNING without REF_NODEREF. Forbid it explicitly. Change the one REF_ISPRUNING caller to pass REF_NODEREF too. Signed-off-by: Michael Haggerty --- refs.c | 3 +++ refs/files-backend.c | 2 +- refs/refs-internal.h | 2

[PATCH v2 10/33] rename_ref(): remove unneeded local variable

2016-05-06 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 2d3a8c6..80d346f 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2360,20 +2360,17 @@ int

[PATCH v2 26/33] lock_ref_for_update(): new function

2016-05-06 Thread Michael Haggerty
Extract a new function, lock_ref_for_update(), from ref_transaction_commit(). Signed-off-by: Michael Haggerty --- refs/files-backend.c | 152 --- 1 file changed, 85 insertions(+), 67 deletions(-) diff --git a/refs/files-backend.c b/refs/files

[PATCH v2 14/33] read_raw_ref(): rename symref argument to referent

2016-05-06 Thread Michael Haggerty
After all, it doesn't hold the symbolic reference, but rather the reference referred to. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 21 +++-- refs/refs-internal.h | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/refs/files-backen

[PATCH v2 16/33] read_raw_ref(): move docstring to header file

2016-05-06 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 38 -- refs/refs-internal.h | 38 ++ 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 73717dd

[PATCH v2 21/33] delete_branches(): use resolve_refdup()

2016-05-06 Thread Michael Haggerty
The return value of resolve_ref_unsafe() is not guaranteed to stay around as long as we need it, so use resolve_refdup() instead. Signed-off-by: Michael Haggerty --- builtin/branch.c | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/builtin/branch.c b

[PATCH v2 02/33] commit_ref(): if there is an empty dir in the way, delete it

2016-05-06 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 24 1 file changed, 24 insertions(+) diff --git a/refs/files-backend.c b/refs/files-backend.c index 1f38076..ad9cd86 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2457,6 +2457,30 @@ static int

[PATCH v2 09/33] commit_ref_update(): write error message to *err, not stderr

2016-05-06 Thread Michael Haggerty
Signed-off-by: Michael Haggerty --- refs/files-backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 0cc116d..2d3a8c6 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -2719,7 +2719,7 @@ static int

[PATCH v2 18/33] refs: make error messages more consistent

2016-05-06 Thread Michael Haggerty
* Always start error messages with a lower-case letter. * Always enclose reference names in single quotes. Signed-off-by: Michael Haggerty --- refs.c| 8 refs/files-backend.c | 32 t/t1400-update-ref.sh | 4 ++-- 3 files changed, 22

[PATCH v2 17/33] lock_ref_sha1_basic(): remove unneeded local variable

2016-05-06 Thread Michael Haggerty
resolve_ref_unsafe() can cope with being called with NULL passed to its flags argument. So lock_ref_sha1_basic() can just hand its own type parameter through. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a

[PATCH v2 08/33] refname_is_safe(): insist that the refname already be normalized

2016-05-06 Thread Michael Haggerty
The reference name is going to be compared to other reference names, so it should be in its normalized form. Signed-off-by: Michael Haggerty --- refs.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index ca0280f..b18d995 100644 --- a/refs.c +++ b

[PATCH v2 31/33] lock_ref_for_update(): don't resolve symrefs

2016-05-06 Thread Michael Haggerty
in the old code, the old_sha1 of the symref was resolved before the reference that it pointed at was locked. So it was possible that the old_sha1 value logged to the symref's reflog could be wrong if another process changed the downstream reference before it was locked. Signed-off-by: Michael

[PATCH v2 25/33] add_update(): initialize the whole ref_update

2016-05-06 Thread Michael Haggerty
Change add_update() to initialize all of the fields in the new ref_update object. Rename the function to ref_transaction_add_update(), and increase its visibility to all of the refs-related code. All of this makes the function more useful for other future callers. Signed-off-by: Michael Haggerty

[PATCH v2 32/33] commit_ref_update(): remove the flags parameter

2016-05-06 Thread Michael Haggerty
commit_ref_update() is now only called with flags=0. So remove the flags parameter entirely. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 08ec293

[PATCH v2 28/33] ref_transaction_update(): check refname_is_safe() at a minimum

2016-05-06 Thread Michael Haggerty
If the user has asked that a new value be set for a reference, we use check_refname_format() to verify that the reference name satisfies all of the rules. But in other cases, at least check that refname_is_safe(). Signed-off-by: Michael Haggerty --- refs.c | 5 +++-- t/t1400

[PATCH v2 29/33] refs: resolve symbolic refs first

2016-05-06 Thread Michael Haggerty
flogs for symbolic references if there is a concurrent update by another process, since the old_oid of a symref is determined before the lock on the pointed-to ref is held. Both problems will soon be fixed. Signed-off-by: David Turner Signed-off-by: Junio C Hamano Signed-off-by: Mi

[PATCH v2 24/33] verify_refname_available(): adjust constness in declaration

2016-05-06 Thread Michael Haggerty
The two string_list arguments can be const. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 4 ++-- refs/refs-internal.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index ad53b6e..f0eef9e 100644 --- a/refs/files

[PATCH v2 15/33] read_raw_ref(): improve docstring

2016-05-06 Thread Michael Haggerty
Among other things, document the (important!) requirement that input refname be checked for safety before calling this function. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 41 - 1 file changed, 24 insertions(+), 17 deletions(-) diff --git

[PATCH v2 13/33] read_raw_ref(): clear *type at start of function

2016-05-06 Thread Michael Haggerty
This is more convenient and less error-prone for callers. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 1 + 1 file changed, 1 insertion(+) diff --git a/refs/files-backend.c b/refs/files-backend.c index fa8bbd6..8ced104 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c

<    5   6   7   8   9   10   11   12   13   14   >