[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
x27;re there yet.) I also think it is a good idea to keep the backends' interfaces as similar as possible to reduce the number of quirks that the reader has to keep in mind. Michael

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

Compile Error v2.13.2 on Solaris SPARC

2017-06-26 Thread Michael Kebe
ondetection/commit/33a694a9ee1b79c24be45f9eab5ac0e1aeeaf271 Greetings Michael

Re: Compile Error v2.13.2 on Solaris SPARC

2017-06-26 Thread Michael Kebe
Error 1 Greetings Michael 2017-06-26 10:42 GMT+02:00 Ævar Arnfjörð Bjarmason : > > On Mon, Jun 26 2017, Michael Kebe jotted: > >> When compiling 2.13.2 on Solaris SPARC I get this error: >> >> CC sha1dc/sha1.o >> sha1dc/sha1.c:41:58: error: operator 

Re: Compile Error v2.13.2 on Solaris SPARC

2017-06-26 Thread Michael Kebe
Still no luck, with one or both patches. Greetings Michael 2017-06-26 14:47 GMT+02:00 Ævar Arnfjörð Bjarmason : > > On Mon, Jun 26 2017, Michael Kebe jotted: > >> No luck with the patch. >> >> Still got: >> >> CC sha1dc/sha1.o >> sha1dc/sha1.c:43:

Re: Compile Error v2.13.2 on Solaris SPARC

2017-06-26 Thread Michael Kebe
operand #if ((defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) || \ ^ Running Solaris on sparc: $ uname -a SunOS er202 5.11 11.3 sun4v sparc sun4v The isa_defs.h is available here: https://gist.github.com/michaelkebe/472720cd684b5b2a504b8eeb24049870 Greetings Michael

Re: Compile Error v2.13.2 on Solaris SPARC

2017-06-26 Thread Michael Kebe
5986870d4 What do you think? 2017-06-27 7:41 GMT+02:00 Michael Kebe : > 2017-06-26 22:27 GMT+02:00 Ævar Arnfjörð Bjarmason : >> Could you (or anyone else for that matter) please test it with: >> >> git clone --branch bigend-detect-solaris-again >>

Solaris 11.3 SPARC grep problem with t1450-fsck.sh

2017-06-27 Thread Michael Kebe
t ok 17 - ISO-2022-JP should be shown in UTF-8 now But that's another topic, which I will open once this is fixed. Greetings Michael

Re: Solaris 11.3 SPARC grep problem with t1450-fsck.sh

2017-06-27 Thread Michael Kebe
2017-06-27 18:25 GMT+02:00 Junio C Hamano : > Ah, wait, that particular grep may have GNUism. If you changed it > to > > egrep "$tree \((refs/heads/master|HEAD)@{[0-9]*}:" out > > does it make it pass for you? Yes, this is working. Greetings Michael

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
corruption in packed-refs files, distinguish between unterminated lines and other corruption. * Fixed a typo in a commit message. This patch series can also be obtained from my GitHub fork [2] as branch packed-ref-store. Michael [1] v1: http://public-inbox.org/git/cover.1497534157.git.mhag

[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

[PATCH v3 13/30] rollback_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 | 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 v3 30/30] read_packed_refs(): die if `packed-refs` contains bogus data

2017-07-01 Thread Michael Haggerty
The old code ignored any lines that it didn't understand, including unterminated lines. This is dangerous. Instead, `die()` if the `packed-refs` file contains any unterminated lines or lines that we don't know how to handle. This fixes the tests added in the last commit. Signed-off-b

[PATCH v3 21/30] commit_packed_refs(): report errors rather than dying

2017-07-01 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 v3 18/30] packed_read_raw_ref(): new function, replacing `resolve_packed_ref()`

2017-07-01 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 v3 29/30] t3210: add some tests of bogus packed-refs file contents

2017-07-01 Thread Michael Haggerty
If `packed-refs` contains indecipherable lines, we should emit an error and quit rather than just skipping the lines. Unfortunately, we currently do the latter. Add some failing tests demonstrating the problem. This will be fixed in the next commit. Signed-off-by: Michael Haggerty --- t/t3210

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

2017-07-01 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 v3 22/30] commit_packed_refs(): use a staging file separate from the lockfile

2017-07-01 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 v3 23/30] packed_refs_lock(): function renamed from lock_packed_refs()

2017-07-01 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 v3 24/30] packed_refs_lock(): report errors via a `struct strbuf *err`

2017-07-01 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 v3 28/30] repack_without_refs(): don't lock or unlock the packed refs

