[PATCH 1/5] Git.pm Add unquote_path()

2017-06-22 Thread Phillip Wood
From: Phillip Wood Add unquote_path() from git-add--interactive so it can be used by other scripts. Note this is a straight copy, it does not handle '\a'. That will be fixed in the next commit Signed-off-by: Phillip Wood --- perl/G

[PATCH 0/5] Move unquote_path() from git-add--interactive.perl to Git.pm

2017-06-22 Thread Phillip Wood
From: Phillip Wood I'm using this in some scripts and it would be more convenient to have it available from Git.pm rather than copying and pasting it each time I need it. I think it should be useful to other people using Git.pm as well. It is not uncommon to get a quoted path back from a co

Re: [PATCH v3 0/4] Add regression tests for recent rebase -i fixes

2017-06-23 Thread Phillip Wood
have 1 known breakage(s) # passed all remaining 95 test(s) 1..96 Also as far as I can see it passes on travis - https://travis-ci.org/git/git/jobs/245990993#L910 have I missed something? Do you want me to submit a fixup patch for t3420 or have you got one already? Thanks Phillip > Thanks.

Re: [PATCH v3 0/4] Add regression tests for recent rebase -i fixes

2017-06-26 Thread Phillip Wood
Oh, that explains it, I was pretty sure the reflog messages were not translated so couldn't understand why it would fail under GETTEXT_POISON=YesPlease > So we can safely merge this topic down. That's great, thanks for taking the time to track down the reason for the test failure Best Wishes Phillip

Re: [PATCH v3 0/4] Add regression tests for recent rebase -i fixes

2017-06-26 Thread Phillip Wood
On 23/06/17 20:01, Junio C Hamano wrote: > Junio C Hamano writes: > >> For 3420, I can wrap the two-liner patch I showed here earlier into >> a commit on top of the series. > > So, here is what I'll queue on top before merging the topic down to > 'master'. Thanks for creating this fixup, I'll

[PATCH 3/4] Git::unquote_path() throw an exception on bad path

2017-06-30 Thread Phillip Wood
From: Phillip Wood This is what the other routines in Git.pm do if there's an error. Signed-off-by: Phillip Wood --- perl/Git.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/perl/Git.pm b/perl/Git.pm index f075b500c510d183074c0358fb24fefc722

[PATCH 1/4] add -i move unquote_path() to Git.pm

2017-06-30 Thread Phillip Wood
From: Phillip Wood Move unquote_path() from git-add--interactive to Git.pm so it can be used by other scripts. Note this is a straight copy, it does not handle '\a'. That will be fixed in the next commit. Signed-off-by: Phillip Wood --- git-add--interactive

[PATCH 2/4] Git::unquote_path() Handle '\a'

2017-06-30 Thread Phillip Wood
From: Phillip Wood The version copied from git-add--interactive did not handle quoted paths containing '\a'. Signed-off-by: Phillip Wood --- perl/Git.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/perl/Git.pm b/perl/Gi

[PATCH 4/4] Add tests for Git::unquote_path()

2017-06-30 Thread Phillip Wood
From: Phillip Wood Check that unquote_path() handles spaces and escape sequences properly Signed-off-by: Phillip Wood --- t/t9700/test.pl | 7 +++ 1 file changed, 7 insertions(+) diff --git a/t/t9700/test.pl b/t/t9700/test.pl index 1b75c919651a8126e2a327f3d9645d4377823726

[PATCH 0/4] Move unquote_path from git-add--interactive.perl to Git.pm

