<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs.c, branch v2.3.7</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.3.7</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.3.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2015-03-20T19:41:41Z</updated>
<entry>
<title>refs.c: drop curate_packed_refs</title>
<updated>2015-03-20T19:41:41Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-03-20T18:43:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ea56c4e02fc1d5ce6a6b5083c284e32ffc6367e6'/>
<id>urn:sha1:ea56c4e02fc1d5ce6a6b5083c284e32ffc6367e6</id>
<content type='text'>
When we delete a ref, we have to rewrite the entire
packed-refs file. We take this opportunity to "curate" the
packed-refs file and drop any entries that are crufty or
broken.

Dropping broken entries (e.g., with bogus names, or ones
that point to missing objects) is actively a bad idea, as it
means that we lose any notion that the data was there in the
first place. Aside from the general hackiness that we might
lose any information about ref "foo" while deleting an
unrelated ref "bar", this may seriously hamper any attempts
by the user at recovering from the corruption in "foo".

They will lose the sha1 and name of "foo"; the exact pointer
may still be useful even if they recover missing objects
from a different copy of the repository. But worse, once the
ref is gone, there is no trace of the corruption. A
follow-up "git prune" may delete objects, even though it
would otherwise bail when seeing corruption.

We could just drop the "broken" bits from
curate_packed_refs, and continue to drop the "crufty" bits:
refs whose loose counterpart exists in the filesystem. This
is not wrong to do, and it does have the advantage that we
may write out a slightly smaller packed-refs file. But it
has two disadvantages:

  1. It is a potential source of races or mistakes with
     respect to these refs that are otherwise unrelated to
     the operation. To my knowledge, there aren't any active
     problems in this area, but it seems like an unnecessary
     risk.

  2. We have to spend time looking up the matching loose
     refs for every item in the packed-refs file. If you
     have a large number of packed refs that do not change,
     that outweighs the benefit from writing out a smaller
     packed-refs file (it doesn't get smaller, and you do a
     bunch of directory traversal to find that out).

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>refs: introduce a "ref paranoia" flag</title>
<updated>2015-03-20T19:40:49Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-03-20T18:43:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=49672f26d9a3826a6a74c6ff4d2409b7b0c74495'/>
<id>urn:sha1:49672f26d9a3826a6a74c6ff4d2409b7b0c74495</id>
<content type='text'>
Most operations that iterate over refs are happy to ignore
broken cruft. However, some operations should be performed
with knowledge of these broken refs, because it is better
for the operation to choke on a missing object than it is to
silently pretend that the ref did not exist (e.g., if we are
computing the set of reachable tips in order to prune
objects).

These processes could just call for_each_rawref, except that
ref iteration is often hidden behind other interfaces. For
instance, for a destructive "repack -ad", we would have to
inform "pack-objects" that we are destructive, and then it
would in turn have to tell the revision code that our
"--all" should include broken refs.

It's much simpler to just set a global for "dangerous"
operations that includes broken refs in all iterations.

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>Merge branch 'jk/blame-commit-label' into maint</title>
<updated>2015-02-25T06:09:54Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2015-02-25T06:09:54Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=faf723a631aff822b4808c496c0970edb0ca2a99'/>
<id>urn:sha1:faf723a631aff822b4808c496c0970edb0ca2a99</id>
<content type='text'>
"git blame HEAD -- missing" failed to correctly say "HEAD" when it
tried to say "No such path 'missing' in HEAD".

* jk/blame-commit-label:
  blame.c: fix garbled error message
  use xstrdup_or_null to replace ternary conditionals
  builtin/commit.c: use xstrdup_or_null instead of envdup
  builtin/apply.c: use xstrdup_or_null instead of null_strdup
  git-compat-util: add xstrdup_or_null helper
</content>
</entry>
<entry>
<title>use xstrdup_or_null to replace ternary conditionals</title>
<updated>2015-01-13T18:05:48Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-01-13T01:59:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8c53f0719b04e0b6328c2e175e3c5d2dc8a0c282'/>
<id>urn:sha1:8c53f0719b04e0b6328c2e175e3c5d2dc8a0c282</id>
<content type='text'>
This replaces "x ? xstrdup(x) : NULL" with xstrdup_or_null(x).
The change is fairly mechanical, with the exception of
resolve_refdup, which can eliminate a temporary variable.

There are still a few hits grepping for "?.*xstrdup", but
these are of slightly different forms and cannot be
converted (e.g., "x ? xstrdup(x-&gt;foo) : NULL").

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