Re: [PATCH] add -p: coalesce hunks before testing applicability

2018-09-13 Thread Phillip Wood
Hi Jochen On 03/09/2018 20:01, Jochen Sprickerhof wrote: > Hi Phillip, > > * Phillip Wood [2018-08-30 14:47]: >> When $newhunk is created it is marked as dirty to prevent >> coalesce_overlapping_hunks() from coalescing it. This patch does not >> change that. What is h

[PATCH 2/3] add read_author_script() to libgit

2018-09-12 Thread Phillip Wood
From: Phillip Wood Add read_author_script() to sequencer.c based on the implementation in builtin/am.c and update read_am_author_script() to use read_author_script(). The sequencer code that reads the author script will be updated in the next commit. Signed-off-by: Phillip Wood --- builtin

[PATCH 1/3] am: rename read_author_script()

2018-09-12 Thread Phillip Wood
From: Phillip Wood Rename read_author_script() in preparation for adding a shared read_author_script() function to libgit. Signed-off-by: Phillip Wood --- builtin/am.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin/am.c b/builtin/am.c index 5e866d17c7

[PATCH 3/3] sequencer: use read_author_script()

2018-09-12 Thread Phillip Wood
From: Phillip Wood Use the new function to read the author script, updating read_env_script() and read_author_ident(). This means we now have a single code path that reads the author script and uses sq_dequote() to dequote it. This fixes potential problems with user edited scripts

[PATCH 0/3] am/rebase: share read_author_script()

2018-09-12 Thread Phillip Wood
From: Phillip Wood This is a follow up to pw/rebase-i-author-script-fix, it reduces code duplication and improves rebase's parsing of the author script. After this I'll do another series to share the code to write the author script. Phillip Wood (3): am: rename read_author_script() add

Re: [PATCH] diff: fix --color-moved-ws=allow-indentation-change

2018-09-11 Thread Phillip Wood
On 04/09/2018 19:51, Phillip Wood wrote: > Hi Stefan > > On 04/09/2018 19:08, Stefan Beller wrote: >> On Tue, Sep 4, 2018 at 6:53 AM Phillip Wood >> wrote: >>> >>> From: Phillip Wood >>> >>> If there is more than one potential moved

Re: [PATCH] diff: fix --color-moved-ws=allow-indentation-change

2018-09-04 Thread Phillip Wood
Hi Stefan On 04/09/2018 19:08, Stefan Beller wrote: On Tue, Sep 4, 2018 at 6:53 AM Phillip Wood wrote: From: Phillip Wood If there is more than one potential moved block and the longest block is not the first element of the array of potential blocks then the block is cut short

[PATCH] diff: fix --color-moved-ws=allow-indentation-change

2018-09-04 Thread Phillip Wood
From: Phillip Wood If there is more than one potential moved block and the longest block is not the first element of the array of potential blocks then the block is cut short. With --color-moved=blocks this can leave moved lines unpainted if the shortened block does not meet the block length

Re: [PATCH] add -p: coalesce hunks before testing applicability

2018-08-30 Thread Phillip Wood
Dear Jochen/Junio On 28/08/18 19:07, Junio C Hamano wrote: Jochen Sprickerhof writes: When a hunk was split before being edited manually, it does not apply anymore cleanly. Apply coalesce_overlapping_hunks() first to make it work. Enable test for it as well. Signed-off-by: Jochen

Re: Would a config var for --force-with-lease be useful?

2018-08-28 Thread Phillip Wood
Hi Johannes On 27/08/18 22:21, Johannes Schindelin wrote: Hi, On Sat, 25 Aug 2018, Constantin Weißer wrote: I think there are two aspects to using "force with lease". There is a third, very, very important aspect. When you use --force-with-lease (and I, for one, do, all the time), keep in

Re: Do not raise conflict when a code in a patch was already added

2018-08-20 Thread Phillip Wood
On 20/08/2018 11:22, Konstantin Kharlamov wrote: > So, steps-to-reproduce below rather full of trivia like setting up a > repo, but the TL;DR is: > > Upon using `git rebase -i HEAD~1` and then `git add -p` to add part of a > "hunk" as one commit, and then using `git rebase --continue` so the >

Re: What's cooking in git.git (Aug 2018, #04; Fri, 17)

2018-08-20 Thread Phillip Wood
On 17/08/2018 23:44, Junio C Hamano wrote: > Here are the topics that have been cooking. Commits prefixed with > '-' are only in 'pu' (proposed updates) while commits prefixed with > '+' are in 'next'. The ones marked with '.' do not appear in any of > the integration branches, but I am still

Re: [GSoC][PATCH v6 15/20] rebase -i: rewrite write_basic_state() in C

2018-08-17 Thread Phillip Wood
On 10/08/2018 17:51, Alban Gruin wrote: > This rewrites write_basic_state() from git-rebase.sh in C. This is the > first step in the conversion of init_basic_state(), hence the mode in > rebase--helper.c is called INIT_BASIC_STATE. init_basic_state() will be > converted in the next commit. > >

Re: [GSoC][PATCH v6 11/20] rebase -i: rewrite complete_action() in C

