<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/refs.h, branch v2.0.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.0.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.0.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2014-05-27T19:30:47Z</updated>
<entry>
<title>remote prune: optimize "dangling symref" check/warning</title>
<updated>2014-05-27T19:30:47Z</updated>
<author>
<name>Jens Lindström</name>
<email>jl@opera.com</email>
</author>
<published>2014-05-23T10:30:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e6bea66db6229a0975ebba510a1d2827bf09cb7f'/>
<id>urn:sha1:e6bea66db6229a0975ebba510a1d2827bf09cb7f</id>
<content type='text'>
When 'git remote prune' was used to delete many refs in a repository
with many refs, a lot of time was spent checking for (now) dangling
symbolic refs pointing to the deleted ref, since warn_dangling_symref()
was once per deleted ref to check all other refs in the repository.

Avoid this using the new warn_dangling_symrefs() function which
makes one pass over all refs and checks for all the deleted refs in
one go, after they have all been deleted.

Signed-off-by: Jens LindstrÃ¶m &lt;jl@opera.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>remote: repack packed-refs once when deleting multiple refs</title>
<updated>2014-05-27T19:30:42Z</updated>
<author>
<name>Jens Lindström</name>
<email>jl@opera.com</email>
</author>
<published>2014-05-23T10:29:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c9e768bb77762765f739fffb5c09d0888f3de20e'/>
<id>urn:sha1:c9e768bb77762765f739fffb5c09d0888f3de20e</id>
<content type='text'>
When 'git remote rm' or 'git remote prune' were used in a repository
with many refs, and needed to delete many remote-tracking refs, a lot
of time was spent deleting those refs since for each deleted ref,
repack_without_refs() was called to rewrite packed-refs without just
that deleted ref.

To avoid this, call repack_without_refs() first to repack without all
the refs that will be deleted, before calling delete_ref() to delete
each one completely.  The call to repack_without_ref() in delete_ref()
then becomes a no-op, since packed-refs already won't contain any of
the deleted refs.

Signed-off-by: Jens LindstrÃ¶m &lt;jl@opera.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'sb/refs-code-cleanup'</title>
<updated>2013-11-01T14:38:58Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-11-01T14:38:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=e0fd1e3841ebe24aa1d1a6c1ebbb1673f1201927'/>
<id>urn:sha1:e0fd1e3841ebe24aa1d1a6c1ebbb1673f1201927</id>
<content type='text'>
* sb/refs-code-cleanup:
  cache: remove unused function 'have_git_dir'
  refs: remove unused function invalidate_ref_cache
</content>
</entry>
<entry>
<title>refs: remove unused function invalidate_ref_cache</title>
<updated>2013-10-28T15:55:56Z</updated>
<author>
<name>Stefan Beller</name>
<email>stefanbeller@googlemail.com</email>
</author>
<published>2013-10-26T17:03:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=746593bdcaf86827e016c97e091442d6a227de0f'/>
<id>urn:sha1:746593bdcaf86827e016c97e091442d6a227de0f</id>
<content type='text'>
The function 'invalidate_ref_cache' was introduced in 79c7ca5 (2011-10-17,
invalidate_ref_cache(): rename function from invalidate_cached_refs())
by a rename and elevated to be publicly usable in 8be8bde (2011-10-17,
invalidate_ref_cache(): expose this function in the refs API)

However it is not used anymore, as 8bf90dc (2011-10-17, write_ref_sha1():
only invalidate the loose ref cache) and (much) later 506a760 (2013-04-22,
refs: change how packed refs are deleted) removed any calls to this
function. So it seems as if we don't need that function any more,
good bye!

Signed-off-by: Stefan Beller &lt;stefanbeller@googlemail.com&gt;
Acked-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: add update_refs for multiple simultaneous updates</title>
<updated>2013-09-04T18:10:28Z</updated>
<author>
<name>Brad King</name>
<email>brad.king@kitware.com</email>
</author>
<published>2013-09-04T15:22:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=98aee92d5c9e5161a8c11b7666996e4ffffe80ab'/>
<id>urn:sha1:98aee92d5c9e5161a8c11b7666996e4ffffe80ab</id>
<content type='text'>
Add 'struct ref_update' to encode the information needed to update or
delete a ref (name, new sha1, optional old sha1, no-deref flag).  Add
function 'update_refs' accepting an array of updates to perform.  First
sort the input array to order locks consistently everywhere and reject
multiple updates to the same ref.  Then acquire locks on all refs with
verified old values.  Then update or delete all refs accordingly.  Fail
if any one lock cannot be obtained or any one old value does not match.

Though the refs themselves cannot be modified together in a single
atomic transaction, this function does enable some useful semantics.
For example, a caller may create a new branch starting from the head of
another branch and rewind the original branch at the same time.  This
transfers ownership of commits between branches without risk of losing
commits added to the original branch by a concurrent process, or risk of
a concurrent process creating the new branch first.

Signed-off-by: Brad King &lt;brad.king@kitware.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: report ref type from lock_any_ref_for_update</title>
<updated>2013-08-30T21:57:28Z</updated>
<author>
<name>Brad King</name>
<email>brad.king@kitware.com</email>
</author>
<published>2013-08-30T18:12:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9bbb0fa1fdc6c413b1f35c26e090515e5d0096aa'/>
<id>urn:sha1:9bbb0fa1fdc6c413b1f35c26e090515e5d0096aa</id>
<content type='text'>
Expose lock_ref_sha1_basic's type_p argument to callers of
lock_any_ref_for_update.  Update all call sites to ignore it by passing
NULL for now.

