[PATCH v4 02/11] diff: export diffstat interface

2019-08-27 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Make the diffstat interface (namely, the diffstat_t struct and compute_diffstat) no longer be internal to diff.c and allow it to be used by other parts of git. This is helpful for code that may want to easily extract information from files using the diff machinery, while

[PATCH v4 03/11] built-in add -i: implement the `status` command

2019-08-27 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira This implements the `status` command of `git add -i`. The data structures introduced in this commit will be extended as needed later. At this point, we re-implement only part of the `list_and_choose()` function of the Perl script `git-add--interactive.perl` and call it

[PATCH v3 03/11] built-in add -i: implement the `status` command

2019-07-16 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira This implements the `status` command of `git add -i`. The data structures introduced in this commit will be extended as needed later. At this point, we re-implement only part of the `list_and_choose()` function of the Perl script `git-add--interactive.perl` and call it

[PATCH v3 02/11] diff: export diffstat interface

2019-07-16 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Make the diffstat interface (namely, the diffstat_t struct and compute_diffstat) no longer be internal to diff.c and allow it to be used by other parts of git. This is helpful for code that may want to easily extract information from files using the diff machinery, while

[PATCH v2 03/11] built-in add -i: implement the `status` command

2019-05-13 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira This implements the `status` command of `git add -i`. The data structures introduced in this commit will be extended as needed later. At this point, we re-implement only part of the `list_and_choose()` function of the Perl script `git-add--interactive.perl` and call it

[PATCH v2 02/11] diff: export diffstat interface

2019-05-13 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Make the diffstat interface (namely, the diffstat_t struct and compute_diffstat) no longer be internal to diff.c and allow it to be used by other parts of git. This is helpful for code that may want to easily extract information from files using the diff machinery, while

[PATCH 03/11] built-in add -i: implement the `status` command

2019-04-10 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira This implements the `status` command of `git add -i`. The data structures introduced in this commit will be extended as needed later. At this point, we re-implement only part of the `list_and_choose()` function of the Perl script `git-add--interactive.perl` and call it

[PATCH 02/11] diff: export diffstat interface

2019-04-10 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Make the diffstat interface (namely, the diffstat_t struct and compute_diffstat) no longer be internal to diff.c and allow it to be used by other parts of git. This is helpful for code that may want to easily extract information from files using the diff machinery, while

Re: [GSoC][PATCH 2/2] clone: use dir-iterator to avoid explicit dir traversal

2019-02-21 Thread Daniel Ferreira (theiostream)
Hi there! I'm happy to see this series has gotten renewed attention. The series was fine per se, and it even got through to the pu branch. But then it got ejected since it conflicted non-trivially with another patch series that was added along the way (see https://lwn.net/Articles/724166/). At tha

[PATCH v5 02/10] add--helper: create builtin helper for interactive add

