<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/builtin/patch-id.c, branch v2.2.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.2.0</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.2.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-06-10T20:09:24Z</updated>
<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>
<entry>
<title>patch-id.c: use strbuf instead of a fixed buffer</title>
<updated>2011-09-22T16:35:07Z</updated>
<author>
<name>Michael Schubert</name>
<email>mschub@elegosoft.com</email>
</author>
<published>2011-09-21T12:42:22Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=b9ab810b1826a7757e16f152faf0c28c2fdaa679'/>
<id>urn:sha1:b9ab810b1826a7757e16f152faf0c28c2fdaa679</id>
<content type='text'>
get_one_patchid() uses a rather dumb heuristic to determine if the
passed buffer is part of the next commit. Whenever the first 40 bytes
are a valid hexadecimal sha1 representation, get_one_patchid() returns
next_sha1.

Once the current line is longer than the fixed buffer, this will break
(provided the additional bytes make a valid hexadecimal sha1). As a result
patch-id returns incorrect results. Instead, use strbuf and read one line
at a time.

Helped-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Michael Schubert &lt;mschub@elegosoft.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Fix sparse warnings</title>
<updated>2011-03-22T17:16:54Z</updated>
<author>
<name>Stephen Boyd</name>
<email>bebarino@gmail.com</email>
</author>
<published>2011-03-22T07:51:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c2e86addb86689306b992065328ec52aa2479658'/>
<id>urn:sha1:c2e86addb86689306b992065328ec52aa2479658</id>
<content type='text'>
Fix warnings from 'make check'.

 - These files don't include 'builtin.h' causing sparse to complain that
   cmd_* isn't declared:

   builtin/clone.c:364, builtin/fetch-pack.c:797,
   builtin/fmt-merge-msg.c:34, builtin/hash-object.c:78,
   builtin/merge-index.c:69, builtin/merge-recursive.c:22
   builtin/merge-tree.c:341, builtin/mktag.c:156, builtin/notes.c:426
   builtin/notes.c:822, builtin/pack-redundant.c:596,
   builtin/pack-refs.c:10, builtin/patch-id.c:60, builtin/patch-id.c:149,
   builtin/remote.c:1512, builtin/remote-ext.c:240,
   builtin/remote-fd.c:53, builtin/reset.c:236, builtin/send-pack.c:384,
   builtin/unpack-file.c:25, builtin/var.c:75

 - These files have symbols which should be marked static since they're
   only file scope:

   submodule.c:12, diff.c:631, replace_object.c:92, submodule.c:13,
   submodule.c:14, trace.c:78, transport.c:195, transport-helper.c:79,
   unpack-trees.c:19, url.c:3, url.c:18, url.c:104, url.c:117, url.c:123,
   url.c:129, url.c:136, thread-utils.c:21, thread-utils.c:48

 - These files redeclare symbols to be different types:

   builtin/index-pack.c:210, parse-options.c:564, parse-options.c:571,
   usage.c:49, usage.c:58, usage.c:63, usage.c:72

 - These files use a literal integer 0 when they really should use a NULL
   pointer:

   daemon.c:663, fast-import.c:2942, imap-send.c:1072, notes-merge.c:362

While we're in the area, clean up some unused #includes in builtin files
(mostly exec_cmd.h).

Signed-off-by: Stephen Boyd &lt;bebarino@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>git-patch-id: do not trip over "no newline" markers</title>
<updated>2011-02-17T19:56:50Z</updated>
<author>
<name>Michael J Gruber</name>
<email>git@drmicha.warpmail.net</email>
</author>
<published>2011-02-17T07:44:42Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2485eab55cc0dcab34311ecd0ac52038aa9d9db4'/>
<id>urn:sha1:2485eab55cc0dcab34311ecd0ac52038aa9d9db4</id>
<content type='text'>
Currently, patch-id trips over our very own diff extension for marking
the absence of newline at EOF.