2017-06-30 Thread Phillip Wood
From: Phillip Wood Thanks for the review Junio, I've amended the patches as you suggested. The first patch now removes unquote_path() from add -i as well as adding it to Git.pm. I've fixed the naming issues (the version I sent previously was copied from another script rather than dir

Re: [PATCH 0/5] Move unquote_path() from git-add--interactive.perl to Git.pm

2017-06-30 Thread Phillip Wood
On 23/06/17 00:18, Jeff King wrote: > On Thu, Jun 22, 2017 at 11:26:17AM +0100, Phillip Wood wrote: > >> From: Phillip Wood >> >> I'm using this in some scripts and it would be more convenient to have >> it available from Git.pm rather than copying and pasting

[PATCH v2 1/2] t7505: Add tests for cherry-pick and rebase -i/-p

2018-01-23 Thread Phillip Wood
From: Phillip Wood Check that cherry-pick and rebase call the 'prepare-commit-msg' hook correctly. The expected values for the hook arguments are taken to match the current master branch. I think there is scope for improving the arguments passed so they make a bit more sense - fo

[PATCH v2 2/2] sequencer: run 'prepare-commit-msg' hook

2018-01-23 Thread Phillip Wood
From: Phillip Wood Commit 356ee4659b ("sequencer: try to commit without forking 'git commit'", 2017-11-24) forgot to run the 'prepare-commit-msg' hook when creating the commit. Fix this by writing the commit message to a different file and running the hook. Using

[PATCH v2 0/2] sequencer: run 'prepare-commit-msg' hook​

2018-01-23 Thread Phillip Wood
From: Phillip Wood I've updated the patches in response to comments, there are just a couple of small changes. Thanks to Ramsay and Eric for their reviews. Best Wishes Phillip Original cover letter: These two patches add some tests and fix the sequencer to run the 'prepare-commit

Re: [PATCH 3/8] sequencer: fast-forward merge commits, if possible

2018-01-24 Thread Phillip Wood
On 23/01/18 19:12, Junio C Hamano wrote: Phillip Wood writes: On 18/01/18 15:35, Johannes Schindelin wrote: Just like with regular `pick` commands, if we are trying to recreate a merge commit, we now test whether the parents of said commit match HEAD and the commits to be merged, and fast

[PATCH v3 0/3] sequencer: run 'prepare-commit-msg' hook

2018-01-24 Thread Phillip Wood
From: Phillip Wood The new test and the test hook scripts has been updated with some style fixes spotted by Junio. I've added an extra commit at the beginning to update the style of the original hook, so my later changes are clearer. Original cover letter: These two patches add some test

[PATCH v3 3/3] sequencer: run 'prepare-commit-msg' hook

2018-01-24 Thread Phillip Wood
From: Phillip Wood Commit 356ee4659b ("sequencer: try to commit without forking 'git commit'", 2017-11-24) forgot to run the 'prepare-commit-msg' hook when creating the commit. Fix this by writing the commit message to a different file and running the hook. Using

[PATCH v3 1/3] t7505: style fixes

2018-01-24 Thread Phillip Wood
From: Phillip Wood Fix the indentation and style of the hook script in preparation for further changes. Signed-off-by: Phillip Wood --- t/t7505-prepare-commit-msg-hook.sh | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/t/t7505-prepare-commit-msg-hook.sh b/t

[PATCH v3 2/3] t7505: Add tests for cherry-pick and rebase -i/-p

2018-01-24 Thread Phillip Wood
From: Phillip Wood Check that cherry-pick and rebase call the 'prepare-commit-msg' hook correctly. The expected values for the hook arguments are taken to match the current master branch. I think there is scope for improving the arguments passed so they make a bit more sense - fo

Re: [PATCH v3 3/3] sequencer: run 'prepare-commit-msg' hook

2018-01-25 Thread Phillip Wood
On 24/01/18 18:59, Junio C Hamano wrote: Ramsay Jones writes: On 24/01/18 12:34, Phillip Wood wrote: From: Phillip Wood Commit 356ee4659b ("sequencer: try to commit without forking 'git commit'", 2017-11-24) forgot to run the 'prepare-commit-msg' hook when cr

Re: [PATCH 2/2] rebase: add --show-patch

2018-01-26 Thread Phillip Wood
t > diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh > index 06a4723d4d..5c513a9736 100644 > --- a/git-rebase--merge.sh > +++ b/git-rebase--merge.sh > @@ -137,6 +137,10 @@ skip) > finish_rb_merge > return > ;; > +show-patch) > + cmt="$(cat "$state_dir/current")" > + exec git format-patch --subject-prefix= --stdout "${cmt}^!" > + ;; > esac Here and in the git-rebase--interactive you have access to the SHA of the failed pick so you could run git log --patch and git colored output and it would use the pager in the same way as 'git am --show-patch' does Best Wishes Phillip

Re: [PATCH 2/2] rebase: add --show-patch

2018-01-30 Thread Phillip Wood
On 26/01/18 11:22, Duy Nguyen wrote: > On Fri, Jan 26, 2018 at 6:12 PM, Phillip Wood > wrote: >>> diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh >>> index 06a4723d4d..5c513a9736 100644 >>> --- a/git-rebase--merge.sh >>> +++ b/git-reba

Re: [PATCH 2/8] sequencer: introduce the `merge` command

2018-01-31 Thread Phillip Wood
On 31/01/18 13:48, Johannes Schindelin wrote: > Hi Jake & Phillip, > > On Mon, 29 Jan 2018, Johannes Schindelin wrote: > >> On Sat, 20 Jan 2018, Jacob Keller wrote: >> >>> On Fri, Jan 19, 2018 at 6:45 AM, Phillip Wood >>> wrote: >

Re: [PATCH v2 02/10] sequencer: introduce new commands to reset therevision

2018-01-31 Thread Phillip Wood
getting too long, or label re-use, because the directory containing all >> these helper files will be deleted upon successful rebase in >> `sequencer_remove_state()`. > > Yes. > It might be a good idea to have 'git rebase --abort' delete the refs as well as the file though Best Wishes Phillip

