<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/add-patch.c, branch v2.32.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.32.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.32.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2020-12-08T23:11:17Z</updated>
<entry>
<title>Merge branch 'js/add-i-color-fix'</title>
<updated>2020-12-08T23:11:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-12-08T23:11:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e0d25686e33396621c484ce5c936c9e49874d8d8'/>
<id>urn:sha1:e0d25686e33396621c484ce5c936c9e49874d8d8</id>
<content type='text'>
"git add -i" failed to honor custom colors configured to show
patches, which has been corrected.

* js/add-i-color-fix:
  add -i: verify in the tests that colors can be overridden
  add -p: prefer color.diff.context over color.diff.plain
  add -i (Perl version): color header to match the C version
  add -i (built-in): use the same indentation as the Perl version
  add -p (built-in): do not color the progress indicator separately
  add -i (built-in): use correct names to load color.diff.* config
  add -i (built-in): prevent the `reset` "color" from being configured
  add -i: use `reset_color` consistently
  add -p (built-in): imitate `xdl_format_hunk_hdr()` generating hunk headers
  add -i (built-in): send error messages to stderr
  add -i (built-in): do show an error message for incorrect inputs
</content>
</entry>
<entry>
<title>add -p (built-in): do not color the progress indicator separately</title>
<updated>2020-11-16T23:59:02Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-11-16T16:08:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6681e3603216f0e279fea467a0e6d829fffb82a5'/>
<id>urn:sha1:6681e3603216f0e279fea467a0e6d829fffb82a5</id>
<content type='text'>
The Perl version of this command colors the progress indicator and the
prompt message in one go.

Let's do the same in the built-in version so that the same upcoming test
(which will compare the output of `git add -p` against a known-good
version) will pass both for the Perl version as well as for the built-in
version.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add -i: use `reset_color` consistently</title>
<updated>2020-11-11T17:07:52Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-11-11T12:28:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6f1a5caa0b69278bc7eb79d3474a1e881bd0c663'/>
<id>urn:sha1:6f1a5caa0b69278bc7eb79d3474a1e881bd0c663</id>
<content type='text'>
We already maintain a list of colors in the `add_i_state`, therefore we
should use them.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>add -p (built-in): imitate `xdl_format_hunk_hdr()` generating hunk headers</title>
<updated>2020-11-11T17:07:52Z</updated>
<author>
<name>Johannes Schindelin</name>
<email>johannes.schindelin@gmx.de</email>
</author>
<published>2020-11-11T12:28:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=decc9ee4eaf2c33c28e2958439d276904a2ce279'/>
<id>urn:sha1:decc9ee4eaf2c33c28e2958439d276904a2ce279</id>
<content type='text'>
In libxdiff, imitating GNU diff, the hunk headers only show the line
count if it is different from 1. When splitting hunks, the Perl version
of `git add -p` already imitates this. Let's do the same in the built-in
version of said command.

Signed-off-by: Johannes Schindelin &lt;johannes.schindelin@gmx.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'dl/checkout-p-merge-base'</title>
<updated>2020-10-27T22:09:51Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-10-27T22:09:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f3cfeb3078ce4af0ac764515795f7e0849a88931'/>
<id>urn:sha1:f3cfeb3078ce4af0ac764515795f7e0849a88931</id>
<content type='text'>
"git checkout -p A...B [-- &lt;path&gt;]" did not work, even though the
same command without "-p" correctly used the merge-base between
commits A and B.

* dl/checkout-p-merge-base:
  t2016: add a NEEDSWORK about the PERL prerequisite
  add-patch: add NEEDSWORK about comparing commits
  Doc: document "A...B" form for &lt;tree-ish&gt; in checkout and switch
  builtin/checkout: fix `git checkout -p HEAD...` bug