Fix it. (Ignore it, it's whitespace.)

Signed-off-by: Michael J Gruber &lt;git@drmicha.warpmail.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>patch-id: Add support for mbox format</title>
<updated>2010-04-19T20:01:49Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>bonzini@gnu.org</email>
</author>
<published>2010-04-19T08:46:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=580fb25b7a941267aad747afdc74b9b4a42e154a'/>
<id>urn:sha1:580fb25b7a941267aad747afdc74b9b4a42e154a</id>
<content type='text'>
I have an alias that takes two arguments and compares their patch IDs.
I would like to use to make sure I've tested exactly what I submit
(patch by patch), like

   git patch-cmp origin/master.. file-being-sent

However, I cannot do that because git patch-id is fooled by the "-- "
trailer that git format-patch puts, or likely by the MIME boundary.

This patch adds hunk parsing logic to git patch-id in order to detect an
out of place "-" line and split the patch when it comes.  In addition,
commit ids in the "From " lines are considered and printed in the output.

Signed-off-by: Paolo Bonzini &lt;bonzini@gnu.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>patch-id: extract parsing one diff out of generate_id_list</title>
<updated>2010-04-19T20:01:46Z</updated>
<author>
<name>Paolo Bonzini</name>
<email>bonzini@gnu.org</email>
</author>
<published>2010-04-19T08:46:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9ae144fbf2648a52da1cc5269918931b328180f9'/>
<id>urn:sha1:9ae144fbf2648a52da1cc5269918931b328180f9</id>
<content type='text'>
This simplifies a bit the next patch, since it will have more than one
condition to exit the loop.

Signed-off-by: Paolo Bonzini &lt;bonzini@gnu.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Move 'builtin-*' into a 'builtin/' subdirectory</title>
<updated>2010-02-22T22:29:41Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2010-02-22T16:42:18Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=81b50f3ce40bfdd66e5d967bf82be001039a9a98'/>
<id>urn:sha1:81b50f3ce40bfdd66e5d967bf82be001039a9a98</id>
<content type='text'>
This shrinks the top-level directory a bit, and makes it much more
pleasant to use auto-completion on the thing. Instead of

	[torvalds@nehalem git]$ em buil&lt;tab&gt;
	Display all 180 possibilities? (y or n)
	[torvalds@nehalem git]$ em builtin-sh
	builtin-shortlog.c     builtin-show-branch.c  builtin-show-ref.c
	builtin-shortlog.o     builtin-show-branch.o  builtin-show-ref.o
	[torvalds@nehalem git]$ em builtin-shor&lt;tab&gt;
	builtin-shortlog.c  builtin-shortlog.o
	[torvalds@nehalem git]$ em builtin-shortlog.c

you get

	[torvalds@nehalem git]$ em buil&lt;tab&gt;		[type]
	builtin/   builtin.h
	[torvalds@nehalem git]$ em builtin		[auto-completes to]
	[torvalds@nehalem git]$ em builtin/sh&lt;tab&gt;	[type]
	shortlog.c     shortlog.o     show-branch.c  show-branch.o  show-ref.c     show-ref.o
	[torvalds@nehalem git]$ em builtin/sho		[auto-completes to]
	[torvalds@nehalem git]$ em builtin/shor&lt;tab&gt;	[type]
	shortlog.c  shortlog.o
	[torvalds@nehalem git]$ em builtin/shortlog.c

which doesn't seem all that different, but not having that annoying
break in "Display all 180 possibilities?" is quite a relief.

NOTE! If you do this in a clean tree (no object files etc), or using an
editor that has auto-completion rules that ignores '*.o' files, you
won't see that annoying 'Display all 180 possibilities?' message - it
will just show the choices instead.  I think bash has some cut-off
around 100 choices or something.

So the reason I see this is that I'm using an odd editory, and thus
don't have the rules to cut down on auto-completion.  But you can
simulate that by using 'ls' instead, or something similar.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