Signed-off-by: Brad King &lt;brad.king@kitware.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>refs: implement simple transactions for the packed-refs file</title>
<updated>2013-06-20T22:50:17Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2013-06-20T08:37:46Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=9f69d297703bff37c5506276c2565c721347e03f'/>
<id>urn:sha1:9f69d297703bff37c5506276c2565c721347e03f</id>
<content type='text'>
Handle simple transactions for the packed-refs file at the
packed_ref_cache level via new functions lock_packed_refs(),
commit_packed_refs(), and rollback_packed_refs().

Only allow the packed ref cache to be modified (via add_packed_ref())
while the packed refs file is locked.

Change clone to add the new references within a transaction.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'mh/reflife'</title>
<updated>2013-06-14T15:46:14Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-06-14T15:46:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ede63a195c53d31207d694258bd8bc740dbc87a7'/>
<id>urn:sha1:ede63a195c53d31207d694258bd8bc740dbc87a7</id>
<content type='text'>
Define memory ownership and lifetime rules for what for-each-ref
feeds to its callbacks (in short, "you do not own it, so make a
copy if you want to keep it").

* mh/reflife: (25 commits)
  refs: document the lifetime of the args passed to each_ref_fn
  register_ref(): make a copy of the bad reference SHA-1
  exclude_existing(): set existing_refs.strdup_strings
  string_list_add_refs_by_glob(): add a comment about memory management
  string_list_add_one_ref(): rename first parameter to "refname"
  show_head_ref(): rename first parameter to "refname"
  show_head_ref(): do not shadow name of argument
  add_existing(): do not retain a reference to sha1
  do_fetch(): clean up existing_refs before exiting
  do_fetch(): reduce scope of peer_item
  object_array_entry: fix memory handling of the name field
  find_first_merges(): remove unnecessary code
  find_first_merges(): initialize merges variable using initializer
  fsck: don't put a void*-shaped peg in a char*-shaped hole
  object_array_remove_duplicates(): rewrite to reduce copying
  revision: use object_array_filter() in implementation of gc_boundary()
  object_array: add function object_array_filter()
  revision: split some overly-long lines
  cmd_diff(): make it obvious which cases are exclusive of each other
  cmd_diff(): rename local variable "list" -&gt; "entry"
  ...
</content>
</entry>
<entry>
<title>refs: document the lifetime of the args passed to each_ref_fn</title>
<updated>2013-06-02T22:28:47Z</updated>
<author>
<name>Michael Haggerty</name>
<email>mhagger@alum.mit.edu</email>
</author>
<published>2013-05-25T09:08:24Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=4f78c24c63bf0b035afc02372727a3b5897d9835'/>
<id>urn:sha1:4f78c24c63bf0b035afc02372727a3b5897d9835</id>
<content type='text'>
The lifetime of the memory pointed to by the refname and sha1
arguments to each_ref_fn was never documented, but some callers used
to assume that it was essentially permanent.  In fact the API does
*not* guarantee that these objects live beyond a single callback
invocation.

In the current code, the lifetimes are bound together with the
lifetimes of the ref_caches.  Since these are usually long, the
callers usually got away with their sloppiness.  But even today, if a
ref_cache is invalidated the memory can be freed.  And planned changes
to reference caching, needed to eliminate race conditions, will
probably need to shorten the lifetimes of these objects.

The commits leading up to this have (hopefully) fixed all of the
callers of the for_each_ref()-like functions.  This commit does the
last step: documents what each_ref_fn callbacks can assume about
object lifetimes.

Signed-off-by: Michael Haggerty &lt;mhagger@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'mh/packed-refs-various'</title>
<updated>2013-05-29T21:23:49Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-05-29T21:23:49Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=2f1ef15070a8664d3194d164f20283d78571e51c'/>
<id>urn:sha1:2f1ef15070a8664d3194d164f20283d78571e51c</id>
<content type='text'>
Update reading and updating packed-refs file, correcting corner case
bugs.

* mh/packed-refs-various: (33 commits)
  refs: handle the main ref_cache specially
  refs: change do_for_each_*() functions to take ref_cache arguments
  pack_one_ref(): do some cheap tests before a more expensive one
  pack_one_ref(): use write_packed_entry() to do the writing
  pack_one_ref(): use function peel_entry()
  refs: inline function do_not_prune()
  pack_refs(): change to use do_for_each_entry()
  refs: use same lock_file object for both ref-packing functions
  pack_one_ref(): rename "path" parameter to "refname"
  pack-refs: merge code from pack-refs.{c,h} into refs.{c,h}
  pack-refs: rename handle_one_ref() to pack_one_ref()
  refs: extract a function write_packed_entry()
  repack_without_ref(): write peeled refs in the rewritten file
  t3211: demonstrate loss of peeled refs if a packed ref is deleted
  refs: change how packed refs are deleted
  search_ref_dir(): return an index rather than a pointer
  repack_without_ref(): silence errors for dangling packed refs
  t3210: test for spurious error messages for dangling packed refs
  refs: change the internal reference-iteration API
  refs: extract a function peel_entry()
  ...
</content>
</entry>
</feed>
