1. 23 5月, 2017 7 次提交
  2. 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
  3. 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
  4. 25 4月, 2017 2 次提交
  5. 17 4月, 2017 3 次提交
  6. 14 4月, 2017 7 次提交
  7. 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
  8. 28 3月, 2017 6 次提交
  9. 24 3月, 2017 1 次提交
  10. 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
  11. 25 2月, 2017 2 次提交
  12. 23 2月, 2017 1 次提交
  13. 21 2月, 2017 1 次提交
    • K
      delete_ref: accept a reflog message argument · 755b49ae
      Kyle Meyer 提交于
      When the current branch is renamed with 'git branch -m/-M' or deleted
      with 'git update-ref -m<msg> -d', the event is recorded in HEAD's log
      with an empty message.  In preparation for adding a more meaningful
      message to HEAD's log in these cases, update delete_ref() to take a
      message argument and pass it along to ref_transaction_delete().
      Modify all callers to pass NULL for the new message argument; no
      change in behavior is intended.
      
      Note that this is relevant for HEAD's log but not for the deleted
      ref's log, which is currently deleted along with the ref.  Even if it
      were not, an entry for the deletion wouldn't be present in the deleted
      ref's log.  files_transaction_commit() writes to the log if
      REF_NEEDS_COMMIT or REF_LOG_ONLY are set, but lock_ref_for_update()
      doesn't set REF_NEEDS_COMMIT for the deleted ref because REF_DELETING
      is set.  In contrast, the update for HEAD has REF_LOG_ONLY set by
      split_head_update(), resulting in the deletion being logged.
      Signed-off-by: NKyle Meyer <kyle@kyleam.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      755b49ae
  14. 14 2月, 2017 1 次提交
  15. 11 2月, 2017 5 次提交