<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/git-add--interactive.perl, branch v2.18.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.18.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.18.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2018-05-02T04:59:53Z</updated>
<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>
<entry>
<title>add -p: don't rely on apply's '--recount' option</title>
<updated>2018-03-05T18:45:41Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-03-05T10:56:30Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3a8522f41ff45b16e06888d2b164252c9aeeaa03'/>
<id>urn:sha1:3a8522f41ff45b16e06888d2b164252c9aeeaa03</id>
<content type='text'>
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 &lt;phillip.wood@dunelm.org.uk&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add -p: fix counting when splitting and coalescing</title>
<updated>2018-03-05T18:45:41Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-03-05T10:56:29Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b3e0fcfe429204ccdf1f6977c55127171d65a8e5'/>
<id>urn:sha1:b3e0fcfe429204ccdf1f6977c55127171d65a8e5</id>
<content type='text'>
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 trailing new line
properly and change one of the tests to test splitting without a
trailing new line.

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 -p: calculate offset delta for edited patches</title>
<updated>2018-03-05T18:45:41Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-03-05T10:56:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2b8ea7f3c7d8dfd4f1eddaef6688b51f8106767e'/>
<id>urn:sha1:2b8ea7f3c7d8dfd4f1eddaef6688b51f8106767e</id>
<content type='text'>
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. It
would be possible to fix this if it is a problem, however the code
here is still an improvement on the status quo for the common case
where an edited hunk is applied without being split.

This is also a necessary step to removing '--recount' and
'--allow-overlap' from the invocation of 'git apply'. Before
'--recount' can be removed the splitting and coalescing counting needs
to be fixed to handle a missing newline at the end of a file. In order
to remove '--allow-overlap' there needs to be i) some way of verifying
the offset data in the edited hunk (probably by correlating the
preimage (or postimage if the patch is going to be applied in reverse)
lines of the edited and unedited versions to see if they are offset or
if any leading/trailing context lines have been removed) and ii) a way of
dealing with edited hunks that change context lines that are shared
with neighbouring hunks.

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 -p: adjust offsets of subsequent hunks when one is skipped</title>
<updated>2018-03-01T19:39:15Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2018-03-01T10:51:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fecc6f3a6862c55dee0e9a2390acaf4b23991fef'/>
<id>urn:sha1:fecc6f3a6862c55dee0e9a2390acaf4b23991fef</id>
<content type='text'>
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 to
end up being applied in the wrong place. To fix this adjust the offset
of subsequent hunks to correct for any change in the number of
insertions or deletions due to the skipped hunk. The change in offset
due to edited hunks that have the number of insertions or deletions
changed is ignored here, it will be fixed in the next commit.

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>
</feed>
