: 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
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 +
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
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
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
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
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
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
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
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(
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 --
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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;
>> }
>>
>
ondetection/commit/33a694a9ee1b79c24be45f9eab5ac0e1aeeaf271
Greetings
Michael
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
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:
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
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
>>
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
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
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
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
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
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
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
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
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(
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
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
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
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
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
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
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
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
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
: 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
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 +
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
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
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
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
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
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
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
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
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
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
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
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 --
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
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
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
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,
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
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
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
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
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
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
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
truct
> dir_iterator_level *level)
> +{
> + return --iter->levels_nr;
> +}
`pop_dir_level()` doesn't use its `level` argument; it can be removed.
> [...]
Michael
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
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
; + 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
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
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
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
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
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
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
}
> +
> + 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
r_level
> struct and ease comprehension of the state machine's behavior.
Nice.
Michael
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
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
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
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
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
(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(+)
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
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
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
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/
[
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
101 - 200 of 1782 matches
Mail list logo