<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs.c, branch v2.3.0</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.3.0</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.3.0'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-12-29T21:14:16Z</updated>
<entry>
<title>refs: plug strbuf leak in lock_ref_sha1_basic()</title>
<updated>2014-12-29T21:14:16Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-12-24T00:18:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=33adc83ddb315a614a59604a0d39caa5a1b27bdd'/>
<id>urn:sha1:33adc83ddb315a614a59604a0d39caa5a1b27bdd</id>
<content type='text'>
Don't just reset, but release the resource held by the local
variable that is about to go out of scope.

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>Merge branch 'jk/read-packed-refs-without-path-max'</title>
<updated>2014-12-22T20:28:04Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-12-22T20:28:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=aa9066fccd4a4320ab3e90f566527b7497d2c7c0'/>
<id>urn:sha1:aa9066fccd4a4320ab3e90f566527b7497d2c7c0</id>
<content type='text'>
Git did not correctly read an overlong refname from a packed refs
file.

* jk/read-packed-refs-without-path-max:
  read_packed_refs: use skip_prefix instead of static array
  read_packed_refs: pass strbuf to parse_ref_line
  read_packed_refs: use a strbuf for reading lines
</content>
</entry>
<entry>
<title>Merge branch 'jk/for-each-reflog-ent-reverse'</title>
<updated>2014-12-22T20:27:32Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-12-22T20:27:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6f3abb7a8743bbd0bffa11a3f5df84d0da532c59'/>
<id>urn:sha1:6f3abb7a8743bbd0bffa11a3f5df84d0da532c59</id>
<content type='text'>
The code that reads the reflog from the newer to the older entries
did not handle an entry that crosses a boundary of block it uses to
read them correctly.

* jk/for-each-reflog-ent-reverse:
  for_each_reflog_ent_reverse: turn leftover check into assertion
  for_each_reflog_ent_reverse: fix newlines on block boundaries
</content>
</entry>
<entry>
<title>Merge branch 'mh/simplify-repack-without-refs'</title>
<updated>2014-12-22T20:26:50Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2014-12-22T20:26:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a7ddaa8eacb45fdd5241e52d72e6f75d8b67b953'/>
<id>urn:sha1:a7ddaa8eacb45fdd5241e52d72e6f75d8b67b953</id>
<content type='text'>
"git remote update --prune" to drop many refs has been optimized.

* mh/simplify-repack-without-refs:
  sort_string_list(): rename to string_list_sort()
  prune_remote(): iterate using for_each_string_list_item()
  prune_remote(): rename local variable
  repack_without_refs(): make the refnames argument a string_list
  prune_remote(): sort delete_refs_list references en masse
  prune_remote(): initialize both delete_refs lists in a single loop
  prune_remote(): exit early if there are no stale references
</content>
</entry>
<entry>
<title>read_packed_refs: use skip_prefix instead of static array</title>
<updated>2014-12-10T17:40:33Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-12-10T10:40:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ea417833ea9a07d7b8d568358ff20f57851cb26e'/>
<id>urn:sha1:ea417833ea9a07d7b8d568358ff20f57851cb26e</id>
<content type='text'>
We want to recognize the packed-refs header and skip to the
"traits" part of the line. We currently do it by feeding
sizeof() a static const array to strncmp. However, it's a
bit simpler to just skip_prefix, which expresses the
intention more directly, and without remembering to account
for the NUL-terminator in each sizeof() call.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read_packed_refs: pass strbuf to parse_ref_line</title>
<updated>2014-12-10T17:28:54Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-12-10T10:40:19Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=6a49870a7245934eac671e3dcd7186a90dac255d'/>
<id>urn:sha1:6a49870a7245934eac671e3dcd7186a90dac255d</id>
<content type='text'>
Now that we have a strbuf in read_packed_refs, we can pass
it straight to the line parser, which saves us an extra
strlen.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>read_packed_refs: use a strbuf for reading lines</title>
<updated>2014-12-10T17:27:24Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-12-10T10:40:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=10c497aa0cc7ccb5bd213f53fc0cd803bd73a508'/>
<id>urn:sha1:10c497aa0cc7ccb5bd213f53fc0cd803bd73a508</id>
<content type='text'>
Current code uses a fixed PATH_MAX-sized buffer for reading
packed-refs lines. This is a reasonable guess, in the sense
that git generally cannot work with refs larger than
PATH_MAX.  However, there are a few cases where it is not
great:

  1. Some systems may have a low value of PATH_MAX, but can
     actually handle larger paths in practice. Fixing this
     code path probably isn't enough to make them work
     completely with long refs, but it is a step in the
     right direction.

  2. We use fgets, which will happily give us half a line on
     the first read, and then the rest of the line on the
     second. This is probably OK in practice, because our
     refline parser is careful enough to look for the
     trailing newline on the first line. The second line may
     look like a peeled line to us, but since "^" is illegal
     in refnames, it is not likely to come up.

     Still, it does not hurt to be more careful.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>for_each_reflog_ent_reverse: turn leftover check into assertion</title>
<updated>2014-12-05T19:11:52Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-12-05T01:32:44Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=69216bf72be2be4f8aa932324b3145d3f395cdc6'/>
<id>urn:sha1:69216bf72be2be4f8aa932324b3145d3f395cdc6</id>
<content type='text'>
Our loop should always process all lines, even if we hit the
beginning of the file. We have a conditional after the loop
ends to double-check that there is nothing left and to
process it. But this should never happen, and is a sign of a
logic bug in the loop. Let's turn it into a BUG assertion.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>for_each_reflog_ent_reverse: fix newlines on block boundaries</title>
<updated>2014-12-05T19:11:35Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2014-12-05T01:28:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e5e73ff20b5a750b9622438fd877f4e4a4c3519b'/>
<id>urn:sha1:e5e73ff20b5a750b9622438fd877f4e4a4c3519b</id>
<content type='text'>
When we read a reflog file in reverse, we read whole chunks
of BUFSIZ bytes, then loop over the buffer, parsing any
lines we find. We find the beginning of each line by looking
for the newline from the previous line. If we don't find
one, we know that we are either at the beginning of
the file, or that we have to read another block.

In the latter case, we stuff away what we have into a
strbuf, read another block, and continue our parse. But we
missed one case here. If we did find a newline, and it is at
the beginning of the block, we must also stuff that newline
into the strbuf, as it belongs to the block we are about to
read.

The minimal fix here would be to add this special case to
the conditional that checks whether we found a newline.
But we can make the flow a little clearer by rearranging a
bit: we first handle lines that we are going to show, and
then at the end of each loop, stuff away any leftovers if
necessary. That lets us fold this special-case in with the
more common "we ended in the middle of a line" case.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>repack_without_refs(): make the refnames argument a string_list</title>
<updated>2014-11-25T18:09:58Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2014-11-25T08:02:32Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4a45b2f347245d321bf5c07fbe3f8091d122732f'/>
<id>urn:sha1:4a45b2f347245d321bf5c07fbe3f8091d122732f</id>
<content type='text'>
Most of the callers have string_lists available already, whereas two
of them had to read data out of a string_list into an array of strings
just to call this function. So change repack_without_refs() to take
the list of refnames to omit as a string_list, and change the callers
accordingly.

Suggested-by: Ronnie Sahlberg &lt;sahlberg@google.com&gt;
Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
