Re: [PATCH v2] t: make many tests depend less on the refs being files

2018-05-25 Thread Michael Haggerty
On 05/23/2018 07:25 AM, Christian Couder wrote: > From: David Turner > > Many tests are very focused on the file system representation of the > loose and packed refs code. As there are plans to implement other > ref storage systems, let's migrate these tests to a form that test > the intent of th

Re: [PATCH v2] t: make many tests depend less on the refs being files

2018-05-25 Thread Michael Haggerty
On Fri, May 25, 2018 at 10:59 AM, Jeff King wrote: > On Fri, May 25, 2018 at 10:48:04AM +0200, Michael Haggerty wrote: > >> > test_expect_success "multi-fetch works off a 'clean' repository" ' >> > - rm -r "$GIT_DIR/svn" "$GIT_DI

Re: [PATCH] t990X: use '.git/objects' as 'deep inside .git' path

2018-05-26 Thread Michael Haggerty
On Sat, May 26, 2018 at 8:47 AM, Christian Couder wrote: > Tests t9902-completion.sh and t9903-bash-prompt.sh each have tests > that check what happens when we are "in the '.git' directory" and > when we are "deep inside the '.git' directory". > > To test the case when we are "deep inside the '.gi

Re: [PATCH 1/3] refs/packed-backend.c: close fd of empty file

