<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-add--interactive.perl, branch v2.22.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.22.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.22.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2019-07-29T19:38:22Z</updated>
<entry>
<title>Merge branch 'pw/add-p-recount' into maint</title>
<updated>2019-07-29T19:38:22Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2019-07-29T19:38:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=689204ca8862a25be7bd7f91a42fbdf46cfb2a56'/>
<id>urn:sha1:689204ca8862a25be7bd7f91a42fbdf46cfb2a56</id>
<content type='text'>
"git checkout -p" needs to selectively apply a patch in reverse,
which did not work well.

* pw/add-p-recount:
  add -p: fix checkout -p with pathological context
</content>
</entry>
<entry>
<title>add -p: fix checkout -p with pathological context</title>
<updated>2019-06-13T17:00:30Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2019-06-12T09:25:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2bd69b9024c8c7c1b77060e3ed996c74b4775b01'/>
<id>urn:sha1:2bd69b9024c8c7c1b77060e3ed996c74b4775b01</id>
<content type='text'>
Commit fecc6f3a68 ("add -p: adjust offsets of subsequent hunks when one is
skipped", 2018-03-01) fixed adding hunks in the correct place when a
previous hunk has been skipped. However it did not address patches that
are applied in reverse. In that case we need to adjust the pre-image
offset so that when apply reverses the patch the post-image offset is
adjusted correctly. We subtract rather than add the delta as the patch
is reversed (the easiest way to think about it is to consider a hunk of
deletions that is skipped - in that case we want to reduce offset so we
need to subtract).

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pw/add-p-recount'</title>
<updated>2018-06-28T19:53:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-06-28T19:53:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5eb8da850860839bdf38ab80079eb8875b764431'/>
<id>urn:sha1:5eb8da850860839bdf38ab80079eb8875b764431</id>
<content type='text'>
When user edits the patch in "git add -p" and the user's editor is
set to strip trailing whitespaces indiscriminately, an empty line
that is unchanged in the patch would become completely empty
(instead of a line with a sole SP on it).  The code introduced in
Git 2.17 timeframe failed to parse such a patch, but now it learned
to notice the situation and cope with it.

* pw/add-p-recount:
  add -p: fix counting empty context lines in edited patches
</content>
</entry>
<entry>
<title>add -p: fix counting empty context lines in edited patches</title>
<updated>2018-06-11T16:45:19Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-06-11T09:46:02Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f4d35a6b49621348c73222e7017a434551799308'/>
<id>urn:sha1:f4d35a6b49621348c73222e7017a434551799308</id>
<content type='text'>
recount_edited_hunk() introduced in commit 2b8ea7f3c7 ("add -p:
calculate offset delta for edited patches", 2018-03-05) required all
context lines to start with a space, empty lines are not counted. This
was intended to avoid any recounting problems if the user had
introduced empty lines at the end when editing the patch. However this
introduced a regression into 'git add -p' as it seems it is common for
editors to strip the trailing whitespace from empty context lines when
patches are edited thereby introducing empty lines that should be
counted. 'git apply' knows how to deal with such empty lines and POSIX
states that whether or not there is an space on an empty context line
is implementation defined [1].

Fix the regression by counting lines that consist solely of a newline
as well as lines starting with a space as context lines and add a test
to prevent future regressions.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/diff.html

Reported-by: Mahmoud Al-Qudsi &lt;mqudsi@neosmart.net&gt;
Reported-by: Oliver Joseph Ash &lt;oliverjash@gmail.com&gt;
Reported-by: Jeff Felchner &lt;jfelchner1@gmail.com&gt;
Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add--interactive: compute the empty tree value</title>
<updated>2018-05-02T04:59:53Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2018-05-02T00:26:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=23ec4c51d53f6976bdb54e92487d378f9abd1ed3'/>
<id>urn:sha1:23ec4c51d53f6976bdb54e92487d378f9abd1ed3</id>
<content type='text'>
The interactive add script hard-codes the object ID of the empty tree.
To avoid any problems when changing hashes, compute this value when used
and cache it for any future uses.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pw/add-p-single'</title>
<updated>2018-04-02T17:10:55Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-04-02T17:10:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=5f9441769fab51afc9fc96d1e5f7a9edde586088'/>
<id>urn:sha1:5f9441769fab51afc9fc96d1e5f7a9edde586088</id>
<content type='text'>
Hotfix.

* pw/add-p-single:
  add -p: fix 2.17.0-rc* regression due to moved code
</content>
</entry>
<entry>
<title>add -p: fix 2.17.0-rc* regression due to moved code</title>
<updated>2018-04-01T04:54:28Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2018-03-31T12:50:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fd2fb4aa0cc2a25a8e4ddf3f3c48880f317edcf4'/>
<id>urn:sha1:fd2fb4aa0cc2a25a8e4ddf3f3c48880f317edcf4</id>
<content type='text'>
Fix a regression in 88f6ffc1c2 ("add -p: only bind search key if
there's more than one hunk", 2018-02-13) which is present in
2.17.0-rc*, but not 2.16.0.

In Perl, regex variables like $1 always refer to the last regex
match. When the aforementioned change added a new regex match between
the old match and the corresponding code that was expecting $1, the $1
variable would always be undef, since the newly inserted regex match
doesn't have any captures.

As a result the "/" feature to search for a string in a hunk by regex
completely broke, on git.git:

    $ perl -pi -e 's/Git/Tig/g' README.md
    $ ./git --exec-path=$PWD add -p
    [..]
    Stage this hunk [y,n,q,a,d,j,J,g,/,s,e,?]? s
    Split into 4 hunks.
    [...]
    Stage this hunk [y,n,q,a,d,j,J,g,/,s,e,?]? /Many
    Use of uninitialized value $1 in string eq at /home/avar/g/git/git-add--interactive line 1568, &lt;STDIN&gt; line 1.
    search for regex? Many

I.e. the initial "/regex" command wouldn't work, and would always emit
a warning and ask again for a regex, now it works as intended again.

Signed-off-by: Ævar Arnfjörð Bjarmason &lt;avarab@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jk/add-i-diff-filter'</title>
<updated>2018-03-14T19:01:05Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-03-14T19:01:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c5e2df04ac9dd731c729c6159d58c2288d794858'/>
<id>urn:sha1:c5e2df04ac9dd731c729c6159d58c2288d794858</id>
<content type='text'>
The "interactive.diffFilter" used by "git add -i" must retain
one-to-one correspondence between its input and output, but it was
not enforced and caused end-user confusion.  We now at least make
sure the filtered result has the same number of lines as its input
to detect a broken filter.

* jk/add-i-diff-filter:
  add--interactive: detect bogus diffFilter output
  t3701: add a test for interactive.diffFilter
</content>
</entry>
<entry>
<title>Merge branch 'pw/add-p-recount'</title>
<updated>2018-03-14T19:01:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2018-03-14T19:01:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=436d18f2d00b61bea44be2f8d35a437172132873'/>
<id>urn:sha1:436d18f2d00b61bea44be2f8d35a437172132873</id>
<content type='text'>
"git add -p" has been lazy in coalescing split patches before
passing the result to underlying "git apply", leading to corner
case bugs; the logic to prepare the patch to be applied after hunk
selections has been tightened.

* pw/add-p-recount:
  add -p: don't rely on apply's '--recount' option
  add -p: fix counting when splitting and coalescing
  add -p: calculate offset delta for edited patches
  add -p: adjust offsets of subsequent hunks when one is skipped
  t3701: add failing test for pathological context lines
  t3701: don't hard code sha1 hash values
  t3701: use test_write_lines and write_script
  t3701: indent here documents
  add -i: add function to format hunk header
</content>
</entry>
<entry>
<title>add--interactive: detect bogus diffFilter output</title>
<updated>2018-03-05T20:49:45Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2018-03-03T05:58:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=42f7d45428e260acf535ba0d55ecc91ee81e21da'/>
<id>urn:sha1:42f7d45428e260acf535ba0d55ecc91ee81e21da</id>
<content type='text'>
It's important that the diff-filter only filter the
individual lines, and that there remain a one-to-one mapping
between the input and output lines. Otherwise, things like
hunk-splitting will behave quite unexpectedly (e.g., you
think you are splitting at one point, but it has a different
effect in the text patch we apply).

We can't detect all problematic cases, but we can at least
catch the obvious case where we don't even have the correct
number of lines.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