2018-08-17 Thread Phillip Wood
Hi Alban The interdiff from v5 to v6 looks good, I think the changes you have made the the other patches in this series are fine, I've just got a couple of small comments below about this one. Best Wishes Phillip On 10/08/2018 17:51, Alban Gruin wrote: > > This rewrites complete_action() from

Re: [PATCH] rebase -i: fix numbering in squash message

2018-08-15 Thread Phillip Wood
Hi Junio On 15/08/2018 19:05, Junio C Hamano wrote: > > Phillip Wood writes: > >> From: Phillip Wood >> >> Commit e12a7ef597 ("rebase -i: Handle "combination of commits" with >> GETTEXT_POISON", 2018-04-27) changed the way that indi

[PATCH] rebase -i: fix numbering in squash message

2018-08-15 Thread Phillip Wood
From: Phillip Wood Commit e12a7ef597 ("rebase -i: Handle "combination of commits" with GETTEXT_POISON", 2018-04-27) changed the way that individual commit messages are labelled when squashing commits together. In doing so a regression was introduced where the numbering of

[PATCH 1/2] t3430: add conflicting commit

2018-08-15 Thread Phillip Wood
From: Phillip Wood Move the creation of conflicting-G from a test to the setup so that it can be used in subsequent tests without creating the kind of implicit dependencies that plague t3404. While we're at it simplify the arguments to the test_commit() call the creates the conflicting commit

[PATCH 0/2] rebase -i: fix SIGSEGV when 'merge ' fails

2018-08-15 Thread Phillip Wood
From: Phillip Wood As they fix a bug these patches are based on maint. Unfortunately the second patch has semantic conflicts with master s/git_path_merge_msg()/git_path_merge_msg(the_repository)/ There are additional textual conflicts with pu/next due to some messages being marked

[PATCH 2/2] rebase -i: fix SIGSEGV when 'merge ' fails

2018-08-15 Thread Phillip Wood
From: Phillip Wood If a merge command in the todo list specifies just a branch to merge with no -C/-c argument then item->commit is NULL. This means that if there are merge conflicts error_with_patch() is passed a NULL commit which causes a segmentation fault when make_patch() tries to l

Re: Bug? Git won't apply a split hunk that went through a text editor

2018-08-10 Thread Phillip Wood
Hi Philip Thanks for CC'ing me Peff. On 10/08/18 19:27, Jeff King wrote: On Thu, Aug 09, 2018 at 08:17:36PM -0700, Philip White wrote: I’d like to report what I suspect is a bug in Git, tested in 2.18 and 2.14. (I’d be delighted to be corrected if it is my own misunderstanding.) I’m

Re: [GSoC][PATCH v5 04/20] rebase -i: rewrite the edit-todo functionality in C