Re: [PATCH v2 3/3] rebase: introduce and use pseudo-ref ORIG_COMMIT

2018-02-01 Thread Phillip Wood
uot;$state_dir" > echo "$onto_name" > "$state_dir/onto_name" > write_basic_state > +rm -f "$(git rev-parse --git-path ORIG_COMMIT)" > > msgnum=0 > for cmt in $(git rev-list --reverse --no-merges "$revisions") > diff --git a/git-rebase.sh b/git-rebase.sh > index 41c915d18c..1db4301b90 100755 > --- a/git-rebase.sh > +++ b/git-rebase.sh > @@ -182,6 +182,7 @@ You can run "git stash pop" or "git stash drop" at any > time. > } > > finish_rebase () { > + rm -f "$(git rev-parse --git-path ORIG_COMMIT)" > apply_autostash && > { git gc --auto || true; } && > rm -rf "$state_dir" > diff --git a/sequencer.c b/sequencer.c > index 4d3f60594c..fe907a0701 100644 > --- a/sequencer.c > +++ b/sequencer.c > @@ -1792,6 +1792,8 @@ static int make_patch(struct commit *commit, struct > replay_opts *opts) > p = short_commit_name(commit); > if (write_message(p, strlen(p), rebase_path_stopped_sha(), 1) < 0) > return -1; > + update_ref("rebase", "ORIG_COMMIT", &commit->object.oid, > +NULL, 0, UPDATE_REFS_DIE_ON_ERR); The sequencer tries to return errors rather than dying so the caller can handle them. The other callers of update_ref pass UPDATE_REFS_MSG_ON_ERR Best Wishes Phillip

[PATCH 3/3] add -p: improve error messages

2018-02-13 Thread Phillip Wood
From: Phillip Wood If the user presses a key that isn't currently active then explain why it isn't active rather than just listing all the keys. It already did this for some keys, this patch does the same for the those that weren't already handled. Signed-off-by: Phillip Woo

[PATCH 0/3] add -p: improve help messages

2018-02-13 Thread Phillip Wood
From: Phillip Wood Improve the help displayed if the user presses an inactive key by only listing active keys and printing specific messages for some keys. Also disable search if there's only a single hunk. Phillip Wood (3): add -p: only display help for active keys add -p: Only bind s

[PATCH 1/3] add -p: only display help for active keys

2018-02-13 Thread Phillip Wood
From: Phillip Wood If the user presses a key that add -p wasn't expecting then it prints a list of key bindings. Although the prompt only lists the active bindings the help was printed for all bindings. Fix this by using the list of keys in the prompt to filter the help. Note that the li

[PATCH 2/3] add -p: Only bind search key if there's more than one hunk

2018-02-13 Thread Phillip Wood
From: Phillip Wood If there is only a single hunk then disable searching as there is nothing to search for. Also print a specific error message if the user tries to search with '/' when there's only a single hunk rather than just listing the key bindings. Signed-off-by: Phillip

[PATCH 0/4] Correct offsets of hunks when one is skipped

2018-02-13 Thread Phillip Wood
From: Phillip Wood While working on a patch series to stage selected lines from a hunk without having to edit it I got worried that subsequent patches would be applied in the wrong place which lead to this series to correct the offsets of hunks following those that are skipped or edited

[PATCH 3/4] add -p: Adjust offsets of subsequent hunks when one is skipped

2018-02-13 Thread Phillip Wood
From: Phillip Wood Since commit 8cbd431082 ("git-add--interactive: replace hunk recounting with apply --recount", 2008-7-2) if a hunk is skipped then we rely on the context lines to apply subsequent hunks in the right place. While this works most of the time it is possible for hunks

[PATCH 4/4] add -p: calculate offset delta for edited patches

2018-02-13 Thread Phillip Wood
From: Phillip Wood Recount the number of preimage and postimage lines in a hunk after it has been edited so any change in the number of insertions or deletions can be used to adjust the offsets of subsequent hunks. If an edited hunk is subsequently split then the offset correction will be lost

[PATCH 2/4] t3701: add failing test for pathological context lines

2018-02-13 Thread Phillip Wood
From: Phillip Wood When a hunk is skipped by add -i the offsets of subsequent hunks are not adjusted to account for any missing insertions due to the skipped hunk. Most of the time this does not matter as apply uses the context lines to apply the subsequent hunks in the correct place, however in

[PATCH 1/4] add -i: add function to format hunk header

2018-02-13 Thread Phillip Wood
From: Phillip Wood This code is duplicated in a couple of places so make it into a function as we're going to add some more callers shortly. Signed-off-by: Phillip Wood --- git-add--interactive.perl | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --

[PATCH v2 7/9] add -p: calculate offset delta for edited patches

