1. 04 9月, 2014 5 次提交
  2. 15 7月, 2014 11 次提交
  3. 28 5月, 2014 2 次提交
    • J
      remote prune: optimize "dangling symref" check/warning · e6bea66d
      Jens Lindström 提交于
      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: NJens Lindström <jl@opera.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e6bea66d
    • J
      remote: repack packed-refs once when deleting multiple refs · c9e768bb
      Jens Lindström 提交于
      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: NJens Lindström <jl@opera.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c9e768bb
  4. 09 5月, 2014 1 次提交
    • R
      refs.c: add new functions reflog_exists and delete_reflog · 4da58835
      Ronnie Sahlberg 提交于
      Add two new functions, reflog_exists and delete_reflog, to hide the internal
      reflog implementation (that they are files under .git/logs/...) from callers.
      Update checkout.c to use these functions in update_refs_for_switch instead of
      building pathnames and calling out to file access functions. Update reflog.c
      to use these to check if the reflog exists. Now there are still many places
      in reflog.c where we are still leaking the reflog storage implementation but
      this at least reduces the number of such dependencies by one. Finally
      change two places in refs.c itself to use the new function to check if a ref
      exists or not isntead of build-path-and-stat(). Now, this is strictly not all
      that important since these are in parts of refs that are implementing the
      actual file storage backend but on the other hand it will not hurt either.
      Signed-off-by: NRonnie Sahlberg <sahlberg@google.com>
      Acked-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4da58835
  5. 08 4月, 2014 5 次提交
  6. 28 10月, 2013 1 次提交
  7. 05 9月, 2013 1 次提交
    • B
      refs: add update_refs for multiple simultaneous updates · 98aee92d
      Brad King 提交于
      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: NBrad King <brad.king@kitware.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      98aee92d
  8. 31 8月, 2013 1 次提交
  9. 21 6月, 2013 1 次提交
  10. 03 6月, 2013 1 次提交
    • M
      refs: document the lifetime of the args passed to each_ref_fn · 4f78c24c
      Michael Haggerty 提交于
      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: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4f78c24c
  11. 02 5月, 2013 3 次提交
  12. 09 3月, 2013 1 次提交
    • J
      reflog: add for_each_reflog_ent_reverse() API · 98f85ff4
      Junio C Hamano 提交于
      "git checkout -" is a short-hand for "git checkout @{-1}" and the
      "@{nth}" notation for a negative number is to find nth previous
      checkout in the reflog of the HEAD to determine the name of the
      branch the user was on.  We would want to find the nth most recent
      reflog entry that matches "checkout: moving from X to Y" for this.
      
      Unfortunately, reflog is implemented as an append-only file, and the
      API to iterate over its entries, for_each_reflog_ent(), reads the
      file in order, giving the entries from the oldest to newer.  For the
      purpose of finding nth most recent one, this API forces us to record
      the last n entries in a rotating buffer and give the result out only
      after we read everything.  To optimize for a common case of finding
      the nth most recent one for a small value of n, we also have a side
      API for_each_recent_reflog_ent() that starts reading near the end of
      the file, but it still has to read the entries in the "wrong" order.
      The implementation of understanding @{-1} uses this interface.
      
      This all becomes unnecessary if we add an API to let us iterate over
      reflog entries in the reverse order, from the newest to older.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      98f85ff4
  13. 08 2月, 2013 1 次提交
    • J
      upload/receive-pack: allow hiding ref hierarchies · daebaa78
      Junio C Hamano 提交于
      A repository may have refs that are only used for its internal
      bookkeeping purposes that should not be exposed to the others that
      come over the network.
      
      Teach upload-pack to omit some refs from its initial advertisement
      by paying attention to the uploadpack.hiderefs multi-valued
      configuration variable.  Do the same to receive-pack via the
      receive.hiderefs variable.  As a convenient short-hand, allow using
      transfer.hiderefs to set the value to both of these variables.
      
      Any ref that is under the hierarchies listed on the value of these
      variable is excluded from responses to requests made by "ls-remote",
      "fetch", etc. (for upload-pack) and "push" (for receive-pack).
      
      Because these hidden refs do not count as OUR_REF, an attempt to
      fetch objects at the tip of them will be rejected, and because these
      refs do not get advertised, "git push :" will not see local branches
      that have the same name as them as "matching" ones to be sent.
      
      An attempt to update/delete these hidden refs with an explicit
      refspec, e.g. "git push origin :refs/hidden/22", is rejected.  This
      is not a new restriction.  To the pusher, it would appear that there
      is no such ref, so its push request will conclude with "Now that I
      sent you all the data, it is time for you to update the refs.  I saw
      that the ref did not exist when I started pushing, and I want the
      result to point at this commit".  The receiving end will apply the
      compare-and-swap rule to this request and rejects the push with
      "Well, your update request conflicts with somebody else; I see there
      is such a ref.", which is the right thing to do. Otherwise a push to
      a hidden ref will always be "the last one wins", which is not a good
      default.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      daebaa78
  14. 11 4月, 2012 1 次提交
    • M
      refs: store references hierarchically · 432ad41e
      Michael Haggerty 提交于
      Store references hierarchically in a tree that matches the
      pseudo-directory structure of the reference names.  Add a new kind of
      ref_entry (with flag REF_DIR) to represent a whole subdirectory of
      references.  Sort ref_dirs one subdirectory at a time.
      
      NOTE: the dirs can now be sorted as a side-effect of other function
      calls.  Therefore, it would be problematic to do something from a
      each_ref_fn callback that could provoke the sorting of a directory
      that is currently being iterated over (i.e., the directory containing
      the entry that is being processed or any of its parents).
      
      This is a bit far-fetched, because a directory is always sorted just
      before being iterated over.  Therefore, read-only accesses cannot
      trigger the sorting of a directory whose iteration has already
      started.  But if a callback function would add a reference to a parent
      directory of the reference in the iteration, then try to resolve a
      reference under that directory, a re-sort could be triggered and cause
      the iteration to work incorrectly.
      
      Nevertheless...add a comment in refs.h warning against modifications
      during iteration.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      432ad41e
  15. 13 2月, 2012 1 次提交
  16. 18 1月, 2012 1 次提交
  17. 13 12月, 2011 3 次提交