2017-07-01 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 forget 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 v3 27/30] commit_packed_refs(): remove call to `packed_refs_unlock()`

2017-07-01 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 v3 25/30] packed_refs_unlock(), packed_refs_is_locked(): new functions

2017-07-01 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: reftable: new ref storage format

2017-07-16 Thread Michael Haggerty
I haven't reviewed your proposal for storing reflogs in reftables in any detail, though I must say that my first reaction is surprise that you want to store reflogs (which are mostly immutable, rarely read, and can be an order of magnitude bigger) in the same files as references. Michael On Wed,

Windows: mintty.exe classified as exploit by AV software

2018-02-07 Thread Ehrt, Michael
e because of this. And as Cylance is not a pattern-based AV, it's not something that will go away by waiting for the next daily update ... Any ideas about this? Thanks Michael

Re: make git diff output easier to read - use better diff heuristics

2018-02-13 Thread Michael Haggerty
ot followed by a line with lesser indentation). Doing significantly better probably would require some amount of language-awareness, but that's a bigger job than I was willing to take on. Michael

Re: [PATCH] sq_dequote: fix extra consumption of source string

2018-02-18 Thread Michael Haggerty
On Wed, Feb 14, 2018 at 12:41 AM, Jeff King wrote: > This fixes a (probably harmless) parsing problem in > sq_dequote_step(), in which we parse some bogus input > incorrectly rather than complaining that it's bogus. > [...] LGTM. Thanks for taking care of this. Michael

Re: [git-sizer] Implications of a large commit object

2018-03-14 Thread Michael Haggerty
this won't cause Git itself any problems, but it's likely to be inconvenient. For example, when you type `git log` and 7 million characters page by. Or when you use some GUI tool to view your history and it performs badly because it wasn't built to handle such enormous commit messages. Michael

[ANNOUNCE] git-sizer: compute various size-related metrics for your Git repository

2018-03-16 Thread Michael Haggerty
implementation in pure Go, was even slower. So the final version of `git-sizer` calls `git` for accessing the repository. Feedback is welcome, including about the weightings [4] that I use to compute the "level of concern" of the various metrics. Have fun, Michael [1] https://github.com/githu

Confusing behavior with ignored submodules and `git commit -a`

2018-03-16 Thread Michael Forney
m 'update foo.txt' [master 6ec564c] update foo.txt 1 file changed, 1 insertion(+), 1 deletion(-) $ git show commit 6ec564c15ddae099c71f01750b4c434557525653 (HEAD -> master) Author: Michael Forney Date: Fri Mar 16 20:18:37 2018 -0700 update foo.txt diff --git a/foo.txt b/foo.txt index

Re: [ANNOUNCE] git-sizer: compute various size-related metrics for your Git repository

2018-03-18 Thread Michael Haggerty
problematic for this reason will have a very large number of tree entries. If you want to detect a bad repository layout like this *before* it becomes a problem, then probably something like "average tree entries per commit" might be a good leading indicator of a problem. Michael

Re: [PATCH v4 1/5] dir_iterator: add helpers to dir_iterator_advance

2017-03-28 Thread Michael Haggerty
truct > dir_iterator_level *level) > +{ > + return --iter->levels_nr; > +} `pop_dir_level()` doesn't use its `level` argument; it can be removed. > [...] Michael

Re: [PATCH v4 2/5] dir_iterator: iterate over dir after its contents

2017-03-29 Thread Michael Haggerty
rator *dir_iterator = &iter->base; > @@ -209,6 +245,8 @@ struct dir_iterator *dir_iterator_begin(const char *path) > if (!path || !*path) > die("BUG: empty path passed to dir_iterator_begin()"); > > + iter->flags = flags; > + > strbuf_init(&iter->base.path, PATH_MAX); > strbuf_addstr(&iter->base.path, path); > > diff --git a/dir-iterator.h b/dir-iterator.h > index 27739e6..28ff3df 100644 > --- a/dir-iterator.h > +++ b/dir-iterator.h > @@ -38,6 +38,13 @@ > * dir_iterator_advance() again. > */ The module docstring just above this hunk needs updating, too. > +/* Possible flags for dir_iterator_begin(). > + * > + * DIR_ITERATOR_DEPTH_FIRST: ensures subdirectories and their contents > + * are iterated through before the containing directory. > + */ > +#define DIR_ITERATOR_DEPTH_FIRST (1 << 1) > + Normally the first constant in a bitset gets the value `(1 << 0)`; i.e., 1. Is there a reason you use 2 here? > [...] Michael