2018-02-19 Thread Phillip Wood
From: Phillip Wood Recount the number of preimage and postimage lines in a hunk after it has been edited so any change in the number of insertions or deletions can be used to adjust the offsets of subsequent hunks. If an edited hunk is subsequently split then the offset correction will be lost

[PATCH v2 2/9] t3701: indent here documents

2018-02-19 Thread Phillip Wood
From: Phillip Wood Indent here documents in line with the current style for tests. Signed-off-by: Phillip Wood --- t/t3701-add-interactive.sh | 174 ++--- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/t/t3701-add-interactive.sh b/t

[PATCH v2 4/9] t3701: don't hard code sha1 hash values

2018-02-19 Thread Phillip Wood
From: Phillip Wood Purge the index lines from diffs so we're not hard coding sha1 hash values in the expected output. Signed-off-by: Phillip Wood --- t/t3701-add-interactive.sh | 32 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/t/t370

[PATCH v2 9/9] add -p: don't rely on apply's '--recount' option

2018-02-19 Thread Phillip Wood
From: Phillip Wood Now that add -p counts patches properly it should be possible to turn off the '--recount' option when invoking 'git apply' Signed-off-by: Phillip Wood --- Notes: I can't think of a reason why this shouldn't be OK but I can't help

[PATCH v2 0/9] Correct offsets of hunks when one is skipped

2018-02-19 Thread Phillip Wood
From: Phillip Wood Since v1 I've added some test cleanups for t3701, fixed the counting when splitting and coalescing hunks containing "\ No newline at end of file" lines and added a patch to remove '--recount' from the invocation of 'git apply'. There are min

[PATCH v2 3/9] t3701: use test_write_lines and write_script

2018-02-19 Thread Phillip Wood
From: Phillip Wood Simplify things slightly by using the above helpers. Signed-off-by: Phillip Wood --- t/t3701-add-interactive.sh | 36 +++- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh

[PATCH v2 8/9] add -p: fix counting when splitting and coalescing

2018-02-19 Thread Phillip Wood
From: Phillip Wood When a file has no trailing new line at the end diff records this by appending "\ No newline at end of file" below the last line of the file. This line should not be counted in the hunk header. Fix the splitting and coalescing code to count files without a trailin

[PATCH v2 5/9] t3701: add failing test for pathological context lines

2018-02-19 Thread Phillip Wood
From: Phillip Wood When a hunk is skipped by add -i the offsets of subsequent hunks are not adjusted to account for any missing insertions due to the skipped hunk. Most of the time this does not matter as apply uses the context lines to apply the subsequent hunks in the correct place, however in

[PATCH v2 1/9] add -i: add function to format hunk header

2018-02-19 Thread Phillip Wood
From: Phillip Wood This code is duplicated in a couple of places so make it into a function as we're going to add some more callers shortly. Signed-off-by: Phillip Wood --- git-add--interactive.perl | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --

[PATCH v2 6/9] add -p: Adjust offsets of subsequent hunks when one is skipped

2018-02-19 Thread Phillip Wood
From: Phillip Wood Since commit 8cbd431082 ("git-add--interactive: replace hunk recounting with apply --recount", 2008-7-2) if a hunk is skipped then we rely on the context lines to apply subsequent hunks in the right place. While this works most of the time it is possible for hunks

[PATCH v1 0/3] add -p: select individual hunk lines

2018-02-19 Thread Phillip Wood
From: Phillip Wood I need to update the add -i documentation but otherwise I think these patches are OK so I thought I'd try and get some feedback. They build on top of the recount fixes in [1]. The commit message for the first patch describes the motivation: "When I end up editing h

[PATCH v1 1/3] add -p: select individual hunk lines

2018-02-19 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 v1 3/3] add -p: optimize line selection for short hunks

2018-02-19 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 -357 to stage lines 1, 2, 3, 5 & 7. Signed-off-by: Phillip Wood --- git-add--interactive.perl

[PATCH v1 2/3] add -p: allow line selection to be inverted

2018-02-19 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 --- git-add--interactive.perl | 15 ++- t/t3701-add-interactive.sh | 2 +- 2 files changed, 15 insertions(+), 2 deletion

Re: [PATCH 0/4] Correct offsets of hunks when one is skipped

2018-02-19 Thread Phillip Wood
On 13/02/18 23:56, brian m. carlson wrote: > On Tue, Feb 13, 2018 at 10:44:04AM +0000, Phillip Wood wrote: >> From: Phillip Wood >> >> While working on a patch series to stage selected lines from a hunk >> without having to edit it I got worried that subsequent patches

Re: Is there any way to "interrupt" a rebase?