2018-08-09 Thread Phillip Wood
Hi Alban On 09/08/18 16:35, Phillip Wood wrote: Hi Alban On 09/08/18 14:30, Alban Gruin wrote: Hi Phillip, Le 08/08/2018 à 18:04, Phillip Wood a écrit : +int edit_todo_list(unsigned flags) +{ +    struct strbuf buf = STRBUF_INIT; +    const char *todo_file = rebase_path_todo(); +    FILE

Re: [GSoC][PATCH v5 04/20] rebase -i: rewrite the edit-todo functionality in C

2018-08-09 Thread Phillip Wood
Hi Alban On 09/08/18 14:30, Alban Gruin wrote: Hi Phillip, Le 08/08/2018 à 18:04, Phillip Wood a écrit : +int edit_todo_list(unsigned flags) +{ +    struct strbuf buf = STRBUF_INIT; +    const char *todo_file = rebase_path_todo(); +    FILE *todo; + +    if (strbuf_read_file(, todo_file, 0

Re: [GSoC][PATCH v5 11/20] rebase -i: rewrite complete_action() in C

2018-08-09 Thread Phillip Wood
Hi Alban Its nice to see things coming together so that the rebase happens in the same process as the some of the todo file preparation. I've ended up making quite a few comments on the new implementation, but they're all little things, the basic idea looks sound to me. On 31/07/18 18:59,

Re: [PATCH v4 2/2] sequencer: fix quoting in write_author_script

2018-08-09 Thread Phillip Wood
On 08/08/18 10:39, Eric Sunshine wrote: > On Tue, Aug 7, 2018 at 5:35 AM Phillip Wood wrote: >> Single quotes should be escaped as \' not \\'. The bad quoting breaks >> the interactive version of 'rebase --root' (which is used when there >> is no '--onto' even if the

Re: [PATCH v4 2/2] sequencer: fix quoting in write_author_script

2018-08-09 Thread Phillip Wood
Hi Eric On 08/08/18 09:43, Eric Sunshine wrote: > On Tue, Aug 7, 2018 at 9:54 AM Phillip Wood wrote: >> On 07/08/18 11:23, Eric Sunshine wrote: >>> On Tue, Aug 7, 2018 at 5:35 AM Phillip Wood >>> wrote: >>>> + if (n > 0 &

Re: [PATCH v4 2/2] sequencer: fix quoting in write_author_script

2018-08-09 Thread Phillip Wood
Hi Junio On 08/08/18 17:01, Junio C Hamano wrote: > Eric Sunshine writes: > >> What does concern me is that read_env_script() doesn't seem to care >> about such a malformed file; it doesn't do any validation at all. >> Contrast that with read_author_ident() which is pretty strict about >> the

Re: [PATCH v2 2/2] rebase --exec: make it work with --rebase-merges

2018-08-09 Thread Phillip Wood
On 09/08/18 10:22, Johannes Schindelin wrote: > Hi Phillip, > > On Mon, 6 Aug 2018, Phillip Wood wrote: > >> On 06/08/18 10:52, Johannes Schindelin via GitGitGadget wrote: >>> >>> From: Johannes Schindelin >>> >>> The idea of `--exec` is to

Re: [GSoC][PATCH v5 04/20] rebase -i: rewrite the edit-todo functionality in C

2018-08-08 Thread Phillip Wood
On 08/08/18 16:17, Alban Gruin wrote: Hi Phillip, Le 07/08/2018 à 16:00, Phillip Wood a écrit : On 31/07/18 18:59, Alban Gruin wrote: + +int edit_todo_list(unsigned flags) +{ + struct strbuf buf = STRBUF_INIT; + const char *todo_file = rebase_path_todo(); + FILE *todo

Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-08 Thread Phillip Wood
Hi Alban On 08/08/18 16:16, Alban Gruin wrote: Hi Phillip, Le 07/08/2018 à 15:57, Phillip Wood a écrit : + if (ret < 0) + error_errno(_("could not append help text to '%s'"), rebase_path_todo()); + + fclose(todo); You should definitely check the

Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-07 Thread Phillip Wood
Hi Christian On 07/08/18 17:28, Christian Couder wrote: > On Tue, Aug 7, 2018 at 6:15 PM, Phillip Wood > wrote: >> On 07/08/18 16:25, Christian Couder wrote: >>> >>> I agree about checking the return value from fputs(), but it seems to >>> me that we

Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-07 Thread Phillip Wood
Hi Christian On 07/08/18 16:25, Christian Couder wrote: Hi Phillip, On Tue, Aug 7, 2018 at 3:57 PM, Phillip Wood wrote: On 31/07/18 18:59, Alban Gruin wrote: + + ret = fputs(buf.buf, todo); It is not worth changing the patch just for this but strbuf_write() might be clearer (you use

Re: [GSoC][PATCH v5 04/20] rebase -i: rewrite the edit-todo functionality in C

2018-08-07 Thread Phillip Wood
On 31/07/18 18:59, Alban Gruin wrote: > This rewrites the edit-todo functionality from shell to C. > > To achieve that, a new command mode, `edit-todo`, is added, and the > `write-edit-todo` flag is removed, as the shell script does not need to > write the edit todo help message to the todo list

Re: [GSoC][PATCH v5 02/20] rebase -i: rewrite append_todo_help() in C

2018-08-07 Thread Phillip Wood
Hi Alban On 31/07/18 18:59, Alban Gruin wrote: > This rewrites append_todo_help() from shell to C. It also incorporates > some parts of initiate_action() and complete_action() that also write > help texts to the todo file. > > This also introduces the source file rebase-interactive.c. This file

Re: [PATCH v4 2/2] sequencer: fix quoting in write_author_script

2018-08-07 Thread Phillip Wood
Hi Eric On 07/08/18 11:23, Eric Sunshine wrote: > On Tue, Aug 7, 2018 at 5:35 AM Phillip Wood wrote: >> - Reverted the implementation to v2 with more robust detection of the >>missing "'" on the last line of the author script based on a >>

[PATCH v4 0/2] fix author-script quoting

2018-08-07 Thread Phillip Wood
From: Phillip Wood I've updated these based on Eric's suggestions, hopefully they're good to go now. Thanks Eric for you help. Phillip Wood (2): sequencer: handle errors from read_author_ident() sequencer: fix quoting in write_author_script sequencer.c | 47

[PATCH v4 1/2] sequencer: handle errors from read_author_ident()

2018-08-07 Thread Phillip Wood
From: Phillip Wood Check for a NULL return value from read_author_ident() that indicates an error. Previously the NULL author was passed to commit_tree() which would then fallback to using the default author when creating the new commit. This changed the date and potentially the author

[PATCH v4 2/2] sequencer: fix quoting in write_author_script

2018-08-07 Thread Phillip Wood
From: Phillip Wood Single quotes should be escaped as \' not \\'. The bad quoting breaks the interactive version of 'rebase --root' (which is used when there is no '--onto' even if the user does not specify --interactive) for authors that contain "'" as sq_dequote() called by read_au

Re: [PATCH v2 2/2] rebase --exec: make it work with --rebase-merges

2018-08-06 Thread Phillip Wood
On 06/08/18 16:23, Phillip Wood wrote: Hi Johannes On 06/08/18 10:52, Johannes Schindelin via GitGitGadget wrote: From: Johannes Schindelin The idea of `--exec` is to append an `exec` call after each `pick`. Since the introduction of fixup!/squash! commits, this idea was extended to apply

Re: [PATCH v2 2/2] rebase --exec: make it work with --rebase-merges

2018-08-06 Thread Phillip Wood
Hi Johannes On 06/08/18 10:52, Johannes Schindelin via GitGitGadget wrote: From: Johannes Schindelin The idea of `--exec` is to append an `exec` call after each `pick`. Since the introduction of fixup!/squash! commits, this idea was extended to apply to "pick, possibly followed by a

Re: [PATCH v3 2/2] sequencer: fix quoting in write_author_script

2018-08-03 Thread Phillip Wood
Hi Eric On 03/08/18 11:02, Eric Sunshine wrote: On Fri, Aug 3, 2018 at 5:33 AM Phillip Wood wrote: If there isn't some backward compatibility then if git gets upgraded while rebase is stopped then the author data will be silently corrupted if it contains "'". read_author_ident() will

Re: [RFC PATCH v5 0/4] add -p: select individual hunk lines

2018-08-03 Thread Phillip Wood
Hi Ævar Thanks for looking at this. On 28/07/18 13:40, Ævar Arnfjörð Bjarmason wrote: > > On Thu, Jul 26 2018, Phillip Wood wrote: > >> Unfortuantely v4 had test failures due to a suprious brace from a last >> minute edit to a comment that I forgot to test. This vers

Re: [PATCH v3 2/2] sequencer: fix quoting in write_author_script

2018-08-03 Thread Phillip Wood
Dear Eric and Junio On 03/08/18 08:59, Eric Sunshine wrote: > On Thu, Aug 2, 2018 at 1:27 PM Junio C Hamano wrote: >> Phillip Wood writes: >>> For other interactive rebases this only affects external scripts that >>> read the author script and users whose git

[PATCH v3 1/2] sequencer: handle errors in read_author_ident()

2018-08-02 Thread Phillip Wood
From: Phillip Wood The calling code did not treat NULL as an error. Instead NULL caused it to fallback to using the default author when creating the new commit. This changed the date and potentially the author of the commit which corrupted the author data compared to its expected value. Fix

[PATCH v3 2/2] sequencer: fix quoting in write_author_script

2018-08-02 Thread Phillip Wood
From: Phillip Wood Single quotes should be escaped as \' not \\'. The bad quoting breaks the interactive version of 'rebase --root' (which is used when there is no '--onto' even if the user does not specify --interactive) for authors that contain "'" as sq_dequote() called read_au

[PATCH v3 0/2] Fix author script quoting

2018-08-02 Thread Phillip Wood
From: Phillip Wood Thanks to Eric for his comments on v2. The first patch hasn't changed much, the second one quite a bit. See the individual patches for a list of changes Phillip Wood (2): sequencer: handle errors in read_author_ident() sequencer: fix quoting in write_author_script git

Re: [PATCH v2 2/2] sequencer: fix quoting in write_author_script

2018-08-01 Thread Phillip Wood
On 31/07/18 22:39, Eric Sunshine wrote: On Tue, Jul 31, 2018 at 7:15 AM Phillip Wood wrote: Single quotes should be escaped as \' not \\'. Note that this only affects authors that contain a single quote and then only external scripts that read the author script and users whose git is upgraded

Re: [PATCH v2 2/2] sequencer: fix quoting in write_author_script

2018-08-01 Thread Phillip Wood
Hi Eric On 31/07/18 22:39, Eric Sunshine wrote: On Tue, Jul 31, 2018 at 7:15 AM Phillip Wood wrote: Single quotes should be escaped as \' not \\'. Note that this only affects authors that contain a single quote and then only external scripts that read the author script and users whose git

Re: [PATCH v2 1/2] sequencer: handle errors in read_author_ident()

2018-08-01 Thread Phillip Wood
Hi Eric Thanks for taking a look at this On 31/07/18 21:47, Eric Sunshine wrote: On Tue, Jul 31, 2018 at 7:15 AM Phillip Wood wrote: The calling code treated NULL as a valid return value, so fix this by returning and integer and passing in a parameter to receive the author. It might

Re: [PATCH v2 0/4] fix "rebase -i --root" corrupting root commit

2018-07-31 Thread Phillip Wood
Hi Eric On 31/07/18 11:46, Eric Sunshine wrote: > On Tue, Jul 31, 2018 at 6:06 AM Phillip Wood > wrote: >> On 31/07/18 08:33, Eric Sunshine wrote: >>> Patch 2/4 of this series conflicts with Akinori MUSHA's >>> 'am/sequencer-author-script-fix' which takes a stab

[PATCH v2 1/2] sequencer: handle errors in read_author_ident()

2018-07-31 Thread Phillip Wood
From: Phillip Wood The calling code treated NULL as a valid return value, so fix this by returning and integer and passing in a parameter to receive the author. Signed-off-by: Phillip Wood --- sequencer.c | 49 ++--- 1 file changed, 26 insertions

[PATCH v2 2/2] sequencer: fix quoting in write_author_script

2018-07-31 Thread Phillip Wood
From: Phillip Wood Single quotes should be escaped as \' not \\'. Note that this only affects authors that contain a single quote and then only external scripts that read the author script and users whose git is upgraded from the shell version of rebase -i while rebase was stopped

[PATCH v2 0/2] Fix author script quoting

2018-07-31 Thread Phillip Wood
From: Phillip Wood These build on Eric's patches. The first patch would be better if it was integrated into Eric's patches. The second is a rebased version of my previous patch for fixing quoting in the author script with some additions by Johannes and rebased on top of Eric's fixes. The special

Re: [PATCH v2 0/4] fix "rebase -i --root" corrupting root commit

2018-07-31 Thread Phillip Wood
Hi Eric On 31/07/18 08:33, Eric Sunshine wrote: This is a re-roll of [1] which fixes sequencer bugs resulting in commit object corruption when "rebase -i --root" swaps in a new commit as root. Unfortunately, those bugs made it into v2.18.0 and have already corrupted at least one repository (a

Re: [PATCH v2 4/4] sequencer: don't die() on bogus user-edited timestamp

2018-07-31 Thread Phillip Wood
On 31/07/18 08:33, Eric Sunshine wrote: read_author_ident() is careful to handle errors "gently" when parsing "rebase-merge/author-script" by printing a suitable warning and returning NULL; it never die()'s. One possible reason that parsing might fail is that "rebase-merge/author-script" has

Re: [PATCH v2 3/4] sequencer: fix "rebase -i --root" corrupting author header timestamp

2018-07-31 Thread Phillip Wood
On 31/07/18 08:33, Eric Sunshine wrote: When "git rebase -i --root" creates a new root commit, it corrupts the "author" header's timestamp by prepending a "@": author A U Thor @1112912773 -0700 The commit parser is very strict about the format of the "author" header, and does not allow a

Re: [PATCH v2 2/4] sequencer: fix "rebase -i --root" corrupting author header timezone

2018-07-31 Thread Phillip Wood
On 31/07/18 08:33, Eric Sunshine wrote: When "git rebase -i --root" creates a new root commit, it corrupts the "author" header's timezone by repeating the last digit: author A U Thor @1112912773 -07000 This is due to two bugs. First, write_author_script() neglects to add the closing

Re: [PATCH 2/2] sequencer: fix "rebase -i --root" corrupting author header timezone

2018-07-30 Thread Phillip Wood
Hi Eric On 30/07/18 10:29, Eric Sunshine wrote: > When "git rebase -i --root" creates a new root commit, it corrupts the > "author" header's timezone by repeating the last digit: > > author A U Thor @1112912773 -07000 > > This is due to two bugs. > > First, write_author_script() neglects

Re: [PATCH 0/2] fix "rebase -i --root" corrupting root commit

2018-07-30 Thread Phillip Wood
On 30/07/18 10:29, Eric Sunshine wrote: > This series fixes bugs causing corruption of the root commit when > "rebase -i --root" is used to swap in a new root commit. In particular, > the "author" header has trailing garbage. Some tools handle the > corruption somewhat gracefully by showing a

Re: [RFC PATCH] sequencer: fix quoting in write_author_script

2018-07-30 Thread Phillip Wood
On 27/07/18 13:37, Johannes Schindelin wrote: > Hi Phillip, Junio and Akinori, > > I just noticed that t3404 is broken without my patches (but with Junio's > fixup), on Windows, macOS and Linux. (See log at the end.) > > On Fri, 27 Jul 2018, Phillip Wood wrote: > >>

Re: [RFC PATCH v5 0/4] add -p: select individual hunk lines

2018-07-28 Thread Phillip Wood
On 27/07/18 19:27, Ævar Arnfjörð Bjarmason wrote: > > On Thu, Jul 26 2018, Phillip Wood wrote: > >> From: Phillip Wood >> >> Unfortuantely v4 had test failures due to a suprious brace from a last >> minute edit to a comment that I forgot to test. This ve

Re: [RFC PATCH] sequencer: fix quoting in write_author_script

2018-07-27 Thread Phillip Wood
Hi Johannes On 26/07/18 13:33, Johannes Schindelin wrote: > Hi Phillip, > > On Wed, 18 Jul 2018, Phillip Wood wrote: > >> From: Phillip Wood >> >> Single quotes should be escaped as \' not \\'. Note that this only >> affects authors that contain a single quo

Re: [RFC PATCH v5 2/4] add -p: select modified lines correctly

2018-07-27 Thread Phillip Wood
Hi Junio, thanks for the comments On 26/07/18 20:30, Junio C Hamano wrote: > Phillip Wood writes: > > An interesting problem you are solving ;-) > >> For example given the hunk >> 1 -* a longer description of the >> 2 - first item >>

Re: [PATCH v5 1/4] add -p: select individual hunk lines

2018-07-27 Thread Phillip Wood
On 26/07/18 20:36, Junio C Hamano wrote: > Phillip Wood writes: > >> +sub label_hunk_lines { >> +my $hunk = shift; >> +my $text = $hunk->{TEXT}; >> +my (@line_flags, @lines); >> +my ($block, $label, $last_mode) = (0, 0, ''); >>

[PATCH v5 3/4] add -p: allow line selection to be inverted

2018-07-26 Thread Phillip Wood
From: Phillip Wood If the list of lines to be selected begins with '-' select all the lines except the ones listed. Signed-off-by: Phillip Wood --- Documentation/git-add.txt | 3 ++- git-add--interactive.perl | 19 +++ t/t3701-add-interactive.sh | 2 +- 3 files changed, 22

[PATCH v5 1/4] add -p: select individual hunk lines

2018-07-26 Thread Phillip Wood
From: Phillip Wood When I end up editing hunks it is almost always because I want to stage a subset of the lines in the hunk. Doing this by editing the hunk is inconvenient and error prone (especially so if the patch is going to be reversed before being applied). Instead offer an option for add

[PATCH v5 4/4] add -p: optimize line selection for short hunks

2018-07-26 Thread Phillip Wood
From: Phillip Wood If there are fewer than ten changes in a hunk then make spaces optional when selecting individual lines. This means that for short hunks one can just type 1-357 to stage lines 1, 2, 3, 5 & 7. Signed-off-by: Phillip Wood --- Documentation/git-add.txt | 9 + git

[RFC PATCH v5 2/4] add -p: select modified lines correctly

2018-07-26 Thread Phillip Wood
From: Phillip Wood When a set of lines is modified the hunk contains deletions followed by insertions. To correctly stage a subset of the modified lines we need to match up the selected deletions with the selected insertions otherwise we end up with deletions and context lines followed

[RFC PATCH v5 0/4] add -p: select individual hunk lines

2018-07-26 Thread Phillip Wood
From: Phillip Wood Unfortuantely v4 had test failures due to a suprious brace from a last minute edit to a comment that I forgot to test. This version fixes that, my applogies for the patch churn. I've updated this series based on Ævar's feedback on v3 (to paraphrase stop using '$_' so much

[RFC PATCH v4 0/4] add -p: select individual hunk lines

2018-07-26 Thread Phillip Wood
From: Phillip Wood I've updated this series based on Ævar's feedback on v3 (to paraphrase stop using '$_' so much and fix staging modified lines.). The first patch is functionally equivalent to the previous version but with a reworked implementation. Patch 2 is new, it implements correctly

[PATCH v4 4/4] add -p: optimize line selection for short hunks

2018-07-26 Thread Phillip Wood
From: Phillip Wood If there are fewer than ten changes in a hunk then make spaces optional when selecting individual lines. This means that for short hunks one can just type 1-357 to stage lines 1, 2, 3, 5 & 7. Signed-off-by: Phillip Wood --- Documentation/git-add.txt | 9 + git

[PATCH v4 1/4] add -p: select individual hunk lines

2018-07-26 Thread Phillip Wood
From: Phillip Wood When I end up editing hunks it is almost always because I want to stage a subset of the lines in the hunk. Doing this by editing the hunk is inconvenient and error prone (especially so if the patch is going to be reversed before being applied). Instead offer an option for add

[RFC PATCH v4 2/4] add -p: select modified lines correctly

2018-07-26 Thread Phillip Wood
From: Phillip Wood When a set of lines is modified the hunk contains deletions followed by insertions. To correctly stage a subset of the modified lines we need to match up the selected deletions with the selected insertions otherwise we end up with deletions and context lines followed

[PATCH v4 3/4] add -p: allow line selection to be inverted

2018-07-26 Thread Phillip Wood
From: Phillip Wood If the list of lines to be selected begins with '-' select all the lines except the ones listed. Signed-off-by: Phillip Wood --- Documentation/git-add.txt | 3 ++- git-add--interactive.perl | 19 +++ t/t3701-add-interactive.sh | 2 +- 3 files changed, 22

Re: [PATCH] sequencer.c: terminate the last line of author-script properly

2018-07-19 Thread Phillip Wood
Hi Junio On 18/07/18 18:17, Junio C Hamano wrote: > Phillip Wood writes: > >>> (I think we had code to do so in "git am" >>> that was rewritten in C first). >> >> The code in builtin/am.c doesn't try to write valid posix shell (if >> one

[RFC PATCH] sequencer: fix quoting in write_author_script

2018-07-18 Thread Phillip Wood
From: Phillip Wood Single quotes should be escaped as \' not \\'. Note that this only affects authors that contain a single quote and then only external scripts that read the author script and users whose git is upgraded from the shell version of rebase -i while rebase was stopped

Re: [PATCH] sequencer.c: terminate the last line of author-scriptproperly

2018-07-18 Thread Phillip Wood
On 18/07/18 14:50, Phillip Wood wrote: Hi Akinori On 12/07/18 12:18, Akinori MUSHA wrote: It looks like write_author_script() intends to write out a file in Bourne shell syntax, but it doesn't put a closing single quote on the last line. This patch makes .git/rebase-merge/author-script

Re: [PATCH] sequencer.c: terminate the last line of author-script properly

2018-07-18 Thread Phillip Wood
Hi Akinori On 12/07/18 12:18, Akinori MUSHA wrote: It looks like write_author_script() intends to write out a file in Bourne shell syntax, but it doesn't put a closing single quote on the last line. This patch makes .git/rebase-merge/author-script actually parsable by sh(1) by adding a single

Re: [PATCH] sequencer.c: terminate the last line of author-scriptproperly

2018-07-18 Thread Phillip Wood
On 18/07/18 10:45, Phillip Wood wrote: Hi Junio On 12/07/18 18:22, Junio C Hamano wrote: "Akinori MUSHA" writes: It looks like write_author_script() intends to write out a file in Bourne shell syntax, but it doesn't put a closing single quote on the last line. s/closing si

Re: [PATCH] sequencer.c: terminate the last line of author-script properly

2018-07-18 Thread Phillip Wood
Hi Junio On 12/07/18 18:22, Junio C Hamano wrote: "Akinori MUSHA" writes: It looks like write_author_script() intends to write out a file in Bourne shell syntax, but it doesn't put a closing single quote on the last line. s/closing single quote/& and the terminating newline/? This

Re: [PATCH] sequencer.c: terminate the last line of author-script properly

2018-07-18 Thread Phillip Wood
Hi Akinori On 12/07/18 12:18, Akinori MUSHA wrote: It looks like write_author_script() intends to write out a file in Bourne shell syntax, but it doesn't put a closing single quote on the last line. This patch makes .git/rebase-merge/author-script actually parsable by sh(1) by adding a single

Re: [PATCH v5 0/9] Document/fix/warn about rebase incompatibilities and inconsistencies

2018-06-29 Thread Phillip Wood
Hi Elijah On 27/06/18 08:23, Elijah Newren wrote: > git-rebase has lots of options that are mutually incompatible. Even among > aspects of its behavior that is common to all rebase types, it has a number > of inconsistencies. This series tries to document, fix, and/or warn users > about many of

[PATCH v3] sequencer: do not squash 'reword' commits when we hit conflicts

2018-06-19 Thread Phillip Wood
From: Phillip Wood Ever since commit 18633e1a22 ("rebase -i: use the rebase--helper builtin", 2017-02-09), when a commit marked as 'reword' in an interactive rebase has conflicts and fails to apply, when the rebase is resumed that commit will be squashed into its parent with its comm

Re: [PATCH v2] sequencer: do not squash 'reword' commits when wehit conflicts

2018-06-19 Thread Phillip Wood
Hi Johannes On 18/06/18 22:42, Johannes Schindelin wrote: > > Hi Phillip, > > On Mon, 18 Jun 2018, Phillip Wood wrote: > >> On 17/06/18 20:28, Johannes Schindelin wrote: >>> >>> On Sun, 17 Jun 2018, Phillip Wood wrote: >>> >>>> On

Re: [GSoC][PATCH 3/3] rebase -i: rewrite checkout_onto() in C

2018-06-18 Thread Phillip Wood
Hi Alban On 18/06/18 14:18, Alban Gruin wrote: This rewrites checkout_onto() from shell to C. A new command (“checkout-onto”) is added to rebase--helper.c. The shell version is then stripped. Signed-off-by: Alban Gruin --- builtin/rebase--helper.c | 7 ++-

Re: [GSoC][PATCH 2/3] rebase -i: rewrite setup_reflog_action() in C

2018-06-18 Thread Phillip Wood
On 18/06/18 14:18, Alban Gruin wrote: This rewrites setup_reflog_action() from shell to C. A new command is added to rebase--helper.c, “setup-reflog”, as such as a new flag, “verbose”, to silence the output of the checkout operation called by setup_reflog_action(). I'm having difficulty

Re: [GSoC][PATCH 1/3] sequencer: add a new function to silence a command, except if it fails.

2018-06-18 Thread Phillip Wood
Hi Alban On 18/06/18 14:18, Alban Gruin wrote: This adds a new function, run_command_silent_if_successful(), to redirect the stdout and stderr of a command to a strbuf, and then to run that command. This strbuf is printed only if the command fails. It is functionnaly similar to output() from

Re: [PATCH 1/2] rebase --root: demonstrate a bug while amending rootcommit messages

2018-06-18 Thread Phillip Wood
Hi Todd/Johannes On 15/06/18 05:31, Johannes Schindelin via GitGitGadget wrote: > > From: Todd Zullinger > > When splitting a repository, running `git rebase -i --root` to reword > the initial commit, Git dies with > > BUG: sequencer.c:795: root commit without message. > >

Re: [PATCH v2] sequencer: do not squash 'reword' commits when we hit conflicts

2018-06-18 Thread Phillip Wood
Hi Johannes On 17/06/18 20:28, Johannes Schindelin wrote: > Hi Phillip, > > On Sun, 17 Jun 2018, Phillip Wood wrote: > >> On 17/06/18 06:37, Elijah Newren wrote: >>> Ever since commit 18633e1a22 ("rebase -i: use the rebase--helper builtin", >>>

Re: [RFC PATCH v2 0/7] Document/fix/warn about rebase incompatibilities and inconsistences

2018-06-17 Thread Phillip Wood
Hi Elijah On 17/06/18 06:58, Elijah Newren wrote: git-rebase has lots of options that are mutually incompatible. Even among aspects of its behavior that is common to all rebase types, it has a number of inconsistencies. This series tries to document, fix, and/or warn users about many of

Re: [RFC PATCH v2 1/7] git-rebase.txt: document incompatible options

2018-06-17 Thread Phillip Wood
Hi Elijah On 17/06/18 06:58, Elijah Newren wrote: git rebase has many options that only work with one of its three backends. It also has a few other pairs of incompatible options. Document these. Signed-off-by: Elijah Newren --- Documentation/git-rebase.txt | 84

Re: [RFC PATCH v2 7/7] git-rebase: make --allow-empty-message the default

2018-06-17 Thread Phillip Wood
Hi Elijah On 17/06/18 06:58, Elijah Newren wrote: am-based rebases already apply commits with an empty commit message without requiring the user to specify an extra flag. Make merge-based and interactive-based rebases behave the same. Signed-off-by: Elijah Newren ---

Re: [PATCH v2] sequencer: do not squash 'reword' commits when we hit conflicts

2018-06-17 Thread Phillip Wood
Hi Elijah, On 17/06/18 06:37, Elijah Newren wrote: Ever since commit 18633e1a22 ("rebase -i: use the rebase--helper builtin", 2017-02-09), when a commit marked as 'reword' in an interactive rebase has conflicts and fails to apply, when the rebase is resumed that commit will be squashed into its

Re: [GSoC][PATCH v2 0/2] rebase -i: rewrite the edit-todo functionality in C

2018-06-14 Thread Phillip Wood
Hi Alban On 13/06/18 16:22, Alban Gruin wrote: > This patch rewrites the edit-todo functionality from shell to C. This is > part of the effort to rewrite interactive rebase in C. > > Changes since v1: > > - Add a new function to launch the sequence editor, as advised by &

Re: [GSoC][PATCH 1/1] rebase--interactive: rewrite the edit-todo functionality in C

2018-06-12 Thread Phillip Wood
Hi Alban On 12/06/18 13:33, Alban Gruin wrote: Hi Phillip, Le 11/06/2018 à 17:32, Phillip Wood a écrit : +    if (launch_editor(todo_file, NULL, NULL)) I'm not sure that this will respect GIT_SEQUENCE_EDITOR, it would be nice to have a launch_sequence_editor() function that shared as much

Re: [PATCH] git-rebase.sh: handle keep-empty like all other options

2018-06-12 Thread Phillip Wood
On 11/06/18 17:08, Elijah Newren wrote: > Hi Phillip, > > On Mon, Jun 11, 2018 at 8:16 AM, Phillip Wood > wrote: >> On 11/06/18 15:42, Elijah Newren wrote: > >>> However, we have a bigger problem with empty commits, in that there >>>

Re: [PATCH 2/2] git-rebase: error out when incompatible options passed

2018-06-12 Thread Phillip Wood
On 11/06/18 16:49, Elijah Newren wrote: > Another thing I missed... > > On Sun, Jun 10, 2018 at 12:40 PM, Phillip Wood > wrote: >> On 07/06/18 06:06, Elijah Newren wrote: > >>> Some exceptions I left out: >>> >>>* --merge and

Re: [PATCH 2/2] git-rebase: error out when incompatible options passed

2018-06-11 Thread Phillip Wood
On 11/06/18 16:19, Elijah Newren wrote: Hi Phillip On Sun, Jun 10, 2018 at 12:40 PM, Phillip Wood wrote: Documentation/git-rebase.txt | 15 +-- git-rebase.sh | 17 + t/t3422-rebase-incompatible-options.sh | 10

Re: [GSoC][PATCH 1/1] rebase--interactive: rewrite the edit-todo functionality in C

2018-06-11 Thread Phillip Wood
Hi Alban, it's great to see you making progress with this. I don't want to add to your workload but a couple of things that might be nice to have in the future would be 1) avoid rewriting the todo list and running the editor if GIT_SEQUENCE_EDITOR is ':', especially when creating the todo

Re: [PATCH] git-rebase.sh: handle keep-empty like all other options

2018-06-11 Thread Phillip Wood
Hi Elijah On 11/06/18 15:42, Elijah Newren wrote: Hi Phillip, On Sun, Jun 10, 2018 at 12:26 PM, Phillip Wood wrote: On 07/06/18 06:07, Elijah Newren wrote: Signed-off-by: Elijah Newren --- git-rebase.sh | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/git

Re: [RFC PATCH 2/3] rebase: Implement --merge via git-rebase--interactive

2018-06-11 Thread Phillip Wood
Hi Elijah On 10/06/18 02:14, Elijah Newren wrote: > > Hi Dscho, > > On Sat, Jun 9, 2018 at 3:04 PM, Johannes Schindelin > wrote: >> On Thu, 7 Jun 2018, Elijah Newren wrote: >> >>> diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt >>> index 451252c173..28d1658d7a 100644

<    1   2   3   4   5   6   >