On Mon, May 29, 2017 at 3:23 AM, Junio C Hamano wrote:
> * df/dir-iter-remove-subtree (2017-05-29) 5 commits
> . remove_subtree(): reimplement using iterators
> . dir_iterator: rewrite state machine model
> . dir_iterator: refactor dir_iterator_advance
> . remove_subtree():
---
Hi there! When implementing a patch series to port git-add--interactive
from Perl to C[1] I ended up implementing this quirk to iterate through
a hashmap in the order elements were added to it. In the end, it did
not make it into the series but I figured I'd share it anyway if it
interests
the numstat and use a
combination of a hashmap and qsort() to print the result in
O(n) + O(n lg n) complexity.
This is the first add--interactive command implemented in C of those
anticipated by 6cbc52d ("add--helper: create builtin helper for
interactive add", 2017-05-15).
Signed-off-
Call the newly introduced git-add-interactive--helper builtin on
status_cmd() instead of relying on git-add--interactive's Perl
functions to build print the numstat.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
git-add--interactive.perl | 4 +---
1 file changed, 1 insertion
from
how the show_* functions used by diff_flush() do it. One example is the
builtin implementation of git-add--interactive's status.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
diff.c | 17 +
diff.h | 19 ++-
2 files changed, 19 insertions(+), 17 del
).
Additionally, an eventual complete port of git-add--interactive would
remove the last "big" Git script to have Perl as a dependency, allowing
most Git users to have a NOPERL build running without big losses.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
.gitignore
me insight on this issue that I could
bring to this series. I do think this would be a good idea, though! :)
-- Daniel.
Daniel Ferreira (4):
diff: export diffstat interface
add--helper: create builtin helper for interactive add
add--helper: implement interactive status command
add--interactiv
On Fri, May 5, 2017 at 7:38 PM, Johannes Schindelin
wrote:
> But maybe you want to keep the naming a little more consistent with the
> Perl script, e.g. instead of calling the function `print_modified()` call
> it already `list()` (and rename it later to
On Fri, May 5, 2017 at 7:30 PM, Johannes Schindelin
wrote:
>> +static int git_add_interactive_config(const char *var,
>
> Not git_add_interactive__helper_config()? ;-)
I don't get if you mean this ironically (because of the verbosity) or
if you do think this would be
o use that and build our status_cmd
output. Unless this breaks some rule of Git's API design, the result
seems pretty reasonable to me.
Travis CI build: https://travis-ci.org/theiostream/git/builds/229232202
Looking forward for feedback,
Daniel.
Daniel Ferreira (3):
diff: export diffstat interfac
Call the newly introduced git-add-interactive--helper builtin on
status_cmd() instead of relying on git-add--interactive's Perl
functions to build print the numstat.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
git-add--interactive.perl | 4 +---
1 file changed, 1 insertion
ithout big losses.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
.gitignore| 1 +
Makefile | 1 +
builtin.h | 1 +
builtin/add-interactive--helper.c | 258 +
from
how the show_* functions used by diff_flush() do it.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
diff.c | 17 +
diff.h | 19 ++-
2 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/diff.c b/diff.c
index 74283d9..7c073c2 100644
--- a/
Hey there,
So, in the GSoC proposal I sent about porting git-add--interactive to
C[1], I expected I would be able to do a couple of small patches to
git-add to familiarize myself with the Git API and have a better clue
of how the porting process would go by. Due to the unexpected size my
Factor out reusable helpers out of dir_iterator_advance(). Make
dir_iterator_advance()'s code more legible and allow some behavior to
be reusable.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 66 ++
1 file c
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
entry.c | 42 --
1 file changed, 16 insertions(+), 26 deletions(-)
diff --git a/entry.c b/entry.c
index d2b512d..a939432 100644
--- a/entry.c
+++ b/entry.c
@@ -3,6 +3,8 @@
#include "dir.h&qu
eate the file within each of them.
Daniel Ferreira (5):
dir_iterator: add tests for dir_iterator API
remove_subtree(): test removing nested directories
dir_iterator: refactor dir_iterator_advance
dir_iterator: rewrite state machine model
remove_subtree(): reimplement using
Create t/helper/test-dir-iterator.c, which prints relevant information
about a directory tree iterated over with dir_iterator.
Create t/t0066-dir-iterator.sh, which tests that dir_iterator does
iterate through a whole directory tree.
Signed-off-by: Daniel Ferreira <bnm...@gmail.
.
Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu>
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 212 ++-
dir-iterator.h | 35 +--
refs/files-backend.c | 15 ++-
t/helper/test-d
() pass the tests.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
t/t2000-checkout-cache-clash.sh | 11 +++
1 file changed, 11 insertions(+)
diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
index de3edb5..ac10ba3 100755
--- a/t/t2000-checkout
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
entry.c | 42 --
1 file changed, 16 insertions(+), 26 deletions(-)
diff --git a/entry.c b/entry.c
index d2b512d..a939432 100644
--- a/entry.c
+++ b/entry.c
@@ -3,6 +3,8 @@
#include "dir.h&qu
.
Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu>
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 220 ++-
dir-iterator.h | 35 +--
refs/files-backend.c | 51 ++
t/helper/test-
() pass the tests.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
t/t2000-checkout-cache-clash.sh | 11 +++
1 file changed, 11 insertions(+)
diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
index de3edb5..ac10ba3 100755
--- a/t/t2000-checkout
Factor out reusable helpers out of dir_iterator_advance(). Make
dir_iterator_advance()'s code more legible and allow some behavior to
be reusable.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 66 ++
1 file c
Create t/helper/test-dir-iterator.c, which prints relevant information
about a directory tree iterated over with dir_iterator.
Create t/t0065-dir-iterator.sh, which tests that dir_iterator does
iterate through a whole directory tree.
Signed-off-by: Daniel Ferreira <bnm...@gmail.
it as t0065 since I figured it
would be weird for this patch as a unit to "skip" a number.
Once again, thanks for all the time invested in the reviews for this
patch.
[1]:
https://public-inbox.org/git/1491163388-41255-1-git-send-email-bnm...@gmail.com/T/#m187b9e681e3369862ccc6083bbf659
traversing challenges on
Git. After all, we might want some special behavior depending on what
the given `path` is instead of always considering it valid and later
behaving as if it was an empty directory.
Thanks again for the reviews.
Daniel Ferreira (5):
dir_iterator: add tests for dir_iterator
Create t/helper/test-dir-iterator.c, which prints relevant information
about a directory tree iterated over with dir_iterator.
Create t/t0065-dir-iterator.sh, which tests that dir_iterator does
iterate through a whole directory tree.
Signed-off-by: Daniel Ferreira <bnm...@gmail.
Create helpers to dir_iterator_advance(). Make dir_iterator_advance()'s
code more legible and allow some behavior to be reusable.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 65 +-
1 file changed, 42 inse
() pass the tests.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
t/t2000-checkout-cache-clash.sh | 11 +++
1 file changed, 11 insertions(+)
diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
index de3edb5..ac10ba3 100755
--- a/t/t2000-checkout
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
entry.c | 42 --
1 file changed, 16 insertions(+), 26 deletions(-)
diff --git a/entry.c b/entry.c
index d2b512d..a939432 100644
--- a/entry.c
+++ b/entry.c
@@ -3,6 +3,8 @@
#include "dir.h&qu
r" and "iterate-over-root" modes.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
Signed-off-by: Michael Haggerty <mhag...@alum.mit.edu>
---
dir-iterator.c | 223 ++-
dir-iterator.h | 35 +--
refs/fil
it.)
-- Daniel.
On Wed, Apr 5, 2017 at 10:39 PM, Daniel Ferreira <bnm...@gmail.com> wrote:
> This is the seventh version of a patch series that implements the GSoC
> microproject of converting a recursive call to readdir() to use dir_iterator.
>
> v1:
> https://public-inb
() pass the tests.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
t/t2000-checkout-cache-clash.sh | 11 +++
1 file changed, 11 insertions(+)
diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
index de3edb5..ac10ba3 100755
--- a/t/t2000-checkout
ator.sh and t/helper/test-dir-iterator.c to
test "post-order" and "iterate-over-root" modes.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 216 ++-
dir-iterator.h | 35 +--
r
Create helpers to dir_iterator_advance(). Make dir_iterator_advance()'s
code more legible and allow some behavior to be reusable.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 65 +-
1 file changed, 42 inse
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
entry.c | 39 +--
1 file changed, 13 insertions(+), 26 deletions(-)
diff --git a/entry.c b/entry.c
index d2b512d..d543ccf 100644
--- a/entry.c
+++ b/entry.c
@@ -3,6 +3,8 @@
#include "dir.h&qu
Create t/helper/test-dir-iterator.c, which prints relevant information
about a directory tree iterated over with dir_iterator.
Create t/t0065-dir-iterator.sh, which tests that dir_iterator does
iterate through a whole directory tree.
Signed-off-by: Daniel Ferreira <bnm...@gmail.
terator_begin() and
possibly return an error there. Regardless, I appreciate other suggestions to
make this less complex.
Daniel Ferreira (5):
dir_iterator: add tests for dir_iterator API
remove_subtree(): test removing nested directories
dir_iterator: add helpers to dir_iterator_advance
On Mon, Apr 3, 2017 at 12:36 AM, Michael Haggerty wrote:
> As far as I can tell, you got the logic in this complicated big loop
> correct on the first try (well, if we ignore v6 :-) ), even as you added
> new features. I think that's good evidence that the new structure is
>
On Sun, Apr 2, 2017 at 4:43 PM, Johannes Schindelin
wrote:
> We ask to accomplish a microproject before evaluating the proposals for
> one reason: to have a good understanding how well the students would
> interact with the project if they were accepted. As such, the
>
From: Daniel Ferreira <daniel.calib...@gmail.com>
Use dir_iterator to traverse through remove_subtree()'s directory tree,
avoiding the need for recursive calls to readdir(). Simplify
remove_subtree()'s code.
A conversion similar in purpose was previously done at 46d092a
("for_
ator.sh and t/helper/test-dir-iterator.c to
test "post-order" and "iterate-over-root" modes.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 155 +++
dir-iterator.h | 28
Create inline helpers to dir_iterator_advance(). Make
dir_iterator_advance()'s code more legible and allow some behavior to
be reusable.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 65 +-
1 file chang
Create t/helper/test-dir-iterator.c, which prints relevant information
about a directory tree iterated over with dir_iterator.
Create t/t0065-dir-iterator.sh, which tests that dir_iterator does
iterate through a whole directory tree.
Signed-off-by: Daniel Ferreira <bnm...@gmail.
() pass the tests.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
t/t2000-checkout-cache-clash.sh | 11 +++
1 file changed, 11 insertions(+)
diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
index de3edb5..ac10ba3 100755
--- a/t/t2000-checkout
> new flags in a single commit. I do not know whether you will feel this is
> the right choice but it seemed natural, since most of the state machine's
> new logic would not even make sense without encompassing the new features.
> I am, of course, open for feedback on this decision
Gah, I just realized I failed to correct refs/files-backend.c's
behavior and kept 0 instead of DIR_ITERATOR_PRE_ORDER_TRAVERSAL as its
flag. I'll correct this on a v7, but I'll wait for the rest of your
reviews before sending that revision.
On Sun, Apr 2, 2017 at 1:35 AM, Daniel Ferreira <
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
entry.c | 38 --
1 file changed, 12 insertions(+), 26 deletions(-)
diff --git a/entry.c b/entry.c
index c6eea24..309b9ad 100644
--- a/entry.c
+++ b/entry.c
@@ -2,6 +2,8 @@
#include "blob.h"
Create inline helpers to dir_iterator_advance(). Make
dir_iterator_advance()'s code more legible and allow some behavior to
be reusable.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 65 +-
1 file chang
ator.sh and t/helper/test-dir-iterator.c to
test "post-order" and "iterate-over-root" modes.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 149 +++
dir-iterator.h | 28
() pass the tests.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
t/t2000-checkout-cache-clash.sh | 11 +++
1 file changed, 11 insertions(+)
diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
index de3edb5..ac10ba3 100755
--- a/t/t2000-checkout
Create t/helper/test-dir-iterator.c, which prints relevant information
about a directory tree iterated over with dir_iterator.
Create t/t0065-dir-iterator.sh, which tests that dir_iterator does
iterate through a whole directory tree.
Signed-off-by: Daniel Ferreira <bnm...@gmail.
s decision.
To Michael and Duy, thanks -- really -- for the encouraging comments! :)
I never regarded this microproject purely as a means to fulfill a GSoC
requirement, but as a way to get to learn more about Git, so I'm surely
not giving it up.
Once again, thanks for all the previous reviews,
Daniel.
Danie
Why exactly would it not be applicable to read_directory_recursively()?
On Thu, Mar 30, 2017 at 8:08 AM, Duy Nguyen wrote:
> On Thu, Mar 30, 2017 at 1:39 PM, Michael Haggerty
> wrote:
>> * DIR_ITERATOR_RECURSE -- recurse into subdirectories
>>
>> would
/1dvF2PNRQvvZ351jCdKzOLs7tzaDqhR7ci7TDgzYQg9I/edit?usp=sharing.
-- Daniel.
On Fri, Mar 31, 2017 at 2:07 AM, Daniel Ferreira (theiostream)
<bnm...@gmail.com> wrote:
> Hi Stefan & Johannes,
>
> Thank you for the precious feedback on the proposal. I don't see much
> sense in sending a full "
>
>> On Sat, Mar 25, 2017 at 8:15 PM, Daniel Ferreira (theiostream)
>> <bnm...@gmail.com> wrote:
>>
>> > SYNOPSIS
>> > There are many advantages to converting parts of git that are still
>> > scripts to C builtins, among which execution speed,
On Thu, Mar 30, 2017 at 5:05 AM, Michael Haggerty wrote:
> 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,
On Thu, Mar 30, 2017 at 4:46 AM, Michael Haggerty wrote:
> Is there a special reason to write the date to the file as opposed to, say
>
> touch dir/b
>
> ? (Some people use `: >dir/b` for this purpose, though I've never found
> out why.) If you write the date to the
From: Daniel Ferreira <daniel.calib...@gmail.com>
Use dir_iterator to traverse through remove_subtree()'s directory tree,
avoiding the need for recursive calls to readdir(). Simplify
remove_subtree()'s code.
A conversion similar in purpose was previously done at 46d092a
("for_
() pass the tests.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
t/t2000-checkout-cache-clash.sh | 11 +++
1 file changed, 11 insertions(+)
diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
index de3edb5..ac10ba3 100755
--- a/t/t2000-checkout
.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
Makefile | 1 +
t/helper/test-dir-iterator.c | 32 +++
t/t0065-dir-iterator.sh | 45
3 files changed, 78 insertions(+)
create mode 10
is greatly appreciated.
Thanks,
Daniel.
Daniel Ferreira (6):
dir_iterator: add helpers to dir_iterator_advance
dir_iterator: refactor state machine model
dir_iterator: iterate over dir after its contents
dir_iterator: add tests for dir_iterator API
remove_subtree(): reimplement using
ntents have been wiped.
Amend a call to dir_iterator_begin() to pass the flags parameter
introduced.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 53
dir-iterator.h | 17 -
refs/file
Create inline helpers to dir_iterator_advance(). Make
dir_iterator_advance()'s code more legible and allow some behavior to
be reusable.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 65 +-
1 file chang
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 13 ++---
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/dir-iterator.c b/dir-iterator.c
index ce8bf81..3ac984b 100644
--- a/dir-iterator.c
+++ b/dir-iterator.c
@@ -4,8 +4,6 @@
#include "dir
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
entry.c | 31 ++-
1 file changed, 10 insertions(+), 21 deletions(-)
diff --git a/entry.c b/entry.c
index c6eea24..bbebd16 100644
--- a/entry.c
+++ b/entry.c
@@ -2,6 +2,8 @@
#include "blob.h"
tents have been wiped.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 46 ++
dir-iterator.h | 14 +++---
2 files changed, 53 insertions(+), 7 deletions(-)
diff --git a/dir-iterator.c b/dir-iterator.c
index 853c040.
Amend a call to dir_iterator_begin() to pass the flags parameter
introduced in 3efb5c0 ("dir_iterator: iterate over dir after its
contents", 2017-28-03).
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
refs/files-backend.c | 2 +-
1 file changed, 1 insertion(+), 1 deletio
Create inline helpers to dir_iterator_advance(). Make
dir_iterator_advance()'s code more legible and allow some behavior to
be reusable.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 65 +-
1 file chang
to remove_subtree). I am just unsure about
its location in t/. I'd appreciate suggestions to put it in a more
decent home.
Daniel Ferreira (5):
dir_iterator: add helpers to dir_iterator_advance
dir_iterator: iterate over dir after its contents
remove_subtree(): reimplement using iterators
() pass the tests.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
t/t2000-checkout-cache-clash.sh | 11 +++
1 file changed, 11 insertions(+)
diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh
index de3edb5..ac10ba3 100755
--- a/t/t2000-checkout
below), but in
case of being accepted I am willing to quit my job some months early
to dedicate myself fully to GSoC starting June.
BIOGRAPHICAL INFORMATION
My name is Daniel Ferreira and I'm a student from São Paulo, Brazil. I
was accepted by Stanford University last year and I will start college
added to avoid either breaking the current dir_iterator
API or over-engineering an extremely simple option architecture.
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
dir-iterator.c | 100 -
dir-iterator.h | 7
2 files cha
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
entry.c | 32 +++-
1 file changed, 11 insertions(+), 21 deletions(-)
diff --git a/entry.c b/entry.c
index c6eea24..670ffeb 100644
--- a/entry.c
+++ b/entry.c
@@ -2,6 +2,8 @@
#include "blob.h"
to come up with a way to reproduce remove_subtree()
being called. Any help?
Thank you all again for all the reviews.
Daniel Ferreira (2):
dir_iterator: iterate over dir after its contents
remove_subtree(): reimplement using iterators
dir-iterator.c | 100
...@gmail.com> wrote:
> On Sat, Mar 25, 2017 at 6:27 PM, Daniel Ferreira <bnm...@gmail.com> wrote:
>> Use dir_iterator to traverse through remove_subtree()'s directory tree,
>> avoiding the need for recursive calls to readdir(). Simplify
>> remove_subtree()'s code.
>>
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
This is a second-version patch of the Google Summer of Code microproject for
refactoring recursive readdir() calls to use dir_iterator instead. v1 can be
found in:
https://public-inbox.org/git/CAGZ79kZwT-9mHTiOJ5CEjk2wDFkn6+N
> On Fri, Mar 24, 2017 at 2:02 PM, Stefan Beller wrote:
> Welcome to the Git community!
Thank you!
> Please use a more imperative style. (e.g. s/Uses/Use/ ...
> s/and simplfying/which simplifies/)
Thank you. Will do in a second version of this patch.
> Thanks for this
in purpose was previously done at 46d092a
("for_each_reflog(): reimplement using iterators", 2016-05-21).
Signed-off-by: Daniel Ferreira <bnm...@gmail.com>
---
Hey there! This is my microproject for Google Summer of Code on git.
It has passed on Travis CI (https://travis-ci.org
80 matches
Mail list logo