2018-02-20 Thread Phillip Wood
Is there > a way at this point in the rebase to "go back" to commit C (so without > "git rebase --abort")? > > (Surely, it's not as simple as doing a "git reset --hard > sha-of-commit-C" is it?) Hi Hilco In the past when I've wanted to edi

Re: Why git-revert doesn't invoke the pre-commit and the commit-msg hooks?

2018-02-20 Thread Phillip Wood
void these problems in the future. I'm worried though that someone out there is scripting with a non-interactive editor which may break if we start verifying the message so maybe the default should be changed and a --no-verify option added to cherry-pick and revert instead. They'd have to change their script but at least it would work and everyone else would get the behaviour they probably expect. Best Wishes Phillip

Re: [PATCH v2 3/9] t3701: use test_write_lines and write_script

2018-02-21 Thread Phillip Wood
r) for this to be a faithful rewrite but it is distracting having to write it anywhere else. Other than that, this looks like a quite straight-forward cleanup. Thanks, both. Here is what I'd be queuing tentatively. That looks good, thanks for fixing it up Phillip t/t3701-add-i

Re: [PATCH v2 5/9] t3701: add failing test for pathological context lines

2018-02-21 Thread Phillip Wood
On 19/02/18 11:29, Phillip Wood wrote: From: Phillip Wood When a hunk is skipped by add -i the offsets of subsequent hunks are not adjusted to account for any missing insertions due to the skipped hunk. Most of the time this does not matter as apply uses the context lines to apply the

Re: [PATCH v2 4/9] t3701: don't hard code sha1 hash values

2018-02-21 Thread Phillip Wood
On 20/02/18 17:39, Junio C Hamano wrote: Phillip Wood writes: From: Phillip Wood Purge the index lines from diffs so we're not hard coding sha1 hash values in the expected output. The motivation of this patch is clear, but all-zero object name for missing side of deletion or cre

Re: Git should preserve modification times at least on request

2018-02-21 Thread Phillip Wood
d in git-mergetool.sh, so I suppose it's okay to use in git-stash.sh etc, too. In recent versions of git there's unquote_path() in Git.pm, you could possibly use that with perl -e from your script Best Wishes Phillip Best wishes Peter

Re: Git "branch properties"-- thoughts?

2018-02-23 Thread Phillip Wood
ref paths without the leaning ref/. Under than directory there would be a subtree with the metadata - files called description, frozen, a directory of notes etc. So for refs/heads/master you'd have refs/metadata/heads/description containing the description refs/metadata/heads/master/notes/... containing the notes I want to share and refs/heads/metadata/master/frozen to indicate if the branch was frozen. Best Wishes Phillip

Re: What's cooking in git.git (Feb 2018, #03; Wed, 21)

2018-02-23 Thread Phillip Wood
Will merge to 'next'. > Could you hold off on this one please, I do a reroll next week with a couple of clean-ups for the tests. Thanks Phillip

Re: Is there any way to "interrupt" a rebase?

2018-02-23 Thread Phillip Wood
manually. > > (This all would of course only work properly without --preserve-merges and > without the upcoming --recreate-merges.) It shouldn't be too hard to support --recreate-merges in the case where you don't go past a merge commit, one would just have to check refs/rewritten to see if any label commands need to be inserted. Best Wishes Phillip > Ciao, > Johannes >

[PATCH v3 1/9] add -i: add function to format hunk header

2018-02-27 Thread Phillip Wood
From: Phillip Wood This code is duplicated in a couple of places so make it into a function as we're going to add some more callers shortly. Signed-off-by: Phillip Wood --- git-add--interactive.perl | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --

[PATCH v3 6/9] add -p: Adjust offsets of subsequent hunks when one is skipped

2018-02-27 Thread Phillip Wood
From: Phillip Wood Since commit 8cbd431082 ("git-add--interactive: replace hunk recounting with apply --recount", 2008-7-2) if a hunk is skipped then we rely on the context lines to apply subsequent hunks in the right place. While this works most of the time it is possible for hunks

[PATCH v3 5/9] t3701: add failing test for pathological context lines

2018-02-27 Thread Phillip Wood
From: Phillip Wood When a hunk is skipped by add -i the offsets of subsequent hunks are not adjusted to account for any missing insertions due to the skipped hunk. Most of the time this does not matter as apply uses the context lines to apply the subsequent hunks in the correct place, however in

[PATCH v3 7/9] add -p: calculate offset delta for edited patches

2018-02-27 Thread Phillip Wood
From: Phillip Wood Recount the number of preimage and postimage lines in a hunk after it has been edited so any change in the number of insertions or deletions can be used to adjust the offsets of subsequent hunks. If an edited hunk is subsequently split then the offset correction will be lost

[PATCH v3 2/9] t3701: indent here documents

2018-02-27 Thread Phillip Wood
From: Phillip Wood Indent here documents in line with the current style for tests. Signed-off-by: Phillip Wood --- t/t3701-add-interactive.sh | 174 ++--- 1 file changed, 87 insertions(+), 87 deletions(-) diff --git a/t/t3701-add-interactive.sh b/t

