1. 17 11月, 2011 1 次提交
    • J
      refs: loosen over-strict "format" check · 09116a1c
      Junio C Hamano 提交于
      The add_extra_ref() interface is used to add an extra-ref that is _not_
      our ref for the purpose of helping auto-following of tags and reducing
      object transfer from remote repository, and they are typically formatted
      as a tagname followed by ^{} to make sure no valid refs match that
      pattern. In other words, these entries are deliberately formatted not to
      pass check-refname-format test.
      
      A recent series however added a test unconditionally to the add_ref()
      function that is called from add_extra_ref(). The check may be sensible
      for other two callsites of the add_ref() interface, but definitely is
      a wrong thing to do in add_extra_ref(). Disable it.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      Acked-by: NMichael Haggerty <mhagger@alum.mit.edu>
      09116a1c
  2. 08 11月, 2011 2 次提交
    • J
      refs DWIMmery: use the same rule for both "git fetch" and others · dd621df9
      Junio C Hamano 提交于
      "git log frotz" can DWIM to "refs/remotes/frotz/HEAD", but in the remote
      access context, "git fetch frotz" to fetch what the other side happened to
      have fetched from what it calls 'frotz' (which may not have any relation
      to what we consider is 'frotz') the last time would not make much sense,
      so the fetch rules table did not include "refs/remotes/%.*s/HEAD".
      
      When the user really wants to, "git fetch $there remotes/frotz/HEAD" would
      let her do so anyway, so this is not about safety or security; it merely
      is about confusion avoidance and discouraging meaningless usage.
      
      Specifically, it is _not_ about ambiguity avoidance. A name that would
      become ambiguous if we use the same rules table for both fetch and local
      rev-parse would be ambiguous locally at the remote side.
      
      So for the same reason as we added rule to allow "git fetch $there v1.0"
      instead of "git fetch $there tags/v1.0" in the previous commit, here is a
      bit longer rope for the users, which incidentally simplifies our code.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dd621df9
    • J
      fetch: allow "git fetch $there v1.0" to fetch a tag · 47d84b6a
      Junio C Hamano 提交于
      You can already do so with "git fetch $there tags/v1.0" but if it is not
      ambiguous there is no reason to force users to type more.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      47d84b6a
  3. 20 10月, 2011 2 次提交
    • J
      resolve_ref(): report breakage to the caller without warning · 55956350
      Junio C Hamano 提交于
      629cd3ac (resolve_ref(): emit warnings for improperly-formatted references,
      2011-09-15) made resolve_ref() warn against files that are found in the
      directories the ref dwimmery looks at. The intent may be good, but these
      messages come from a wrong level of the API hierarchy.
      
      Instead record the breakage in "flags" whose purpose is to explain the
      result of the function to the caller, who is in a much better position to
      make intelligent decision based on the information.
      
      This updates sha1_name.c::dwim_ref() to warn against such a broken
      candidate only when it does not appear directly below $GIT_DIR to restore
      the traditional behaviour, as we know many files directly underneath
      $GIT_DIR/ are not refs.
      
      Warning against "git show config --" with "$GIT_DIR/config does not look
      like a well-formed ref" does not make sense, and we may later tweak the
      dwimmery not to even consider them as candidates, but that is a longer
      term topic.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      55956350
    • J
      resolve_ref(): expose REF_ISBROKEN flag · 98ac34b2
      Junio C Hamano 提交于
      Instead of keeping this as an internal API, let the callers find
      out the reason why resolve_ref() returned NULL is not because there
      was no such file in $GIT_DIR but because a file was corrupt.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      98ac34b2
  4. 18 10月, 2011 1 次提交
  5. 17 10月, 2011 7 次提交
  6. 13 10月, 2011 2 次提交
    • J
      refs.c: move dwim_ref()/dwim_log() from sha1_name.c · ff74f7f1
      Junio C Hamano 提交于
      Both dwim_ref()/dwim_log() functions are intimately related to the ref
      parsing rules defined in refs.c and better fits there. Move them together
      with substitute_branch_name(), a file scope static helper function.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ff74f7f1
    • J
      branch -m/-M: remove undocumented RENAMED-REF · b0eab01a
      Junio C Hamano 提交于
      The commit message for c976d415 (git-branch: add options and tests for
      branch renaming, 2006-11-28) mentions RENAME_REF but otherwise this is not
      documented anywhere, and it does not appear in any of the tests.
      
      Worse yet, the name of the actual file is "RENAMED-REF".
      
      This was supposed to hold the commit object name at the tip of the branch
      the most recent "branch -m/-M" renamed, but that is not necessary in order
      to be able to recover from a mistake. Even when "branch -M A B" overwrites
      an existing branch B, what is kept in RENAMED-REF is the commit at the tip
      of the original branch A, not the commit B from the now-lost branch.
      
      Just remove this unused "feature".
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b0eab01a
  7. 11 10月, 2011 3 次提交
  8. 06 10月, 2011 16 次提交
  9. 01 10月, 2011 2 次提交
    • J
      refs: Use binary search to lookup refs faster · e9c4c111
      Julian Phillips 提交于
      Currently we linearly search through lists of refs when we need to
      find a specific ref.  This can be very slow if we need to lookup a
      large number of refs.  By changing to a binary search we can make this
      faster.
      
      In order to be able to use a binary search we need to change from
      using linked lists to arrays, which we can manage using ALLOC_GROW.
      
      We can now also use the standard library qsort function to sort the
      refs arrays.
      Signed-off-by: NJulian Phillips <julian@quantumfyre.co.uk>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e9c4c111
    • P
      receive-pack: don't pass non-existent refs to post-{receive,update} hooks · 160b81ed
      Pang Yan Han 提交于
      When a push specifies deletion of non-existent refs, the post post-receive and
      post-update hooks receive them as input/arguments.
      
      For instance, for the following push, where refs/heads/nonexistent is a ref
      which does not exist on the remote side:
      
      	git push origin :refs/heads/nonexistent
      
      the post-receive hook receives from standard input:
      
      	<null-sha1> SP <null-sha1> SP refs/heads/nonexistent
      
      and the post-update hook receives as arguments:
      
      	refs/heads/nonexistent
      
      which does not make sense since it is a no-op.
      
      Teach receive-pack not to pass non-existent refs to the post-receive and
      post-update hooks. If the push only attempts to delete non-existent refs,
      these hooks are not even called.
      
      The update and pre-receive hooks are still notified about attempted
      deletion of non-existent refs to give them a chance to inspect the
      situation and act on it.
      
      [jc: mild fix-ups to avoid introducing an extra list; also added fixes to
      some tests]
      Signed-off-by: NPang Yan Han <pangyanhan@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      160b81ed
  10. 27 9月, 2011 1 次提交
    • J
      Don't sort ref_list too early · b4f223c6
      Julian Phillips 提交于
      get_ref_dir is called recursively for subdirectories, which means that
      we were calling sort_ref_list for each directory of refs instead of
      once for all the refs.  This is a massive wast of processing, so now
      just call sort_ref_list on the result of the top-level get_ref_dir, so
      that the sort is only done once.
      
      In the common case of only a few different directories of refs the
      difference isn't very noticable, but it becomes very noticeable when
      you have a large number of direcotries containing refs (e.g. as
      created by Gerrit).
      
      Reported by Martin Fick.
      Signed-off-by: NJulian Phillips <julian@quantumfyre.co.uk>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b4f223c6
  11. 12 9月, 2011 1 次提交
  12. 28 8月, 2011 1 次提交
  13. 23 8月, 2011 1 次提交