<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/patch-id.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>2019-12-09T20:26:40Z</updated>
<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>
<entry>
<title>patch-id: make it stable against hunk reordering</title>
<updated>2014-06-10T20:09:24Z</updated>
<author>
<name>Michael S. Tsirkin</name>
<email>mst@redhat.com</email>
</author>
<published>2014-04-27T18:15:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=30e12b924b57b15e707f1749f2e5af15f1c7fe09'/>
<id>urn:sha1:30e12b924b57b15e707f1749f2e5af15f1c7fe09</id>
<content type='text'>
Patch id changes if users reorder file diffs that make up a patch.

As the result is functionally equivalent, a different patch id is
surprising to many users.
In particular, reordering files using diff -O is helpful to make patches
more readable (e.g. API header diff before implementation diff).

Add an option to change patch-id behaviour making it stable against
these kinds of patch change:
calculate SHA1 hash for each hunk separately and sum all hashes
(using a symmetrical sum) to get patch id

We use a 20byte sum and not xor - since xor would give 0 output
for patches that have two identical diffs, which isn't all that
unlikely (e.g. append the same line in two places).

The new behaviour is enabled
- when patchid.stable is true
- when --stable flag is present

Using a new flag --unstable or setting patchid.stable to false force
the historical behaviour.

In the documentation, clarify that patch ID can now be a sum of hashes,
not a hash.
Document how command line and config options affect the
behaviour.

Signed-off-by: Michael S. Tsirkin &lt;mst@redhat.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