[PATCH v3 3/9] t3701: use test_write_lines and write_script

2018-02-27 Thread Phillip Wood
From: Phillip Wood Simplify things slightly by using the above helpers. Signed-off-by: Phillip Wood --- Notes: changes since v2 - fixed use of test_set_editor to match what was in pu t/t3701-add-interactive.sh | 33 + 1 file changed, 5 insertions

[PATCH v3 4/9] t3701: don't hard code sha1 hash values

2018-02-27 Thread Phillip Wood
From: Phillip Wood Use a filter when comparing diffs to fix the value of non-zero hashes in diff index lines so we're not hard coding sha1 hash values in the expected output. This makes it easier to change the expected output if a test is edited as we don't need to worry about the

[PATCH v3 0/9] Correct offsets of hunks when one is skipped

2018-02-27 Thread Phillip Wood
From: Phillip Wood I've fixed the use of test_set_editor most of which was already in pu and reworked the sha1 comparisons to rewrite the hashes in the index lines rather than deleting the index lines. Cover letter to v1: While working on a patch series to stage selected lines from a

[PATCH v3 9/9] add -p: don't rely on apply's '--recount' option

2018-02-27 Thread Phillip Wood
From: Phillip Wood Now that add -p counts patches properly it should be possible to turn off the '--recount' option when invoking 'git apply' Signed-off-by: Phillip Wood --- Notes: I can't think of a reason why this shouldn't be OK but I can't help

[PATCH v3 8/9] add -p: fix counting when splitting and coalescing

2018-02-27 Thread Phillip Wood
From: Phillip Wood When a file has no trailing new line at the end diff records this by appending "\ No newline at end of file" below the last line of the file. This line should not be counted in the hunk header. Fix the splitting and coalescing code to count files without a trailin

Re: [PATCH v3 2/9] t3701: indent here documents

2018-02-28 Thread Phillip Wood
On 27/02/18 22:35, Junio C Hamano wrote: > Phillip Wood writes: > >> From: Phillip Wood >> >> Indent here documents in line with the current style for tests. >> >> Signed-off-by: Phillip Wood >> --- > > This loses the hand-edit-while-queuing

Re: [PATCH v3 4/9] t3701: don't hard code sha1 hash values

2018-02-28 Thread Phillip Wood
On 27/02/18 22:42, Junio C Hamano wrote: > Phillip Wood writes: > >> t/t3701-add-interactive.sh | 30 -- >> 1 file changed, 20 insertions(+), 10 deletions(-) >> >> diff --git a/t/t3701-add-interactive.sh b/t/t3701-add-interactive.sh &

Re: [PATCH v3 4/9] t3701: don't hard code sha1 hash values

2018-02-28 Thread Phillip Wood
On 28/02/18 11:03, Phillip Wood wrote: > On 27/02/18 22:42, Junio C Hamano wrote: >> Phillip Wood writes: >> >>> t/t3701-add-interactive.sh | 30 -- >>> 1 file changed, 20 insertions(+), 10 deletions(-) >>> >>> di

[PATCH v4 3/9] t3701: use test_write_lines and write_script

2018-03-01 Thread Phillip Wood
From: Phillip Wood Simplify things slightly by using the above helpers. Signed-off-by: Phillip Wood --- Notes: changes since v2 - fixed use of test_set_editor to match what was in pu t/t3701-add-interactive.sh | 33 + 1 file changed, 5 insertions

[PATCH v4 0/9] Correct offsets of hunks when one is skipped

2018-03-01 Thread Phillip Wood
From: Phillip Wood I've fixed the second patch to match what was in pu and added some extra code to patch 4 to handle zero sha1 hashes where the length varies. Cover letter to v1: While working on a patch series to stage selected lines from a hunk without having to edit it I got worried

[PATCH v4 1/9] add -i: add function to format hunk header

2018-03-01 Thread Phillip Wood
From: Phillip Wood This code is duplicated in a couple of places so make it into a function as we're going to add some more callers shortly. Signed-off-by: Phillip Wood --- git-add--interactive.perl | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --

[PATCH v4 7/9] add -p: calculate offset delta for edited patches

2018-03-01 Thread Phillip Wood
From: Phillip Wood Recount the number of preimage and postimage lines in a hunk after it has been edited so any change in the number of insertions or deletions can be used to adjust the offsets of subsequent hunks. If an edited hunk is subsequently split then the offset correction will be lost

[PATCH v4 9/9] add -p: don't rely on apply's '--recount' option

2018-03-01 Thread Phillip Wood
From: Phillip Wood Now that add -p counts patches properly it should be possible to turn off the '--recount' option when invoking 'git apply' Signed-off-by: Phillip Wood --- Notes: I can't think of a reason why this shouldn't be OK but I can't help

[PATCH v4 8/9] add -p: fix counting when splitting and coalescing

