<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/add-patch.c, branch v2.37.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.37.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.37.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2022-06-02T21:31:16Z</updated>
<entry>
<title>run-command API: rename "env_array" to "env"</title>
<updated>2022-06-02T21:31:16Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2022-06-02T09:09:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=29fda24dd11e90583f3ea9ff2f90ee9acacd7792'/>
<id>urn:sha1:29fda24dd11e90583f3ea9ff2f90ee9acacd7792</id>
<content type='text'>
Start following-up on the rename mentioned in c7c4bdeccf3 (run-command
API: remove "env" member, always use "env_array", 2021-11-25) of
"env_array" to "env".

The "env_array" name was picked in 19a583dc39e (run-command: add
env_array, an optional argv_array for env, 2014-10-19) because "env"
was taken. Let's not forever keep the oddity of "*_array" for this
"struct strvec", but not for its "args" sibling.

This commit is almost entirely made with a coccinelle rule[1]. The
only manual change here is in run-command.h to rename the struct
member itself and to change "env_array" to "env" in the
CHILD_PROCESS_INIT initializer.

The rest of this is all a result of applying [1]:

 * make contrib/coccinelle/run_command.cocci.patch
 * patch -p1 &lt;contrib/coccinelle/run_command.cocci.patch
 * git add -u

1. cat contrib/coccinelle/run_command.pending.cocci
   @@
   struct child_process E;
   @@
   - E.env_array
   + E.env

   @@
   struct child_process *E;
   @@
   - E-&gt;env_array
   + E-&gt;env

I've avoided changing any comments and derived variable names here,
that will all be done in the next commit.

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 'pw/add-p-hunk-split-fix'</title>
<updated>2022-02-09T22:20:59Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2022-02-09T22:20:59Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ec4f70e64711cbf550b2cfc1f78ccd9325d697b7'/>
<id>urn:sha1:ec4f70e64711cbf550b2cfc1f78ccd9325d697b7</id>
<content type='text'>
"git add -p" rewritten in C regressed hunk splitting in some cases,
which has been corrected.

* pw/add-p-hunk-split-fix:
  builtin add -p: fix hunk splitting
  t3701: clean up hunk splitting tests
</content>
</entry>
<entry>
<title>builtin add -p: fix hunk splitting</title>
<updated>2022-01-12T18:29:53Z</updated>
<author>
<name>Phillip Wood</name>
<email>phillip.wood@dunelm.org.uk</email>
</author>
<published>2022-01-11T11:12:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7008ddc645cf8a6783d23b4ccdae0b74b096bd9e'/>
<id>urn:sha1:7008ddc645cf8a6783d23b4ccdae0b74b096bd9e</id>
<content type='text'>
The C reimplementation of "add -p" fails to split the last hunk in a
file if hunk ends with an addition or deletion without any post context
line unless it is the last file to be processed.

To determine whether a hunk can be split a counter is incremented each
time a context line follows an insertion or deletion. If at the end of
the hunk the value of this counter is greater than one then the hunk
can be split into that number of smaller hunks. If the last hunk in a
file ends with an insertion or deletion then there is no following
context line and the counter will not be incremented. This case is
already handled at the end of the loop where counter is incremented if
the last hunk ended with an insertion or deletion. Unfortunately there
is no similar check between files (likely because the perl version
only ever parses one diff at a time). Fix this by checking if the last
hunk ended with an insertion or deletion when we see the diff header
of a new file and extend the existing regression test.

Reproted-by: SZEDER Gábor &lt;szeder.dev@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>run-command API users: use strvec_pushv(), not argv assignment</title>
<updated>2021-11-26T06:15:07Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-11-25T22:52:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6def0ff8785eb12ccc24ceebea04355e13ae24b6'/>
<id>urn:sha1:6def0ff8785eb12ccc24ceebea04355e13ae24b6</id>
<content type='text'>
Migrate those run-command API users that assign directly to the "argv"
member to use a strvec_pushv() of "args" instead.

In these cases it did not make sense to further refactor these
callers, e.g. daemon.c could be made to construct the arguments closer
to handle(), but that would require moving the construction from its
cmd_main() and pass "argv" through two intermediate functions.

It would be possible for a change like this to introduce a regression
if we were doing:

      cp.argv = argv;
      argv[1] = "foo";

And changed the code, as is being done here, to:

      strvec_pushv(&amp;cp.args, argv);
      argv[1] = "foo";

But as viewing this change with the "-W" flag reveals none of these
functions modify variable that's being pushed afterwards in a way that
would introduce such a logic error.

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>*.c static functions: add missing __attribute__((format))</title>
<updated>2021-07-13T22:20:20Z</updated>
<author>
<name>Ævar Arnfjörð Bjarmason</name>
<email>avarab@gmail.com</email>
</author>
<published>2021-07-13T08:05:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=48ca53cac4a5bee2dee3a5f3d6550753bf696d28'/>
<id>urn:sha1:48ca53cac4a5bee2dee3a5f3d6550753bf696d28</id>
<content type='text'>
Add missing __attribute__((format)) function attributes to various
"static" functions that take printf arguments.

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