Re: [PATCH v4 3/5] remove_subtree(): reimplement using iterators

2017-03-29 Thread Michael Haggerty
advance(diter) == ITER_OK) { > + if (S_ISDIR(diter->st.st_mode)) { > + if (rmdir(diter->path.buf)) > + die_errno("cannot rmdir '%s'", path->buf); > + } else if (unlink(diter->path.buf)) > die_errno("cannot unlink '%s'", path->buf); The two `die_errno()` calls must be changed to use `diter->path.buf` rather than `path->buf`. > - strbuf_setlen(path, origlen); > } > - closedir(dir); > + > if (rmdir(path->buf)) > die_errno("cannot rmdir '%s'", path->buf); > } Michael

Re: [PATCH v4 5/5] files_reflog_iterator: amend use of dir_iterator

2017-03-29 Thread Michael Haggerty
; + iter->dir_iterator = dir_iterator_begin(git_path("logs"), 0); > return ref_iterator; > } As mentioned earlier, this patch should be squashed into patch [2/5]. Michael

Re: [PATCH v6 18/27] files-backend: replace submodule_allowed check in files_downcast()

2017-03-29 Thread Michael Haggerty
On 03/26/2017 04:16 AM, Duy Nguyen wrote: > On Mon, Mar 20, 2017 at 4:18 AM, Michael Haggerty > wrote: >>> +/* ref_store_init flags */ >>> +#define REF_STORE_READ (1 << 0) >> >> I asked [1] in reply to v5 whether `REF_STORE_READ` is really

Re: [PATCH v4 2/5] dir_iterator: iterate over dir after its contents

2017-03-29 Thread Michael Haggerty
On 03/29/2017 11:56 AM, Michael Haggerty wrote: > On 03/29/2017 02:32 AM, Daniel Ferreira wrote: >> [...] > [...] > The disagreement is not a surprise, because there isn't a corresponding > coding error in the code below that returns the directory itself in a > post-order

Re: [PATCH v4 2/5] dir_iterator: iterate over dir after its contents

2017-03-29 Thread Michael Haggerty
On 03/29/2017 06:46 PM, Junio C Hamano wrote: > Michael Haggerty writes: > >> I also realize that I made a goof in my comments about v3 of this patch >> series. Your new option is not choosing between "depth-first" and >> "breadth-first". Both type

Re: [PATCH v4 2/5] dir_iterator: iterate over dir after its contents

2017-03-29 Thread Michael Haggerty
On 03/30/2017 08:08 AM, Junio C Hamano wrote: > Michael Haggerty writes: > >> I think IN_ORDER really only applies to *binary* trees, not arbitrary >> trees like a filesystem. > > How true. Even if we were giving a sorted output (and dir-iterator > doesn't and

Re: [PATCH v5 4/6] dir_iterator: add tests for dir_iterator API

2017-03-30 Thread Michael Haggerty
d-sorted actual-sorted I also think it would be prudent to run this test twice; once for pre-order and once for post-order traversal. You could use the same directory setup and the same `expected-sorted` file for both tests (e.g., set them up in a preliminary "setup" step). > +' > + > +ITER_POST_ORDER_OUTPUT='[f] (a/b/c/d) ./dir2/a/b/c/d > +[d] (a/b/c) ./dir2/a/b/c > +[d] (a/b) ./dir2/a/b > +[d] (a) ./dir2/a' > + > +test_expect_success 'dir-iterator should list files properly on post-order > mode' ' > + mkdir -p dir2/a/b/c/ && > + date >dir2/a/b/c/d && > + > + test "$(test-dir-iterator ./dir2 --post-order)" == > "$ITER_POST_ORDER_OUTPUT" > +' How about adding a test for pre-order traversal, too? It would look almost identical to this test. > [...] Michael

Re: [PATCH v5 4/6] dir_iterator: add tests for dir_iterator API

2017-03-30 Thread Michael Haggerty
ectory tree and that post-order directory > iteration is correctly implemented. Please also add the compiled test program `test-dir-iterator` to `t/helper/.gitignore`. Michael

Re: [PATCH v5 4/6] dir_iterator: add tests for dir_iterator API

2017-03-30 Thread Michael Haggerty
} > + > + return 0; > +} > [...] Oh I forgot to mention, in the Git project we don't allow declarations to be mixed with code. Apparently there's some ancient compiler somewhere that doesn't allow it. Declarations always have to be together, at the top of a block. (Compile with `-Werror=declaration-after-statement` to detect this.) Michael