2018-03-01 Thread Phillip Wood
From: Phillip Wood When a file has no trailing new line at the end diff records this by appending "\ No newline at end of file" below the last line of the file. This line should not be counted in the hunk header. Fix the splitting and coalescing code to count files without a trailin

[PATCH v4 4/9] t3701: don't hard code sha1 hash values

2018-03-01 Thread Phillip Wood
From: Phillip Wood Use a filter when comparing diffs to fix the value of non-zero hashes in diff index lines so we're not hard coding sha1 hash values in the expected output. This makes it easier to change the expected output if a test is edited as we don't need to worry about the

[PATCH v4 2/9] t3701: indent here documents

2018-03-01 Thread Phillip Wood
From: Phillip Wood Indent here documents in line with the current style for tests. While at it, quote the end marker of here-docs that do not use variable interpolation. Signed-off-by: Phillip Wood Signed-off-by: Junio C Hamano --- Notes: changes since v3: - updated to match what

[PATCH v4 5/9] t3701: add failing test for pathological context lines

2018-03-01 Thread Phillip Wood
From: Phillip Wood When a hunk is skipped by add -i the offsets of subsequent hunks are not adjusted to account for any missing insertions due to the skipped hunk. Most of the time this does not matter as apply uses the context lines to apply the subsequent hunks in the correct place, however in

[PATCH v4 6/9] add -p: adjust offsets of subsequent hunks when one is skipped

2018-03-01 Thread Phillip Wood
From: Phillip Wood Since commit 8cbd431082 ("git-add--interactive: replace hunk recounting with apply --recount", 2008-7-2) if a hunk is skipped then we rely on the context lines to apply subsequent hunks in the right place. While this works most of the time it is possible for hunks

Re: [PATCH v3 2/9] t3701: indent here documents

2018-03-01 Thread Phillip Wood
Hi Junio On 28/02/18 15:37, Junio C Hamano wrote: > Phillip Wood writes: > >> Is there an easy way for contributors to compare the branch they post to >> what ends up it pu? > > Distributed work is pretty much symmetric, so it can be done the > same way as one would

Re: [PATCH v4 7/9] add -p: calculate offset delta for edited patches

2018-03-02 Thread Phillip Wood
On 01/03/18 20:14, Junio C Hamano wrote: > Phillip Wood writes: > >> From: Phillip Wood >> >> Recount the number of preimage and postimage lines in a hunk after it >> has been edited so any change in the number of insertions or deletions >> can be used to ad

Re: [PATCH v4 9/9] add -p: don't rely on apply's '--recount' option

2018-03-02 Thread Phillip Wood
On 01/03/18 20:30, Junio C Hamano wrote: > Phillip Wood writes: > >> From: Phillip Wood >> >> Now that add -p counts patches properly it should be possible to turn >> off the '--recount' option when invoking 'git apply' > > Sounds good ;

Re: [PATCH v4 8/9] add -p: fix counting when splitting and coalescing