2018-05-31 Thread Michael Haggerty
On Wed, May 30, 2018 at 7:03 PM, Stefan Beller wrote: > Signed-off-by: Stefan Beller > --- > > This was an oversight in 01caf20d57a (load_contents(): don't try to mmap an > empty file, 2018-01-24). > > This and the following 2 patches apply on master. > > refs/packed-backend.c | 1 + > 1 file ch

Re: [PATCH v2 25/25] cache_ref_iterator_begin(): avoid priming unneeded directories

2017-05-24 Thread Michael Haggerty
On 05/23/2017 09:45 PM, Jeff King wrote: > On Mon, May 22, 2017 at 04:17:55PM +0200, Michael Haggerty wrote: > >> So: >> >> * Move the responsibility for doing the prefix check directly to >> `cache_ref_iterator`. This means that `cache_ref_iterator_begin()` >

Re: What's cooking in git.git (Jun 2017, #03; Mon, 5)

2017-06-06 Thread Michael Haggerty
On Mon, Jun 5, 2017 at 8:23 PM, Stefan Beller wrote: > > > [...] > > "git diff" has been taught to optionally paint new lines that are > > the same as deleted lines elsewhere differently from genuinely new > > lines. > > > > Are we happy with these changes? I've been studiously ignoring this

[PATCH 1/1] lock_packed_refs(): fix cache validity check

2017-06-12 Thread Michael Haggerty
_packed_ref_cache()` to call the new function, but only if the lock *isn't* held. * Change `lock_packed_refs()` to call the new function in any case before calling `get_packed_ref_cache()`. * Fix the comment in `lock_packed_refs()`. Signed-off-by: Michael Haggerty --- If anybody i

[PATCH 0/1] Fix for mh/packed-ref-store-prep

2017-06-12 Thread Michael Haggerty
applies on top of mh/packed-ref-store-prep and merges to master without problems. Michael Michael Haggerty (1): lock_packed_refs(): fix cache validity check refs/files-backend.c | 32 +++- 1 file changed, 23 insertions(+), 9 deletions(-) -- 2.11.0

Re: [BUG] b9c8e7f2fb6e breaks git bisect visualize

2017-06-14 Thread Michael Haggerty
On 06/14/2017 02:06 AM, Øyvind A. Holm wrote: > Commit b9c8e7f2fb6e ("prefix_ref_iterator: don't trim too much") breaks > git bisect visualize, this reproduces the bug: > > $ git bisect start > $ git bisect bad > $ git bisect good HEAD^^ > $ git bisect visualize > fatal: BUG: attempt to

[PATCH 2/2] prefix_ref_iterator_advance(): relax the check of trim length

2017-06-14 Thread Michael Haggerty
continue to refuse to trim *more* characters than the refname contains, as that really makes no sense. Signed-off-by: Michael Haggerty --- refs/iterator.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/refs/iterator.c b/refs/iterator.c index 4cf449ef66..de52d5fe93 100644

[PATCH 0/2] Fix a refname trimming problem in `log --bisect`

2017-06-14 Thread Michael Haggerty
old behavior, patch 2 is my suggestion for how to do it. This patch series can be applied on top of branch `mh/packed-ref-store-prep`, but it also applies cleanly to master. It is also available as branch `fix-bisect-trim-check` from my GitHub fork [1]. Michael [1] https://github.com/mhagge

[PATCH 1/2] for_each_bisect_ref(): don't trim refnames

2017-06-14 Thread Michael Haggerty
ce names. So * Add a new function, `for_each_fullref_in_submodule()`, to the refs API. * Change `for_each_bad_bisect_ref()` to call the new function rather than `for_each_ref_in_submodule()`. Signed-off-by: Michael Haggerty --- refs.c | 12 refs.h | 5 - revision.c

[PATCH 00/28] Create a reference backend for packed refs

2017-06-15 Thread Michael Haggerty
-refs-store-prep: * lock_packed_refs(): fix cache validity check * for_each_bisect_ref(): don't trim refnames The patches can also be obtained from my GitHub fork [2] as branch "packed-ref-store". Michael [1] http://public-inbox.org/git/cover.1490026594.git.mhag...@alum.

[PATCH 01/28] add_packed_ref(): teach function to overwrite existing refs

2017-06-15 Thread Michael Haggerty
: Michael Haggerty --- refs/files-backend.c | 40 ++-- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index b040bb3b0a..87cecde231 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -413,15

[PATCH 03/28] packed_ref_store: move `packed_refs_path` here

2017-06-15 Thread Michael Haggerty
Move `packed_refs_path` from `files_ref_store` to `packed_ref_store`, and rename it to `path` since its meaning is clear from its new context. Inline `files_packed_refs_path()`. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 25 - 1 file changed, 12

[PATCH 07/28] get_packed_ref_cache(): take a `packed_ref_store *` parameter

2017-06-15 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index f061506bf0..b2ef7b3bb9

[PATCH 09/28] add_packed_ref(): take a `packed_ref_store *` parameter

2017-06-15 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index bc5c0de84e..4943207098 100644 --- a/refs

[PATCH 08/28] get_packed_refs(): take a `packed_ref_store *` parameter

2017-06-15 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index b2ef7b3bb9..bc5c0de84e 100644 --- a/refs

[PATCH 04/28] packed_ref_store: move `packed_refs_lock` member here

2017-06-15 Thread Michael Haggerty
Move the `packed_refs_lock` member from `files_ref_store` to `packed_ref_store`, and rename it to `lock` since it's now more obvious what it is locking. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 31 --- 1 file changed, 16 insertions(+), 15 dele

[PATCH 16/28] packed_ref_store: support iteration

2017-06-15 Thread Michael Haggerty
Add the infrastructure to iterate over a `packed_ref_store`. It's a lot of boilerplate, but it's all part of a campaign to make `packed_ref_store` implement `ref_store`. In the future, this iterator will work much differently. Signed-off-by: Michael Haggerty --- refs/files-backe

[PATCH 10/28] lock_packed_refs(): take a `packed_ref_store *` parameter

2017-06-15 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 31 ++- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 4943207098..0d8f39089f

[PATCH 15/28] packed_peel_ref(): new function, extracted from `files_peel_ref()`

2017-06-15 Thread Michael Haggerty
This will later become a method of `packed_ref_store`. Signed-off-by: Michael Haggerty --- 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 c206791b91..185d05e1d6 100644 --- a

[PATCH 21/28] commit_packed_refs(): use a staging file separate from the lockfile

2017-06-15 Thread Michael Haggerty
shortly. Signed-off-by: Michael Haggerty --- refs/packed-backend.c | 40 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/refs/packed-backend.c b/refs/packed-backend.c index 5bee49d497..6619052e96 100644 --- a/refs/packed-backend.c +++ b/refs

[PATCH 22/28] packed_refs_lock(): function renamed from lock_packed_refs()

2017-06-15 Thread Michael Haggerty
Rename `lock_packed_refs()` to `packed_refs_lock()` for consistency with how other methods are named. Also, it's about to get some companions. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 4 ++-- refs/packed-backend.c | 10 +- refs/packed-backend.h | 2 +- 3

[PATCH 20/28] commit_packed_refs(): report errors rather than dying

2017-06-15 Thread Michael Haggerty
Report errors via a `struct strbuf *err` rather than by calling `die()`. To enable this goal, change `write_packed_entry()` to report errors via a return value and `errno` rather than dying. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 10 +++--- refs/packed-backend.c | 85

[PATCH 11/28] commit_packed_refs(): take a `packed_ref_store *` parameter

2017-06-15 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 0d8f39089f..5d159620f0 100644 --- a

[PATCH 14/28] repack_without_refs(): take a `packed_ref_store *` parameter

2017-06-15 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 2b9d93d3b6..c206791b91 100644

[PATCH 13/28] get_packed_ref(): take a `packed_ref_store *` parameter

2017-06-15 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. 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 a08d3fbadf..2b9d93d3b6 100644 --- a/refs

[PATCH 19/28] packed_ref_store: make class into a subclass of `ref_store`

2017-06-15 Thread Michael Haggerty
implemented (e.g., those having to do with symrefs or reflogs). Signed-off-by: Michael Haggerty --- refs/files-backend.c | 16 ++-- refs/packed-backend.c | 231 +- refs/packed-backend.h | 23 ++--- refs/refs-internal.h | 1 + 4 files changed

[PATCH 24/28] packed_refs_unlock(), packed_refs_is_locked(): new functions

2017-06-15 Thread Michael Haggerty
Add two new public functions, `packed_refs_unlock()` and `packed_refs_is_locked()`, with which callers can manage and query the `packed-refs` lock externally. Call `packed_refs_unlock()` from `commit_packed_refs()` and `rollback_packed_refs()`. Signed-off-by: Michael Haggerty --- refs/packed

[PATCH 17/28] packed_read_raw_ref(): new function, replacing `resolve_packed_ref()`

2017-06-15 Thread Michael Haggerty
Add a new function, `packed_read_raw_ref()`, which is nearly a `read_raw_ref_fn`. Use it in place of `resolve_packed_ref()`. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 36 +--- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/refs

[PATCH 18/28] packed-backend: new module for handling packed references

2017-06-15 Thread Michael Haggerty
mit moves code around and adjusts its visibility, but doesn't change anything. Signed-off-by: Michael Haggerty --- Makefile | 1 + refs.c| 18 ++ refs/files-backend.c | 640 +

[PATCH 26/28] commit_packed_refs(): remove call to `packed_refs_unlock()`

2017-06-15 Thread Michael Haggerty
Instead, change the callers of `commit_packed_refs()` to call `packed_refs_unlock()`. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 2 ++ refs/packed-backend.c | 18 -- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/refs/files-backend.c b/refs

[PATCH 28/28] read_packed_refs(): die if `packed-refs` contains bogus data

2017-06-15 Thread Michael Haggerty
The old code ignored any lines that it didn't understand. This is dangerous. Instead, `die()` if the `packed-refs` file contains any lines that we don't know how to handle. Signed-off-by: Michael Haggerty --- refs/packed-backend.c | 6 +++--- 1 file changed, 3 insertions(+), 3

[PATCH 06/28] validate_packed_ref_cache(): take a `packed_ref_store *` parameter

2017-06-15 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 2b0db60b2b..f061506bf0 100644 --- a/refs

[PATCH 02/28] packed_ref_store: new struct

2017-06-15 Thread Michael Haggerty
Start extracting the packed-refs-related data structures into a new class, `packed_ref_store`. It doesn't yet implement `ref_store`, but it will. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 42 +- 1 file changed, 33 insertions(

[PATCH 27/28] repack_without_refs(): don't lock or unlock the packed refs

2017-06-15 Thread Michael Haggerty
will eventually make it possible to fix some longstanding races. The only semantic change here is that `repack_without_refs()` used to forgot to release the lock in the `if (!removed)` exit path. That omission is now fixed. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 47

[PATCH 12/28] rollback_packed_refs(): take a `packed_ref_store *` parameter

2017-06-15 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 5d159620f0..a08d3fbadf 100644 --- a

[PATCH 05/28] clear_packed_ref_cache(): take a `packed_ref_store *` parameter

2017-06-15 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index de8293493f..2b0db60b2b 100644 --- a

[PATCH 23/28] packed_refs_lock(): report errors via a `struct strbuf *err`

2017-06-15 Thread Michael Haggerty
That way the callers don't have to come up with error messages themselves. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 6 ++ refs/packed-backend.c | 17 +++-- refs/packed-backend.h | 6 +++--- 3 files changed, 16 insertions(+), 13 deletions(-) diff --

[PATCH 25/28] clear_packed_ref_cache(): don't protest if the lock is held

2017-06-15 Thread Michael Haggerty
The existing callers already check that the lock isn't held just before calling `clear_packed_ref_cache()`, and in the near future we want to be able to call this function when the lock is held. Signed-off-by: Michael Haggerty --- refs/packed-backend.c | 2 -- 1 file changed, 2 dele

Re: [PATCH 04/28] packed_ref_store: move `packed_refs_lock` member here

2017-06-15 Thread Michael Haggerty
On 06/16/2017 07:39 AM, Stefan Beller wrote: > On Thu, Jun 15, 2017 at 7:47 AM, Michael Haggerty > wrote: >> [...] >> @@ -125,7 +125,7 @@ static void clear_packed_ref_cache(struct >> files_ref_store *refs) >> if (refs->packed_ref_store-&g

Re: [PATCH 15/28] packed_peel_ref(): new function, extracted from `files_peel_ref()`

2017-06-15 Thread Michael Haggerty
On 06/16/2017 07:42 AM, Stefan Beller wrote: > On Thu, Jun 15, 2017 at 7:47 AM, Michael Haggerty > wrote: >> This will later become a method of `packed_ref_store`. > > Also while touching it, maybe rename sha1 to object_hash > (not saying object_id as that would be conf

[PATCH v2 0/2] Fix a refname trimming problem in `log --bisect`

2017-06-18 Thread Michael Haggerty
. If it is included, regressions are less likely, but we won't learn about other misuses of the API. I have no strong opinion either way. Michael [1] http://public-inbox.org/git/cover.1497430232.git.mhag...@alum.mit.edu/ Michael Haggerty (2): for_each_bisect_ref(): don't tri

[PATCH v2 2/2] prefix_ref_iterator_advance(): relax the check of trim length

2017-06-18 Thread Michael Haggerty
continue to refuse to trim *more* characters than the refname contains, as that really makes no sense. Signed-off-by: Michael Haggerty --- refs/iterator.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/refs/iterator.c b/refs/iterator.c index 4cf449ef66..de52d5fe93 100644

[PATCH v2 1/2] for_each_bisect_ref(): don't trim refnames

2017-06-18 Thread Michael Haggerty
for_each_ref_in_submodule()`. * Add a test. Signed-off-by: Michael Haggerty Signed-off-by: Jeff King --- refs.c | 12 refs.h | 5 - revision.c | 2 +- t/t6002-rev-list-bisect.sh | 14 ++ 4 files changed, 31 insertions

Re: [PATCH 00/28] Create a reference backend for packed refs

2017-06-22 Thread Michael Haggerty
On 06/19/2017 09:53 PM, Jeff King wrote: > On Mon, Jun 19, 2017 at 03:43:15PM -0400, Jeff King wrote: > Is the iterator over packed-refs correctly skipping over what are covered by loose refs? The entries in the packed-refs file that are superseded by loose refs should be allowed t

[PATCH v2 20/29] packed_ref_store: make class into a subclass of `ref_store`

2017-06-23 Thread Michael Haggerty
implemented (e.g., those having to do with symrefs or reflogs). Signed-off-by: Michael Haggerty --- refs/files-backend.c | 16 ++-- refs/packed-backend.c | 231 +- refs/packed-backend.h | 23 ++--- refs/refs-internal.h | 1 + 4 files changed

[PATCH v2 17/29] packed_ref_store: support iteration

2017-06-23 Thread Michael Haggerty
Add the infrastructure to iterate over a `packed_ref_store`. It's a lot of boilerplate, but it's all part of a campaign to make `packed_ref_store` implement `ref_store`. In the future, this iterator will work much differently. Signed-off-by: Michael Haggerty --- refs/files-backe

[PATCH v2 16/29] packed_peel_ref(): new function, extracted from `files_peel_ref()`

2017-06-23 Thread Michael Haggerty
This will later become a method of `packed_ref_store`. Signed-off-by: Michael Haggerty --- 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 c206791b91..185d05e1d6 100644 --- a

[PATCH v2 02/29] add_packed_ref(): teach function to overwrite existing refs

2017-06-23 Thread Michael Haggerty
: Michael Haggerty --- refs/files-backend.c | 40 ++-- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index b040bb3b0a..87cecde231 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -413,15

[PATCH v2 19/29] packed-backend: new module for handling packed references

2017-06-23 Thread Michael Haggerty
mit moves code around and adjusts its visibility, but doesn't change anything. Signed-off-by: Michael Haggerty --- Makefile | 1 + refs.c| 18 ++ refs/files-backend.c | 640 +

[PATCH v2 21/29] commit_packed_refs(): report errors rather than dying

2017-06-23 Thread Michael Haggerty
Report errors via a `struct strbuf *err` rather than by calling `die()`. To enable this goal, change `write_packed_entry()` to report errors via a return value and `errno` rather than dying. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 10 +++--- refs/packed-backend.c | 85

[PATCH v2 14/29] get_packed_ref(): take a `packed_ref_store *` parameter

2017-06-23 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. 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 a08d3fbadf..2b9d93d3b6 100644 --- a/refs

[PATCH v2 00/29] Create a reference backend for packed refs

2017-06-23 Thread Michael Haggerty
no (1): t1408: add a test of stale packed refs covered by loose refs Michael Haggerty (28): add_packed_ref(): teach function to overwrite existing refs packed_ref_store: new struct packed_ref_store: move `packed_refs_path` here packed_ref_store: move `packed_refs_lock` member here clear_p

[PATCH v2 05/29] packed_ref_store: move `packed_refs_lock` member here

2017-06-23 Thread Michael Haggerty
Move the `packed_refs_lock` member from `files_ref_store` to `packed_ref_store`, and rename it to `lock` since it's now more obvious what it is locking. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 31 --- 1 file changed, 16 insertions(+), 15 dele

[PATCH v2 13/29] rollback_packed_refs(): take a `packed_ref_store *` parameter

2017-06-23 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 5d159620f0..a08d3fbadf 100644 --- a

[PATCH v2 22/29] commit_packed_refs(): use a staging file separate from the lockfile

2017-06-23 Thread Michael Haggerty
shortly. Signed-off-by: Michael Haggerty --- refs/packed-backend.c | 40 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/refs/packed-backend.c b/refs/packed-backend.c index 18ce47fcb7..71f92ed6f0 100644 --- a/refs/packed-backend.c +++ b/refs

[PATCH v2 06/29] clear_packed_ref_cache(): take a `packed_ref_store *` parameter

2017-06-23 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index de8293493f..2b0db60b2b 100644 --- a

[PATCH v2 03/29] packed_ref_store: new struct

2017-06-23 Thread Michael Haggerty
Start extracting the packed-refs-related data structures into a new class, `packed_ref_store`. It doesn't yet implement `ref_store`, but it will. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 42 +- 1 file changed, 33 insertions(

[PATCH v2 24/29] packed_refs_lock(): report errors via a `struct strbuf *err`

2017-06-23 Thread Michael Haggerty
That way the callers don't have to come up with error messages themselves. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 6 ++ refs/packed-backend.c | 17 +++-- refs/packed-backend.h | 6 +++--- 3 files changed, 16 insertions(+), 13 deletions(-) diff --

[PATCH v2 12/29] commit_packed_refs(): take a `packed_ref_store *` parameter

2017-06-23 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 0d8f39089f..5d159620f0 100644 --- a

[PATCH v2 04/29] packed_ref_store: move `packed_refs_path` here

2017-06-23 Thread Michael Haggerty
Move `packed_refs_path` from `files_ref_store` to `packed_ref_store`, and rename it to `path` since its meaning is clear from its new context. Inline `files_packed_refs_path()`. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 25 - 1 file changed, 12

[PATCH v2 09/29] get_packed_refs(): take a `packed_ref_store *` parameter

2017-06-23 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index b2ef7b3bb9..bc5c0de84e 100644 --- a/refs

[PATCH v2 01/29] t1408: add a test of stale packed refs covered by loose refs

2017-06-23 Thread Michael Haggerty
cause problems. Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- t/t1408-packed-refs.sh | 46 ++ 1 file changed, 46 insertions(+) create mode 100755 t/t1408-packed-refs.sh diff --git a/t/t1408-packed-refs.sh b/t/t1408-packed-refs.sh new

[PATCH v2 07/29] validate_packed_ref_cache(): take a `packed_ref_store *` parameter

2017-06-23 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 2b0db60b2b..f061506bf0 100644 --- a/refs

[PATCH v2 10/29] add_packed_ref(): take a `packed_ref_store *` parameter

2017-06-23 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index bc5c0de84e..4943207098 100644 --- a/refs

[PATCH v2 08/29] get_packed_ref_cache(): take a `packed_ref_store *` parameter

2017-06-23 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index f061506bf0..b2ef7b3bb9

[PATCH v2 29/29] read_packed_refs(): die if `packed-refs` contains bogus data

2017-06-23 Thread Michael Haggerty
The old code ignored any lines that it didn't understand. This is dangerous. Instead, `die()` if the `packed-refs` file contains any lines that we don't know how to handle. Signed-off-by: Michael Haggerty --- refs/packed-backend.c | 6 +++--- 1 file changed, 3 insertions(+), 3

[PATCH v2 27/29] commit_packed_refs(): remove call to `packed_refs_unlock()`

2017-06-23 Thread Michael Haggerty
Instead, change the callers of `commit_packed_refs()` to call `packed_refs_unlock()`. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 2 ++ refs/packed-backend.c | 18 -- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/refs/files-backend.c b/refs

[PATCH v2 15/29] repack_without_refs(): take a `packed_ref_store *` parameter

2017-06-23 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 2b9d93d3b6..c206791b91 100644

[PATCH v2 11/29] lock_packed_refs(): take a `packed_ref_store *` parameter

2017-06-23 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 31 ++- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 4943207098..0d8f39089f

[PATCH v2 26/29] clear_packed_ref_cache(): don't protest if the lock is held

2017-06-23 Thread Michael Haggerty
The existing callers already check that the lock isn't held just before calling `clear_packed_ref_cache()`, and in the near future we want to be able to call this function when the lock is held. Signed-off-by: Michael Haggerty --- refs/packed-backend.c | 2 -- 1 file changed, 2 dele

[PATCH v2 28/29] repack_without_refs(): don't lock or unlock the packed refs

2017-06-23 Thread Michael Haggerty
will eventually make it possible to fix some longstanding races. The only semantic change here is that `repack_without_refs()` used to forgot to release the lock in the `if (!removed)` exit path. That omission is now fixed. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 47

[PATCH v2 18/29] packed_read_raw_ref(): new function, replacing `resolve_packed_ref()`

2017-06-23 Thread Michael Haggerty
Add a new function, `packed_read_raw_ref()`, which is nearly a `read_raw_ref_fn`. Use it in place of `resolve_packed_ref()`. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 36 +--- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/refs

[PATCH v2 23/29] packed_refs_lock(): function renamed from lock_packed_refs()

2017-06-23 Thread Michael Haggerty
Rename `lock_packed_refs()` to `packed_refs_lock()` for consistency with how other methods are named. Also, it's about to get some companions. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 4 ++-- refs/packed-backend.c | 10 +- refs/packed-backend.h | 2 +- 3

[PATCH v2 25/29] packed_refs_unlock(), packed_refs_is_locked(): new functions

2017-06-23 Thread Michael Haggerty
Add two new public functions, `packed_refs_unlock()` and `packed_refs_is_locked()`, with which callers can manage and query the `packed-refs` lock externally. Call `packed_refs_unlock()` from `commit_packed_refs()` and `rollback_packed_refs()`. Signed-off-by: Michael Haggerty --- refs/packed

Re: [PATCH v2 00/29] Create a reference backend for packed refs

2017-06-24 Thread Michael Haggerty
On 06/24/2017 03:11 AM, Jeff King wrote: > On Fri, Jun 23, 2017 at 02:47:01PM -0700, Junio C Hamano wrote: > >>> Speculating on my own question. I guess it would prepare us for a day >>> when a possible ref store is to use a packed-refs _without_ loose refs. >>> IOW, the property is defined on pac

Re: [PATCH v2 22/29] commit_packed_refs(): use a staging file separate from the lockfile

2017-06-24 Thread Michael Haggerty
On 06/23/2017 09:46 PM, Jeff King wrote: > On Fri, Jun 23, 2017 at 09:01:40AM +0200, Michael Haggerty wrote: > >> @@ -522,10 +529,16 @@ int lock_packed_refs(struct ref_store *ref_store, int >> flags) >> timeout_configured = 1; >> } >> >