</content>
</entry>
<entry>
<title>add-patch: add NEEDSWORK about comparing commits</title>
<updated>2020-10-07T16:49:06Z</updated>
<author>
<name>Denton Liu</name>
<email>liu.denton@gmail.com</email>
</author>
<published>2020-10-07T07:56:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f82a9e517fc063bb97063e4df2cdde2fd1f7ffbe'/>
<id>urn:sha1:f82a9e517fc063bb97063e4df2cdde2fd1f7ffbe</id>
<content type='text'>
The two versions of add-patch has special-casing for the literal
revision "HEAD". However, we want to handle other ways of saying "HEAD"
in the same way.[0] Add a NEEDSWORK to the add-patch code that does this
so that it can be addressed later.

[0]: https://lore.kernel.org/git/xmqqsgat7ttf.fsf@gitster.c.googlers.com/

Signed-off-by: Denton Liu &lt;liu.denton@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pw/add-p-edit-ita-path'</title>
<updated>2020-09-22T19:36:28Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-09-22T19:36:28Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=458205ff0f43f8f0ffe70aa7f06d314fcce25809'/>
<id>urn:sha1:458205ff0f43f8f0ffe70aa7f06d314fcce25809</id>
<content type='text'>
"add -p" now allows editing paths that were only added in intent.

* pw/add-p-edit-ita-path:
  add -p: fix editing of intent-to-add paths
</content>
</entry>
<entry>
<title>Merge branch 'jk/add-i-fixes'</title>
<updated>2020-09-19T00:58:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-09-19T00:58:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=694e517778243256b748819cc60eff6011238a0a'/>
<id>urn:sha1:694e517778243256b748819cc60eff6011238a0a</id>
<content type='text'>
"add -i/-p" fixes.

* jk/add-i-fixes:
  add--interactive.perl: specify --no-color explicitly
  add-patch: fix inverted return code of repo_read_index()
</content>
</entry>
<entry>
<title>Merge branch 'pw/add-p-leakfix'</title>
<updated>2020-09-19T00:58:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2020-09-19T00:58:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3ad8d3e4f9855de6444b081e59328a55de1def80'/>
<id>urn:sha1:3ad8d3e4f9855de6444b081e59328a55de1def80</id>
<content type='text'>
Leakfix.

* pw/add-p-leakfix:
  add -p: fix memory leak
</content>
</entry>
<entry>
<title>add -p: fix editing of intent-to-add paths</title>
<updated>2020-09-09T19:49:01Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2020-09-09T13:58:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=75a009dc29d943554b39233286f02d34ead9a666'/>
<id>urn:sha1:75a009dc29d943554b39233286f02d34ead9a666</id>
<content type='text'>
A popular way of partially staging a new file is to run `git add -N
&lt;path&gt;` and then use the hunk editing of `git add -p` to select the
part of the file that the user wishes to stage. Since
85953a3187 ("diff-files --raw: show correct post-image of
intent-to-add files", 2020-07-01) this has stopped working as
intent-to-add paths are now show as new files rather than changes to
an empty blob and `git apply` refused to apply a creation patch for a
path that was marked as intent-to-add. 7cfde3fa0f ("apply: allow "new
file" patches on i-t-a entries", 2020-08-06) fixed the problem with
apply but it still wasn't possible to edit the added hunk properly.

2c8bd8471a ("checkout -p: handle new files correctly", 2020-05-27)
had previously changed `add -p` to handle new files but it did not
implement patch editing correctly. The perl version simply forbade
editing and the C version opened the editor with the full diff rather
that just the hunk which meant that the user had to edit the hunk
header manually to get it to work.

The root cause of the problem is that added files store the diff header
with the hunk data rather than separating the two as we do for other
changes. Changing added files to store the diff header separately
fixes the editing problem at the expense of having to special case
empty additions as they no longer have any hunks associated with them,
only the diff header.

The changes move some existing code into a conditional changing the
indentation, they are best viewed with
--color-moved-ws=allow-indentation-change (or --ignore-space-change
works well to get an overview of the changes)

Signed-off-by: Phillip Wood &lt;phillip.wood@dunelm.org.uk&gt;
Reported-by: Thomas Sullivan &lt;tom@msbit.com.au&gt;
Reported-by: Yuchen Ying &lt;ych@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