Re: [PATCH v5 2/6] dir_iterator: refactor state machine model

2017-03-30 Thread Michael Haggerty
r_level > struct and ease comprehension of the state machine's behavior. Nice. Michael

Re: [PATCH v5 3/6] dir_iterator: iterate over dir after its contents

2017-03-30 Thread Michael Haggerty
return ITER_OK; } } else { level->dir_state = DIR_STATE_ITERATED; } } else if (level->dir_state == DIR_STATE_ITERATED) { if (iter->flags & DIR_ITERATOR_DIRS_AFTER) { ...set iterator data... level->dir_state = DIR_STATE_POST_ITERATED; return ITER_OK; } else { level->dir_state = DIR_STATE_POST_ITERATED; } } else if (level->dir_state == DIR_STATE_POST_ITERATED) { ...pop dir... if (...done...) { break; } } } It's a biggish rewrite (and I'm not implying that you have to do it), but I think the results would be more readable than the current code. Michael

Re: [PATCH v5 6/6] remove_subtree(): test removing nested directories

2017-03-30 Thread Michael Haggerty
ested/paths && > + echo content >path/file1 && > + echo content >path/with/nested/paths/file2 && > + git checkout-index -f -a && > + test ! -d path > +' > + > test_done > It would be better for this patch to precede "remove_subtree(): reimplement using iterators", as a slightly better proof that the change to using iterators doesn't change the behavior. Michael

Re: [PATCH v5 0/6] [GSoC] remove_subtree(): reimplement using iterators

2017-03-30 Thread Michael Haggerty
g/git/1490747533-89143-1-git-send-email-bnm...@gmail.com/T/#e437a63e0c22c00c69b5d92977c9b438ed2b9fd3a > > I would like to really thank Michael for the incredibly thorough review of > the last version of this series. I never expected anyone to give that > level of attention to thi

[PATCH v2 03/20] refs_ref_iterator_begin(): new function

2017-03-31 Thread Michael Haggerty
Extract a new function from `do_for_each_ref()`. It will be useful elsewhere. Signed-off-by: Michael Haggerty --- refs.c | 15 +-- refs/refs-internal.h | 11 +++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index 0ed6c3c7a4

[PATCH v2 01/20] get_ref_dir(): don't call read_loose_refs() for "refs/bisect"

2017-03-31 Thread Michael Haggerty
lazy mechanism, and this time the read was done correctly. This code has been broken since it was first introduced. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/refs/files-backend.c b/refs/files-backend.c index 4242486118..e7a

[PATCH v2 05/20] refs_verify_refname_available(): use function in more places

2017-03-31 Thread Michael Haggerty
(and will be regained later). These were the last callers of `verify_refname_available_dir()`, so also delete that (very complicated) function. Signed-off-by: Michael Haggerty --- refs/files-backend.c | 171 --- 1 file changed, 11 insertions(+)

[PATCH v2 02/20] refs_read_raw_ref(): new function

2017-03-31 Thread Michael Haggerty
Extract a new function from `refs_resolve_ref_unsafe()`. It will be useful elsewhere. Signed-off-by: Michael Haggerty --- refs.c | 11 +-- refs/refs-internal.h | 4 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index 77a39f8b17

[PATCH v2 07/20] ref-cache: rename `find_ref()` to `find_ref_entry()`

2017-03-31 Thread Michael Haggerty
This function's visibility is about to be increased, so give it a more distinctive name. 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 4d579cbdac..6768c

[PATCH v2 15/20] get_loose_ref_dir(): function renamed from get_loose_refs()

2017-03-31 Thread Michael Haggerty
The new name is more analogous to `get_packed_ref_dir()`. 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 0ff5df6b46..0a16f6196c 100644 --- a/refs/files-backend.c

[PATCH v2 00/20] Separate `ref_cache` into a separate module

2017-03-31 Thread Michael Haggerty
les_pack_refs(): use reference iteration This patch series is also available from my GitHub fork [2] as branch "separate-ref-cache". These patches depend on Duy's nd/files-backend-git-dir branch. [1] http://public-inbox.org/git/cover.1490026594.git.mhag...@alum.mit.edu/ [

[PATCH v2 04/20] refs_verify_refname_available(): implement once for all backends

2017-03-31 Thread Michael Haggerty
It turns out that we can now implement `refs_verify_refname_available()` based on the other virtual functions, so there is no need for it to be defined at the backend level. Instead, define it once in `refs.c` and remove the `files_backend` definition. Signed-off-by: Michael Haggerty --- refs.c

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