Re: [PATCH v2 28/29] repack_without_refs(): don't lock or unlock the packed refs

2017-07-01 Thread Michael Haggerty
On 06/23/2017 09:56 PM, Jeff King wrote: > On Fri, Jun 23, 2017 at 09:01:46AM +0200, Michael Haggerty wrote: > >> Change `repack_without_refs()` to expect the packed-refs lock to be >> held already, and not to release the lock before returning. Change the >> callers to d

Re: [PATCH v2 29/29] read_packed_refs(): die if `packed-refs` contains bogus data

2017-07-01 Thread Michael Haggerty
On 06/23/2017 09:58 PM, Jeff King wrote: > On Fri, Jun 23, 2017 at 09:01:47AM +0200, Michael Haggerty wrote: > >> The old code ignored any lines that it didn't understand. This is >> dangerous. Instead, `die()` if the `packed-refs` file contains any >> lines tha

[PATCH v3 01/30] t1408: add a test of stale packed refs covered by loose refs

2017-07-01 Thread Michael Haggerty
cause problems. Signed-off-by: Junio C Hamano Signed-off-by: Michael Haggerty --- t/t1408-packed-refs.sh | 42 ++ 1 file changed, 42 insertions(+) create mode 100755 t/t1408-packed-refs.sh diff --git a/t/t1408-packed-refs.sh b/t/t1408-packed-refs.sh new file

