1. 25 8月, 2017 1 次提交
  2. 25 7月, 2017 1 次提交
  3. 18 7月, 2017 1 次提交
  4. 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
  5. 24 6月, 2017 2 次提交
  6. 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
  7. 16 6月, 2017 1 次提交
  8. 23 5月, 2017 9 次提交
  9. 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
  10. 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
  11. 25 4月, 2017 2 次提交
  12. 17 4月, 2017 3 次提交
  13. 14 4月, 2017 7 次提交
  14. 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
  15. 28 3月, 2017 6 次提交
  16. 24 3月, 2017 1 次提交
  17. 03 3月, 2017 1 次提交
    • J
      interpret_branch_name: allow callers to restrict expansions · 0e9f62da
      Jeff King 提交于
      The interpret_branch_name() function converts names like
      @{-1} and @{upstream} into branch names. The expanded ref
      names are not fully qualified, and may be outside of the
      refs/heads/ namespace (e.g., "@" expands to "HEAD", and
      "@{upstream}" is likely to be in "refs/remotes/").
      
      This is OK for callers like dwim_ref() which are primarily
      interested in resolving the resulting name, no matter where
      it is. But callers like "git branch" treat the result as a
      branch name in refs/heads/.  When we expand to a ref outside
      that namespace, the results are very confusing (e.g., "git
      branch @" tries to create refs/heads/HEAD, which is
      nonsense).
      
      Callers can't know from the returned string how the
      expansion happened (e.g., did the user really ask for a
      branch named "HEAD", or did we do a bogus expansion?). One
      fix would be to return some out-parameters describing the
      types of expansion that occurred. This has the benefit that
      the caller can generate precise error messages ("I
      understood @{upstream} to mean origin/master, but that is a
      remote tracking branch, so you cannot create it as a local
      name").
      
      However, out-parameters make the function interface somewhat
      cumbersome. Instead, let's do the opposite: let the caller
      tell us which elements to expand. That's easier to pass in,
      and none of the callers give more precise error messages
      than "@{upstream} isn't a valid branch name" anyway (which
      should be sufficient).
      
      The strbuf_branchname() function needs a similar parameter,
      as most of the callers access interpret_branch_name()
      through it.
      
      We can break the callers down into two groups:
      
        1. Callers that are happy with any kind of ref in the
           result. We pass "0" here, so they continue to work
           without restrictions. This includes merge_name(),
           the reflog handling in add_pending_object_with_path(),
           and substitute_branch_name(). This last is what powers
           dwim_ref().
      
        2. Callers that have funny corner cases (mostly in
           git-branch and git-checkout). These need to make use of
           the new parameter, but I've left them as "0" in this
           patch, and will address them individually in follow-on
           patches.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      0e9f62da