2018-03-02 Thread Phillip Wood
On 01/03/18 20:29, Junio C Hamano wrote: > Phillip Wood writes: > >> @@ -887,8 +892,8 @@ sub merge_hunk { >> $o_cnt = $n_cnt = 0; >> for ($i = 1; $i < @{$prev->{TEXT}}; $i++) { >> my $line = $prev-&g

Re: [RFC] Rebasing merges: a jorney to the ultimate solution(RoadClear)

2018-03-02 Thread Phillip Wood
On 02/03/18 01:16, Igor Djordjevic wrote: > > Hi Sergey, > > On 01/03/2018 06:39, Sergey Organov wrote: >> (3) ---X1---o---o---o---o---o---X2 |\ |\ | A1---A2---A3---U1 | A1'--A2'--A3'--U1' | \ |

Re: [RFC] Rebasing merges: a jorney to the ultimate solution (Road Clear)

2018-03-02 Thread Phillip Wood
h M git merge-recursive A -- M A' tree=$(git write-tree) git merge-recursive B -- $tree B' tree=$(git write-tree) git merge-recursive C -- $tree C' tree=$(git write-tree) M'=$(git log --pretty=%B -1 M | git commit-tree -pA' -pB' -pC') This should pull in all the changes from the parents while preserving any evil conflict resolution in the original merge. It superficially reminds me of incremental merging [1] but it's so long since I looked at that I'm not sure if there are any significant similarities. Best Wishes Phillip [1] https://github.com/mhagger/git-imerge

Re: [RFC] Rebasing merges: a jorney to the ultimate solution(RoadClear)

2018-03-02 Thread Phillip Wood
On 02/03/18 11:17, Phillip Wood wrote: > > On 02/03/18 01:16, Igor Djordjevic wrote: >> >> Hi Sergey, >> >> On 01/03/2018 06:39, Sergey Organov wrote: >>> >>>>> (3) ---X1---o---o---o---o---o---X2 >>>>>|\

[PATCH v5 3/9] t3701: use test_write_lines and write_script

2018-03-05 Thread Phillip Wood
From: Phillip Wood Simplify things slightly by using the above helpers. Signed-off-by: Phillip Wood --- Notes: changes since v2 - fixed use of test_set_editor to match what was in pu t/t3701-add-interactive.sh | 33 + 1 file changed, 5 insertions

[PATCH v5 2/9] t3701: indent here documents

2018-03-05 Thread Phillip Wood
From: Phillip Wood Indent here documents in line with the current style for tests. While at it, quote the end marker of here-docs that do not use variable interpolation. Signed-off-by: Phillip Wood Signed-off-by: Junio C Hamano --- Notes: changes since v3: - updated to match what

[PATCH v5 0/9] Correct offsets of hunks when one is skipped

2018-03-05 Thread Phillip Wood
From: Phillip Wood I've updated these to clean up the perl style in response to Junio's comments on v4. Cover letter to v1: While working on a patch series to stage selected lines from a hunk without having to edit it I got worried that subsequent patches would be applied in the w

[PATCH v5 1/9] add -i: add function to format hunk header

2018-03-05 Thread Phillip Wood
From: Phillip Wood This code is duplicated in a couple of places so make it into a function as we're going to add some more callers shortly. Signed-off-by: Phillip Wood --- git-add--interactive.perl | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) diff --

[PATCH v5 6/9] add -p: adjust offsets of subsequent hunks when one is skipped

2018-03-05 Thread Phillip Wood
From: Phillip Wood Since commit 8cbd431082 ("git-add--interactive: replace hunk recounting with apply --recount", 2008-7-2) if a hunk is skipped then we rely on the context lines to apply subsequent hunks in the right place. While this works most of the time it is possible for hunks

[PATCH v5 5/9] t3701: add failing test for pathological context lines

2018-03-05 Thread Phillip Wood
From: Phillip Wood When a hunk is skipped by add -i the offsets of subsequent hunks are not adjusted to account for any missing insertions due to the skipped hunk. Most of the time this does not matter as apply uses the context lines to apply the subsequent hunks in the correct place, however in

[PATCH v5 4/9] t3701: don't hard code sha1 hash values

2018-03-05 Thread Phillip Wood
From: Phillip Wood Use a filter when comparing diffs to fix the value of non-zero hashes in diff index lines so we're not hard coding sha1 hash values in the expected output. This makes it easier to change the expected output if a test is edited as we don't need to worry about the

[PATCH v5 8/9] add -p: fix counting when splitting and coalescing

2018-03-05 Thread Phillip Wood
From: Phillip Wood When a file has no trailing new line at the end diff records this by appending "\ No newline at end of file" below the last line of the file. This line should not be counted in the hunk header. Fix the splitting and coalescing code to count files without a trailin

[PATCH v5 7/9] add -p: calculate offset delta for edited patches

2018-03-05 Thread Phillip Wood
From: Phillip Wood Recount the number of preimage and postimage lines in a hunk after it has been edited so any change in the number of insertions or deletions can be used to adjust the offsets of subsequent hunks. If an edited hunk is subsequently split then the offset correction will be lost

[PATCH v5 9/9] add -p: don't rely on apply's '--recount' option

2018-03-05 Thread Phillip Wood
From: Phillip Wood Now that add -p counts patches properly it should be possible to turn off the '--recount' option when invoking 'git apply' Signed-off-by: Phillip Wood --- Notes: I can't think of a reason why this shouldn't be OK but I can't help

Re: [PATCH v4 4/9] t3701: don't hard code sha1 hash values

2018-03-05 Thread Phillip Wood
ctions, I would think. > > So, I certainly do not mind a reroll to move it to a more generic > place, but I do not think I would terribly mind if we leave it in > its current place, later to be moved by the first new caller that > wants to use it from outside this script. > I did wonder about putting this function in a library when I first wrote it but decided to wait and see if it is useful instead. As Junio points out it would need to be improved to act as a generic filter, so I'll take the easy option and leave it where it is at the moment. Best Wishes Phillip

Re: [PATCH/RFC] rebase: make resolve message clearer for inexperienced users

2017-07-24 Thread Phillip Wood
eeks ago, I'll clean it up and post it later this week. I also find it confusing that it asks me to edit the commit message for picks, fixups and non-final squashes after conflicts. I can see that perhaps one might want to amend the message to reflect any changes that were made while resolving the conflicts but I've never had too. I'd rather be able to pass --edit to rebase --continue if I needed to edit the message in those cases. Looking through the code I think it would require saving some extra state when rebase bails out on conflicts so rebase --continue could tell if it should be asking the user to amend the message. Best Wishes Phillip

<    3   4   5   6   7   8   9   10   >