[PATCH v3 00/30] Create a reference backend for packed refs

2017-07-01 Thread Michael Haggerty
...@alum.mit.edu/ v2: http://public-inbox.org/git/cover.1498200513.git.mhag...@alum.mit.edu/ [2] https://github.com/mhagger/git Junio C Hamano (1): t1408: add a test of stale packed refs covered by loose refs Michael Haggerty (29): add_packed_ref(): teach function to overwrite existing refs

[PATCH v3 04/30] packed_ref_store: move `packed_refs_path` here

2017-07-01 Thread Michael Haggerty
Move `packed_refs_path` from `files_ref_store` to `packed_ref_store`, and rename it to `path` since its meaning is clear from its new context. Inline `files_packed_refs_path()`. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 25 - 1 file changed, 12

[PATCH v3 09/30] get_packed_refs(): take a `packed_ref_store *` parameter

2017-07-01 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index b2ef7b3bb9..bc5c0de84e 100644 --- a/refs

[PATCH v3 03/30] packed_ref_store: new struct

2017-07-01 Thread Michael Haggerty
Start extracting the packed-refs-related data structures into a new class, `packed_ref_store`. It doesn't yet implement `ref_store`, but it will. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 42 +- 1 file changed, 33 insertions(

[PATCH v3 08/30] get_packed_ref_cache(): take a `packed_ref_store *` parameter

