1. 14 9月, 2017 1 次提交
    • S
      replace-objects: evaluate replacement refs without using the object store · 006f3f28
      Stefan Beller 提交于
      Pass DO_FOR_EACH_INCLUDE_BROKEN when iterating over replacement refs
      so that the iteration does not require opening the named objects from
      the object store. This avoids a dependency cycle between object access
      and replace ref iteration.
      
      Moreover the ref subsystem has not been migrated yet to access the
      object store via passed in repository objects.  As a result, without
      this patch, iterating over replace refs in a repository other than
      the_repository it produces errors:
      
         error: refs/replace/3afabef75c627b894cccc3bcae86837abc7c32fe does not point to a valid object!
      
      Noticed while adapting the object store (and in particular its
      evaluation of replace refs) to handle arbitrary repositories.
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      006f3f28
  2. 24 8月, 2017 1 次提交
    • M
      refs: retry acquiring reference locks for 100ms · 4ff0f01c
      Michael Haggerty 提交于
      The philosophy of reference locking has been, "if another process is
      changing a reference, then whatever I'm trying to do to it will
      probably fail anyway because my old-SHA-1 value is probably no longer
      current". But this argument falls down if the other process has locked
      the reference to do something that doesn't actually change the value
      of the reference, such as `pack-refs` or `reflog expire`. There
      actually *is* a decent chance that a planned reference update will
      still be able to go through after the other process has released the
      lock.
      
      So when trying to lock an individual reference (e.g., when creating
      "refs/heads/master.lock"), if it is already locked, then retry the
      lock acquisition for approximately 100 ms before giving up. This
      should eliminate some unnecessary lock conflicts without wasting a lot
      of time.
      
      Add a configuration setting, `core.filesRefLockTimeout`, to allow this
      setting to be tweaked.
      
      Note: the function `get_files_ref_lock_timeout_ms()` cannot be private
      to the files backend because it is also used by `write_pseudoref()`
      and `delete_pseudoref()`, which are defined in `refs.c` so that they
      can be used by other reference backends.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4ff0f01c
  3. 25 7月, 2017 1 次提交
  4. 18 7月, 2017 1 次提交
  5. 01 7月, 2017 1 次提交
    • S
      hashmap.h: compare function has access to a data field · 7663cdc8
      Stefan Beller 提交于
      When using the hashmap a common need is to have access to caller provided
      data in the compare function. A couple of times we abuse the keydata field
      to pass in the data needed. This happens for example in patch-ids.c.
      
      This patch changes the function signature of the compare function
      to have one more void pointer available. The pointer given for each
      invocation of the compare function must be defined in the init function
      of the hashmap and is just passed through.
      
      Documentation of this new feature is deferred to a later patch.
      This is a rather mechanical conversion, just adding the new pass-through
      parameter.  However while at it improve the naming of the fields of all
      compare functions used by hashmaps by ensuring unused parameters are
      prefixed with 'unused_' and naming the parameters what they are (instead
      of 'unused' make it 'unused_keydata').
      Signed-off-by: NStefan Beller <sbeller@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7663cdc8
  6. 24 6月, 2017 2 次提交
  7. 19 6月, 2017 1 次提交
    • M
      for_each_bisect_ref(): don't trim refnames · 03df567f
      Michael Haggerty 提交于
      `for_each_bisect_ref()` is called by `for_each_bad_bisect_ref()` with
      a term "bad". This used to make it call `for_each_ref_in_submodule()`
      with a prefix "refs/bisect/bad". But the latter is the name of the
      reference that is being sought, so the empty string was being passed
      to the callback as the trimmed refname. Moreover, this questionable
      practice was turned into an error by
      
          b9c8e7f2 prefix_ref_iterator: don't trim too much, 2017-05-22
      
      It makes more sense (and agrees better with the documentation of
      `--bisect`) for the callers to receive the full reference names. So
      
      * Add a new function, `for_each_fullref_in_submodule()`, to the refs
        API. This plugs a gap in the existing functionality, analogous to
        `for_each_fullref_in()` but accepting a `submodule` argument.
      
      * Change `for_each_bad_bisect_ref()` to call the new function rather
        than `for_each_ref_in_submodule()`.
      
      * Add a test.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      03df567f
  8. 16 6月, 2017 1 次提交
  9. 23 5月, 2017 9 次提交
  10. 08 5月, 2017 1 次提交
    • B
      refs: convert struct ref_update to use struct object_id · 98491298
      brian m. carlson 提交于
      Convert struct ref_array_item to use struct object_id by changing the
      definition and applying the following semantic patch, plus the standard
      object_id transforms:
      
      @@
      struct ref_update E1;
      @@
      - E1.new_sha1
      + E1.new_oid.hash
      
      @@
      struct ref_update *E1;
      @@
      - E1->new_sha1
      + E1->new_oid.hash
      
      @@
      struct ref_update E1;
      @@
      - E1.old_sha1
      + E1.old_oid.hash
      
      @@
      struct ref_update *E1;
      @@
      - E1->old_sha1
      + E1->old_oid.hash
      
      This transformation allows us to convert write_ref_to_lockfile, which is
      required to convert parse_object.
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      98491298
  11. 27 4月, 2017 1 次提交
    • J
      timestamp_t: a new data type for timestamps · dddbad72
      Johannes Schindelin 提交于
      Git's source code assumes that unsigned long is at least as precise as
      time_t. Which is incorrect, and causes a lot of problems, in particular
      where unsigned long is only 32-bit (notably on Windows, even in 64-bit
      versions).
      
      So let's just use a more appropriate data type instead. In preparation
      for this, we introduce the new `timestamp_t` data type.
      
      By necessity, this is a very, very large patch, as it has to replace all
      timestamps' data type in one go.
      
      As we will use a data type that is not necessarily identical to `time_t`,
      we need to be very careful to use `time_t` whenever we interact with the
      system functions, and `timestamp_t` everywhere else.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dddbad72
  12. 25 4月, 2017 2 次提交
  13. 17 4月, 2017 3 次提交
  14. 14 4月, 2017 7 次提交
  15. 31 3月, 2017 1 次提交
    • J
      avoid using mksnpath for refs · 6cd4a898
      Jeff King 提交于
      Like the previous commit, we'd like to avoid the assumption
      that refs fit into PATH_MAX-sized buffers. These callsites
      have an extra twist, though: they write the refnames using
      mksnpath. This does two things beyond a regular snprintf:
      
        1. It quietly writes "/bad-path/" when truncation occurs.
           This saves the caller having to check the error code,
           but if you aren't actually feeding the result to a
           system call (and we aren't here), it's questionable.
      
        2. It calls cleanup_path(), which removes leading
           instances of "./".  That's questionable when dealing
           with refnames, as we could silently canonicalize a
           syntactically bogus refname into a valid one.
      
      Let's convert each case to use a strbuf. This is preferable
      to xstrfmt() because we can reuse the same buffer as we
      loop.
      Signed-off-by: NJeff King <peff@peff.net>
      6cd4a898
  16. 28 3月, 2017 6 次提交
  17. 24 3月, 2017 1 次提交