<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/patch-id.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-02-02T19:24:23Z</updated>
<entry>
<title>patch-id: fix scan_hunk_header on diffs with 1 line of before/after</title>
<updated>2022-02-02T19:24:23Z</updated>
<author>
<name>Jerry Zhang</name>
<email>jerry@skydio.com</email>
</author>
<published>2022-02-02T04:19:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=757e75c81e4332e363b90a0534a657b1bb6546fa'/>
<id>urn:sha1:757e75c81e4332e363b90a0534a657b1bb6546fa</id>
<content type='text'>
Normally diffs will contain a hunk header of the format
"@@ -2,2 +2,15 @@ code". However when there is only 1 line of
change, the unified diff format allows for the second comma
separated value to be omitted in either before or after
line counts.

This can produce hunk headers that look like
"@@ -2 +2,18 @@ code" or "@@ -2,2 +2 @@ code".
As a result, scan_hunk_header mistakenly returns the line
number as line count, which then results in unpredictable
parsing errors with the rest of the patch, including giving
multiple lines of output for a single commit.

Fix by explicitly setting line count to 1 when there is
no comma, and add a test.

apply.c contains this same logic except it is correct. A
worthwhile future project might be to unify these two diff
parsers so they both benefit from fixes.

Signed-off-by: Jerry Zhang &lt;jerry@skydio.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>patch-id: use oid_to_hex() to print multiple object IDs</title>
<updated>2019-12-09T20:26:40Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2019-12-07T19:16:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4507ecc7710e172ed36421eaa4efe743785ccb4b'/>
<id>urn:sha1:4507ecc7710e172ed36421eaa4efe743785ccb4b</id>
<content type='text'>
flush_current_id() prints the hexadecimal representation of two object
IDs.  When the code was added in f97672225b (Add "git-patch-id" program
to generate patch ID's., 2005-06-23), sha1_to_hex() had only a single
internal static buffer, so the result of one invocation had to be stored
in a local buffer.

Since dcb3450fd8 (sha1_to_hex() usage cleanup, 2006-05-03) it rotates
through four buffers, which allows to print up to four object IDs at the
same time.  1a876a69af6 (patch-id: convert to use struct object_id,
2015-03-13) replaced sha1_to_hex() with oid_to_hex(), which has the same
feature.  Use it to simplify the code.

Signed-off-by: René Scharfe &lt;l.s.r@web.de&gt;
Acked-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>patch-id: convert to use the_hash_algo</title>
<updated>2019-08-19T22:04:57Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2019-08-18T20:04:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=36261e42ec30477434f3325f279fd91a1d9eb434'/>
<id>urn:sha1:36261e42ec30477434f3325f279fd91a1d9eb434</id>
<content type='text'>
Convert the two separate patch-id implementations to use the_hash_algo
in their implementation.

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>format-patch: make --base patch-id output stable</title>
<updated>2019-05-08T10:27:43Z</updated>
<author>
<name>Stephen Boyd</name>
<email>sboyd@kernel.org</email>
</author>
<published>2019-04-26T23:51:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a8f6855f48fd474719e92eecc66c29a28fdc0f46'/>
<id>urn:sha1:a8f6855f48fd474719e92eecc66c29a28fdc0f46</id>
<content type='text'>
We weren't flushing the context each time we processed a hunk in the
patch-id generation code in diff.c, but we were doing that when we
generated "stable" patch-ids with the 'patch-id' tool. Let's port that
similar logic over from patch-id.c into diff.c so we can get the same
hash when we're generating patch-ids for 'format-patch --base=' types of
command invocations.

Cc: Xiaolong Ye &lt;xiaolong.ye@intel.com&gt;
Signed-off-by: Stephen Boyd &lt;sboyd@kernel.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>config: don't include config.h by default</title>
<updated>2017-06-15T19:56:22Z</updated>
<author>
<name>Brandon Williams</name>
<email>bmwill@google.com</email>
</author>
<published>2017-06-14T18:07:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b2141fc1d20e659810245ec6ca1c143c60e033ec'/>
<id>urn:sha1:b2141fc1d20e659810245ec6ca1c143c60e033ec</id>
<content type='text'>
Stop including config.h by default in cache.h.  Instead only include
config.h in those files which require use of the config system.

Signed-off-by: Brandon Williams &lt;bmwill@google.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Convert GIT_SHA1_RAWSZ used for allocation to GIT_MAX_RAWSZ</title>
<updated>2017-03-27T05:08:21Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2017-03-26T16:01:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=cd02599c480570484ec0a38a5bf66ac69ee3dd19'/>
<id>urn:sha1:cd02599c480570484ec0a38a5bf66ac69ee3dd19</id>
<content type='text'>
Since we will likely be introducing a new hash function at some point,
and that hash function might be longer than 20 bytes, use the constant
GIT_MAX_RAWSZ, which is designed to be suitable for allocations, instead
of GIT_SHA1_RAWSZ.  This will ease the transition down the line by
distinguishing between places where we need to allocate memory suitable
for the largest hash from those where we need to handle the current
hash.

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 'rs/patch-id-use-skip-prefix'</title>
<updated>2016-06-03T21:38:03Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2016-06-03T21:38:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=29e54b019f55f48af3f0d4c62eede86058c16b52'/>
<id>urn:sha1:29e54b019f55f48af3f0d4c62eede86058c16b52</id>
<content type='text'>
Code clean-up.

* rs/patch-id-use-skip-prefix:
  patch-id: use starts_with() and skip_prefix()
</content>
</entry>
<entry>
<title>patch-id: use starts_with() and skip_prefix()</title>
<updated>2016-05-30T00:10:05Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2016-05-28T16:20:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2bb73ae8037ae6fd82f002257d04f8cda2a721cd'/>
<id>urn:sha1:2bb73ae8037ae6fd82f002257d04f8cda2a721cd</id>
<content type='text'>
Get rid of magic numbers and avoid running over the end of a NUL
terminated string by using starts_with() and skip_prefix() instead
of memcmp().

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>usage: do not insist that standard input must come from a file</title>
<updated>2015-10-16T22:27:52Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-10-16T18:27:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=33e8fc87407505c3a96792fc47189d57b97b34c3'/>
<id>urn:sha1:33e8fc87407505c3a96792fc47189d57b97b34c3</id>
<content type='text'>
The synopsys text and the usage string of subcommands that read list
of things from the standard input are often shown like this:

	git gostak [--distim] &lt; &lt;list-of-doshes&gt;

This is problematic in a number of ways:

 * The way to use these commands is more often to feed them the
   output from another command, not feed them from a file.

 * Manual pages outside Git, commands that operate on the data read
   from the standard input, e.g "sort", "grep", "sed", etc., are not
   described with such a "&lt; redirection-from-file" in their synopsys
   text.  Our doing so introduces inconsistency.

 * We do not insist on where the output should go, by saying

	git gostak [--distim] &lt; &lt;list-of-doshes&gt; &gt; &lt;output&gt;

 * As it is our convention to enclose placeholders inside &lt;braket&gt;,
   the redirection operator followed by a placeholder filename
   becomes very hard to read, both in the documentation and in the
   help text.

Let's clean them all up, after making sure that the documentation
clearly describes the modes that take information from the standard
input and what kind of things are expected on the input.

[jc: stole example for fmt-merge-msg from Jonathan]

Helped-by: Jonathan Nieder &lt;jrnieder@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>patch-id: convert to use struct object_id</title>
<updated>2015-03-14T05:43:14Z</updated>
<author>
<name>brian m. carlson</name>
<email>sandals@crustytoothpaste.net</email>
</author>
<published>2015-03-13T23:39:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1a876a69af6552d16827ecc1931c42e2287a83a0'/>
<id>urn:sha1:1a876a69af6552d16827ecc1931c42e2287a83a0</id>
<content type='text'>
Convert some magic numbers to the new GIT_SHA1 constants.

Signed-off-by: brian m. carlson &lt;sandals@crustytoothpaste.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