2017-07-01 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 26 -- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index f061506bf0..b2ef7b3bb9

[PATCH v3 10/30] add_packed_ref(): take a `packed_ref_store *` parameter

2017-07-01 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index bc5c0de84e..4943207098 100644 --- a/refs

[PATCH v3 05/30] packed_ref_store: move `packed_refs_lock` member here

2017-07-01 Thread Michael Haggerty
Move the `packed_refs_lock` member from `files_ref_store` to `packed_ref_store`, and rename it to `lock` since it's now more obvious what it is locking. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 31 --- 1 file changed, 16 insertions(+), 15 dele

[PATCH v3 12/30] commit_packed_refs(): take a `packed_ref_store *` parameter

2017-07-01 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 0d8f39089f..5d159620f0 100644 --- a

[PATCH v3 14/30] get_packed_ref(): take a `packed_ref_store *` parameter

2017-07-01 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. 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 a08d3fbadf..2b9d93d3b6 100644 --- a/refs

[PATCH v3 06/30] clear_packed_ref_cache(): take a `packed_ref_store *` parameter

2017-07-01 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index de8293493f..2b0db60b2b 100644 --- a

[PATCH v3 16/30] packed_peel_ref(): new function, extracted from `files_peel_ref()`

2017-07-01 Thread Michael Haggerty
This will later become a method of `packed_ref_store`. Signed-off-by: Michael Haggerty --- 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 c206791b91..185d05e1d6 100644 --- a