2019-02-20 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Create a builtin helper for git-add--interactive, which at this point is not doing anything. This is the first step in an effort to convert git-add--interactive.perl to a C builtin, in search for better portability, expressibility and performance (specially on non-POSIX

[PATCH v5 06/10] add--interactive.perl: use add--helper --status for status_cmd

2019-02-20 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Call the newly introduced add--helper builtin in status_cmd() instead of relying on add--interactive's Perl functions to print the numstat. If an error occurs, it will be reported, but the Perl script will not exit, since the add--helper is called within an eval block

[PATCH v5 01/10] diff: export diffstat interface

2019-02-20 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Make the diffstat interface (namely, the diffstat_t struct and compute_diffstat) no longer be internal to diff.c and allow it to be used by other parts of git. This is helpful for code that may want to easily extract information from files using the diff machinery, while

[PATCH v4 1/7] diff: export diffstat interface

2019-01-25 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Make the diffstat interface (namely, the diffstat_t struct and compute_diffstat) no longer be internal to diff.c and allow it to be used by other parts of git. This is helpful for code that may want to easily extract information from files using the diff machinery, while

[PATCH v4 3/7] add-interactive.c: implement status command

2019-01-25 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Add new files: add-interactive.c and add-interactive.h, which will be used for implementing "application logic" of git add -i, whereas add--helper.c will be used mostly for parsing the command line. We're a bit lax with the command-line parsing, as the comm

[PATCH v4 2/7] add--helper: create builtin helper for interactive add

2019-01-25 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Create a builtin helper for git-add--interactive, which right now is not able to do anything. This is the first step in an effort to convert git-add--interactive.perl to a C builtin, in search for better portability, expressibility and performance (specially on non-POSIX

[PATCH v4 4/7] add--interactive.perl: use add--helper --status for status_cmd

2019-01-25 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Call the newly introduced add--helper builtin in status_cmd() instead of relying on add--interactive's Perl functions to print the numstat. If an error occurs, it will be reported, but the Perl script will not exit, since the add--helper is called within an eval block

[PATCH v3 2/7] add--helper: create builtin helper for interactive add

2019-01-21 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Create a builtin helper for git-add--interactive, which right now is not able to do anything. This is the first step in an effort to convert git-add--interactive.perl to a C builtin, in search for better portability, expressibility and performance (specially on non-POSIX

[PATCH v3 3/7] add-interactive.c: implement status command

2019-01-21 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Add new files: add-interactive.c and add-interactive.h, which will be used for implementing "application logic" of git add -i, whereas add--helper.c will be used mostly for parsing the command line. We're a bit lax with the command-line parsing, as the comm

[PATCH v3 4/7] add--interactive.perl: use add--helper --status for status_cmd

2019-01-21 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Call the newly introduced add--helper builtin on status_cmd() instead of relying on add--interactive's Perl functions to build print the numstat. Signed-off-by: Daniel Ferreira Signed-off-by: Slavica Djukic --- git-add--interactive.perl | 4 +--- 1 file chang

[PATCH v3 1/7] diff: export diffstat interface

2019-01-21 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Make the diffstat interface (namely, the diffstat_t struct and compute_diffstat) no longer be internal to diff.c and allow it to be used by other parts of git. This is helpful for code that may want to easily extract information from files using the diff machinery, while

[PATCH v2 2/7] add--helper: create builtin helper for interactive add

2019-01-17 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Create a builtin helper for git-add--interactive, which right now is not able to do anything. This is the first step in an effort to convert git-add--interactive.perl to a C builtin, in search for better portability, expressibility and performance (specially on non-POSIX

[PATCH v2 3/7] add-interactive.c: implement status command

2019-01-17 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Add new files: add-interactive.c and add-interactive.h, which will be used for implementing "application logic" of git add -i, whereas add--helper.c will be used mostly for parsing the command line. We're a bit lax with the command-line parsing, as the comm

[PATCH v2 1/7] diff: export diffstat interface

2019-01-17 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Make the diffstat interface (namely, the diffstat_t struct and compute_diffstat) no longer be internal to diff.c and allow it to be used by other parts of git. This is helpful for code that may want to easily extract information from files using the diff machinery, while

[PATCH v2 4/7] add--interactive.perl: use add--helper --status for status_cmd

2019-01-17 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Call the newly introduced add--helper builtin on status_cmd() instead of relying on add--interactive's Perl functions to build print the numstat. Signed-off-by: Daniel Ferreira Signed-off-by: Slavica Djukic --- git-add--interactive.perl | 4 +--- 1 file chang

[PATCH 4/7] add--interactive.perl: use add--helper --status for status_cmd

2018-12-20 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Call the newly introduced add--helper builtin on status_cmd() instead of relying on add--interactive's Perl functions to build print the numstat. Signed-off-by: Daniel Ferreira Signed-off-by: Slavica Djukic --- git-add--interactive.perl | 4 +--- 1 file chang

[PATCH 3/7] add-interactive.c: implement status command

2018-12-20 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Add new files: add-interactive.c and add-interactive.h, which will be used for implementing "application logic" of git add -i, whereas add--helper.c will be used mostly for parsing the command line. We're a bit lax with the command-line parsing, as the comm

[PATCH 2/7] add--helper: create builtin helper for interactive add

2018-12-20 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Create a builtin helper for git-add--interactive, which right now is not able to do anything. This is the first step in an effort to convert git-add--interactive.perl to a C builtin, in search for better portability, expressibility and performance (specially on non-POSIX

[PATCH 1/7] diff: export diffstat interface

2018-12-20 Thread Daniel Ferreira via GitGitGadget
From: Daniel Ferreira Make the diffstat interface (namely, the diffstat_t struct and compute_diffstat) no longer be internal to diff.c and allow it to be used by other parts of git. This is helpful for code that may want to easily extract information from files using the diff machinery, while

Re: What's cooking in git.git (May 2017, #08; Mon, 29)

2017-05-30 Thread Daniel Ferreira (theiostream)
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(): test removing neste

Implementation of sorted hashmap iteration

2017-05-15 Thread Daniel Ferreira
--- 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 anyo

[PATCH v2 3/4] add--helper: implement interactive status command

2017-05-15 Thread Daniel Ferreira
o get 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

[PATCH v2 4/4] add--interactive: use add-interactive--helper for status_cmd

2017-05-15 Thread Daniel Ferreira
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 --- git-add--interactive.perl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff

[PATCH v2 1/4] diff: export diffstat interface

2017-05-15 Thread Daniel Ferreira
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 --- diff.c | 17 + diff.h | 19 ++- 2 files changed, 19 insertions(+), 17 deletions(-) diff --

[PATCH v2 2/4] add--helper: create builtin helper for interactive add

2017-05-15 Thread Daniel Ferreira
). 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 --- .gitignore| 1 + Makefile

[PATCH v2 0/4] Port git-add--interactive.perl:status_cmd to C

2017-05-15 Thread Daniel Ferreira
gain some 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

Re: [PATCH 0/3] Port git-add--interactive.perl:status_cmd to C

2017-05-05 Thread Daniel Ferreira (theiostream)
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 `list_and_choose()` once you > have taught

Re: [PATCH 2/3] add--interactive: add builtin helper for interactive add

2017-05-05 Thread Daniel Ferreira (theiostream)
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 a good name ;P >> + for

[PATCH 0/3] Port git-add--interactive.perl:status_cmd to C

2017-05-05 Thread Daniel Ferreira
ld and allow our new builtin to 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

[PATCH 3/3] add--interactive: use add-interactive--helper for status_cmd

2017-05-05 Thread Daniel Ferreira
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 --- git-add--interactive.perl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff

[PATCH 2/3] add--interactive: add builtin helper for interactive add

2017-05-05 Thread Daniel Ferreira
ing without big losses. Signed-off-by: Daniel Ferreira --- .gitignore| 1 + Makefile | 1 + builtin.h | 1 + builtin/add-interactive--helper.c | 258 ++ git.c

[PATCH 1/3] diff: export diffstat interface

2017-05-05 Thread Daniel Ferreira
from how the show_* functions used by diff_flush() do it. Signed-off-by: Daniel Ferreira --- 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/diff.c +++ b/diff.c

[RFC] [GSoC] Port git-add--interactive.perl:status_cmd to C

2017-05-01 Thread Daniel Ferreira (theiostream)
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 microproj

[PATCH v11 3/5] dir_iterator: refactor dir_iterator_advance

2017-04-26 Thread Daniel Ferreira
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 --- dir-iterator.c | 66 ++ 1 file changed, 43 inser

[PATCH v11 5/5] remove_subtree(): reimplement using iterators

2017-04-26 Thread Daniel Ferreira
-05-21). Signed-off-by: Daniel Ferreira --- 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" #i

[PATCH v11 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-04-26 Thread Daniel Ferreira
it seemed unnecessary to recreate 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

[PATCH v11 1/5] dir_iterator: add tests for dir_iterator API

2017-04-26 Thread Daniel Ferreira
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 --- Makefile

[PATCH v11 4/5] dir_iterator: rewrite state machine model

2017-04-26 Thread Daniel Ferreira
igned-off-by: Michael Haggerty Signed-off-by: Daniel Ferreira --- dir-iterator.c | 212 ++- dir-iterator.h | 35 +-- refs/files-backend.c | 15 ++- t/helper/test-dir-iterator.c | 31 ++- t/t0066-dir-iterator

[PATCH v11 2/5] remove_subtree(): test removing nested directories

2017-04-26 Thread Daniel Ferreira
() pass the tests. Signed-off-by: Daniel Ferreira --- 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-cache-clash.sh +++ b/t/t2000

[PATCH v10 5/5] remove_subtree(): reimplement using iterators

2017-04-19 Thread Daniel Ferreira
-05-21). Signed-off-by: Daniel Ferreira --- 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" #i

[PATCH v10 4/5] dir_iterator: rewrite state machine model

2017-04-19 Thread Daniel Ferreira
igned-off-by: Michael Haggerty Signed-off-by: Daniel Ferreira --- dir-iterator.c | 220 ++- dir-iterator.h | 35 +-- refs/files-backend.c | 51 ++ t/helper/test-dir-iterator.c | 31 +- t/t0065-dir-itera

[PATCH v10 2/5] remove_subtree(): test removing nested directories

2017-04-19 Thread Daniel Ferreira
() pass the tests. Signed-off-by: Daniel Ferreira --- 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-cache-clash.sh +++ b/t/t2000

[PATCH v10 3/5] dir_iterator: refactor dir_iterator_advance

2017-04-19 Thread Daniel Ferreira
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 --- dir-iterator.c | 66 ++ 1 file changed, 43 inser

[PATCH v10 1/5] dir_iterator: add tests for dir_iterator API

2017-04-19 Thread Daniel Ferreira
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 --- Makefile

[PATCH v10 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-04-19 Thread Daniel Ferreira
ther queued patch. I kept 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/#m187b9

[PATCH v9 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-04-17 Thread Daniel Ferreira
kle more complex dir 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 te

[PATCH v9 1/5] dir_iterator: add tests for dir_iterator API

2017-04-17 Thread Daniel Ferreira
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 --- Makefile

[PATCH v9 3/5] dir_iterator: add helpers to dir_iterator_advance

2017-04-17 Thread Daniel Ferreira
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 --- dir-iterator.c | 65 +- 1 file changed, 42 insertions(+), 23 dele

[PATCH v9 2/5] remove_subtree(): test removing nested directories

2017-04-17 Thread Daniel Ferreira
() pass the tests. Signed-off-by: Daniel Ferreira --- 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-cache-clash.sh +++ b/t/t2000

[PATCH v9 5/5] remove_subtree(): reimplement using iterators

2017-04-17 Thread Daniel Ferreira
-05-21). Signed-off-by: Daniel Ferreira --- 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" #i

[PATCH v9 4/5] dir_iterator: refactor state machine model

2017-04-17 Thread Daniel Ferreira
r" and "iterate-over-root" modes. Signed-off-by: Daniel Ferreira Signed-off-by: Michael Haggerty --- dir-iterator.c | 223 ++- dir-iterator.h | 35 +-- refs/files-backend.c | 51 ++ t/helper/t

Re: [PATCH v8 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-04-12 Thread Daniel Ferreira (theiostream)
noticed it.) -- Daniel. On Wed, Apr 5, 2017 at 10:39 PM, Daniel Ferreira 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-inbox.org/git/CAGZ79kZwT-9m

[PATCH v8 2/5] remove_subtree(): test removing nested directories

2017-04-05 Thread Daniel Ferreira
() pass the tests. Signed-off-by: Daniel Ferreira --- 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-cache-clash.sh +++ b/t/t2000

[PATCH v8 4/5] dir_iterator: refactor state machine model

2017-04-05 Thread Daniel Ferreira
ator.sh and t/helper/test-dir-iterator.c to test "post-order" and "iterate-over-root" modes. Signed-off-by: Daniel Ferreira --- dir-iterator.c | 216 ++- dir-iterator.h | 35 +-- refs/files-backe

[PATCH v8 3/5] dir_iterator: add helpers to dir_iterator_advance

2017-04-05 Thread Daniel Ferreira
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 --- dir-iterator.c | 65 +- 1 file changed, 42 insertions(+), 23 dele

[PATCH v8 5/5] remove_subtree(): reimplement using iterators

2017-04-05 Thread Daniel Ferreira
-05-21). Signed-off-by: Daniel Ferreira --- 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" #include "

[PATCH v8 1/5] dir_iterator: add tests for dir_iterator API

2017-04-05 Thread Daniel Ferreira
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 --- Makefile

[PATCH v8 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-04-05 Thread Daniel Ferreira
dir_iterator_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_adva

Re: [PATCH v7 4/5] dir_iterator: refactor state machine model

2017-04-03 Thread Daniel Ferreira (theiostream)
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 > more comprehensible th

Re: [GSoC] Proposal: turn git-add--interactive.perl into a builtin

2017-04-02 Thread Daniel Ferreira (theiostream)
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 > microprojects really are abo

[PATCH v7 5/5] remove_subtree(): reimplement using iterators

2017-04-02 Thread Daniel Ferreira
From: Daniel Ferreira 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_each_reflog(): reimplement

[PATCH v7 4/5] dir_iterator: refactor state machine model

2017-04-02 Thread Daniel Ferreira
ator.sh and t/helper/test-dir-iterator.c to test "post-order" and "iterate-over-root" modes. Signed-off-by: Daniel Ferreira --- dir-iterator.c | 155 +++ dir-iterator.h | 28 ++-- refs/files-backe

[PATCH v7 3/5] dir_iterator: add helpers to dir_iterator_advance

2017-04-02 Thread Daniel Ferreira
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 --- dir-iterator.c | 65 +- 1 file changed, 42 insertions(+

[PATCH v7 1/5] dir_iterator: add tests for dir_iterator API

2017-04-02 Thread Daniel Ferreira
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 --- Makefile

[PATCH v7 2/5] remove_subtree(): test removing nested directories

2017-04-02 Thread Daniel Ferreira
() pass the tests. Signed-off-by: Daniel Ferreira --- 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-cache-clash.sh +++ b/t/t2000

[PATCH v7 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-04-02 Thread Daniel Ferreira
the addition of the > 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

Re: [PATCH v6 4/5] dir_iterator: refactor state machine model

2017-04-01 Thread Daniel Ferreira (theiostream)
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

[PATCH v6 5/5] remove_subtree(): reimplement using iterators

2017-04-01 Thread Daniel Ferreira
-05-21). Signed-off-by: Daniel Ferreira --- 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" #include

[PATCH v6 3/5] dir_iterator: add helpers to dir_iterator_advance

2017-04-01 Thread Daniel Ferreira
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 --- dir-iterator.c | 65 +- 1 file changed, 42 insertions(+

[PATCH v6 4/5] dir_iterator: refactor state machine model

2017-04-01 Thread Daniel Ferreira
ator.sh and t/helper/test-dir-iterator.c to test "post-order" and "iterate-over-root" modes. Signed-off-by: Daniel Ferreira --- dir-iterator.c | 149 +++ dir-iterator.h | 28 ++-- refs/files-backe

[PATCH v6 2/5] remove_subtree(): test removing nested directories

2017-04-01 Thread Daniel Ferreira
() pass the tests. Signed-off-by: Daniel Ferreira --- 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-cache-clash.sh +++ b/t/t2000

[PATCH v6 1/5] dir_iterator: add tests for dir_iterator API

2017-04-01 Thread Daniel Ferreira
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 --- Makefile

[PATCH v6 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-04-01 Thread Daniel Ferreira
feedback on this 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 previou

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

2017-04-01 Thread Daniel Ferreira (theiostream)
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 make the set of possible options complete.

Re: [GSoC] Proposal: turn git-add--interactive.perl into a builtin

2017-03-31 Thread Daniel Ferreira (theiostream)
/1dvF2PNRQvvZ351jCdKzOLs7tzaDqhR7ci7TDgzYQg9I/edit?usp=sharing. -- Daniel. On Fri, Mar 31, 2017 at 2:07 AM, Daniel Ferreira (theiostream) wrote: > Hi Stefan & Johannes, > > Thank you for the precious feedback on the proposal. I don't see much > sense in sending a full "v2" of it and ha

Re: [GSoC] Proposal: turn git-add--interactive.perl into a builtin

2017-03-30 Thread Daniel Ferreira (theiostream)
roposal draft" to you through the website, since I've already sent it here that shouldn't be necessary, correct? I intend to use it just to send the final thing. On Wed, Mar 29, 2017 at 9:01 PM, Johannes Schindelin wrote: > On Tue, 28 Mar 2017, Stefan Beller wrote: > &

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

2017-03-30 Thread Daniel Ferreira (theiostream)
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, at the top of a block. (

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

2017-03-30 Thread Daniel Ferreira (theiostream)
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 file, the reader will be >

[PATCH v5 5/6] remove_subtree(): reimplement using iterators

2017-03-29 Thread Daniel Ferreira
From: Daniel Ferreira 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_each_reflog(): reimplement

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

2017-03-29 Thread Daniel Ferreira
() pass the tests. Signed-off-by: Daniel Ferreira --- 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-cache-clash.sh +++ b/t/t2000

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

2017-03-29 Thread Daniel Ferreira
. Signed-off-by: Daniel Ferreira --- Makefile | 1 + t/helper/test-dir-iterator.c | 32 +++ t/t0065-dir-iterator.sh | 45 3 files changed, 78 insertions(+) create mode 100644 t/helper/test-dir

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

2017-03-29 Thread Daniel Ferreira
dback 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

[PATCH v5 1/6] dir_iterator: add helpers to dir_iterator_advance

2017-03-29 Thread Daniel Ferreira
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 --- dir-iterator.c | 65 +- 1 file changed, 42 insertions(+

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

2017-03-29 Thread Daniel Ferreira
ntents have been wiped. Amend a call to dir_iterator_begin() to pass the flags parameter introduced. Signed-off-by: Daniel Ferreira --- dir-iterator.c | 53 dir-iterator.h | 17 - refs/files-backend.c | 2 +-

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

2017-03-29 Thread Daniel Ferreira
Signed-off-by: Daniel Ferreira --- 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-iterator.h"

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

2017-03-28 Thread Daniel Ferreira
-05-21). Signed-off-by: Daniel Ferreira --- 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" #include "dir.h

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

2017-03-28 Thread Daniel Ferreira
tents have been wiped. Signed-off-by: Daniel Ferreira --- 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..545d333 100644

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

2017-03-28 Thread Daniel Ferreira
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 --- refs/files-backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/

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

2017-03-28 Thread Daniel Ferreira
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 --- dir-iterator.c | 65 +- 1 file changed, 42 insertions(+

[PATCH v4 0/5] [GSoC] remove_subtree(): reimplement using iterators

2017-03-28 Thread Daniel Ferreira
ll 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

[PATCH v4 4/5] remove_subtree(): test removing nested directories

2017-03-28 Thread Daniel Ferreira
() pass the tests. Signed-off-by: Daniel Ferreira --- 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-cache-clash.sh +++ b/t/t2000

  1   2   >