[PATCH v3 07/30] validate_packed_ref_cache(): take a `packed_ref_store *` parameter

2017-07-01 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 2b0db60b2b..f061506bf0 100644 --- a/refs

[PATCH v3 15/30] repack_without_refs(): take a `packed_ref_store *` parameter

2017-07-01 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 2b9d93d3b6..c206791b91 100644

[PATCH v3 02/30] add_packed_ref(): teach function to overwrite existing refs

2017-07-01 Thread Michael Haggerty
: Michael Haggerty --- refs/files-backend.c | 40 ++-- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index b040bb3b0a..87cecde231 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -413,15

[PATCH v3 19/30] packed-backend: new module for handling packed references

2017-07-01 Thread Michael Haggerty
mit moves code around and adjusts its visibility, but doesn't change anything. Signed-off-by: Michael Haggerty --- Makefile | 1 + refs.c| 18 ++ refs/files-backend.c | 640 +

[PATCH v3 17/30] packed_ref_store: support iteration

2017-07-01 Thread Michael Haggerty
Add the infrastructure to iterate over a `packed_ref_store`. It's a lot of boilerplate, but it's all part of a campaign to make `packed_ref_store` implement `ref_store`. In the future, this iterator will work much differently. Signed-off-by: Michael Haggerty --- refs/files-backe

[PATCH v3 11/30] lock_packed_refs(): take a `packed_ref_store *` parameter

2017-07-01 Thread Michael Haggerty
It only cares about the packed-refs part of the reference store. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 31 ++- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 4943207098..0d8f39089f

[PATCH v3 20/30] packed_ref_store: make class into a subclass of `ref_store`

2017-07-01 Thread Michael Haggerty
implemented (e.g., those having to do with symrefs or reflogs). Signed-off-by: Michael Haggerty --- refs/files-backend.c | 16 ++-- refs/packed-backend.c | 231 +- refs/packed-backend.h | 23 ++--- refs/refs-internal.h | 1 + 4 files changed

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