1. 10 7月, 2012 7 次提交
  2. 04 7月, 2012 10 次提交
    • J
      sha1_name.c: teach get_short_sha1() a commit-only option · aa1dec9e
      Junio C Hamano 提交于
      When the caller knows that the parameter is meant to name a commit,
      e.g. "56789a" in describe name "v1.2.3-4-g56789a", pass that as a
      hint so that lower level can use it to disambiguate objects when
      there is only one commit whose name begins with 56789a even if there
      are objects of other types whose names share the same prefix.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      aa1dec9e
    • J
      sha1_name.c: allow get_short_sha1() to take other flags · 37c00e55
      Junio C Hamano 提交于
      Instead of a separate "int quietly" argument, make it take "unsigned
      flags" so that we can pass other options to it.
      
      The bit assignment of this flag word is exposed in cache.h because
      the mechanism will be exposed to callers of the higher layer in
      later commits in this series.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      37c00e55
    • J
      get_sha1(): fix error status regression · c005e986
      Junio C Hamano 提交于
      In finish_object_disambiguation(), if the candidate hasn't been
      checked, there are two cases:
      
       - It is the first and only object that match the prefix; or
       - It replaced another object that matched the prefix but that
         object did not satisfy ds->fn() callback.
      
      And the former case we set ds->candidate_ok to true without doing
      anything else, while for the latter we check the candidate, which
      may set ds->candidate_ok to false.
      
      At this point in the code, ds->candidate_ok can be false only if
      this last-round check found that the candidate does not pass the
      check, because the state after update_candidates() returns cannot
      satisfy
      
          !ds->ambiguous && ds->candidate_exists && ds->candidate_checked
      
      and !ds->canidate_ok at the same time.
      
      Hence, when we execute this "return", we know we have seen more than
      one object that match the prefix (and none of them satisfied ds->fn),
      meaning that we should say "the short name is ambiguous", not "there
      is no object that matches the prefix".
      
      Noticed by Jeff King.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c005e986
    • J
      sha1_name.c: restructure disambiguation of short names · a78fafe7
      Junio C Hamano 提交于
      We try to find zero, one or more matches from loose objects and
      packed objects independently and then decide if the given short
      object name is unique across them.
      
      Instead, introduce a "struct disambiguate_state" that keeps track of
      what we have found so far, that can be one of:
      
       - We have seen one object that _could_ be what we are looking for;
       - We have also checked that object for additional constraints (if any),
         and found that the object satisfies it;
       - We have also checked that object for additional constraints (if any),
         and found that the object does not satisfy it; or
       - We have seen more than one objects that satisfy the constraints.
      
      and pass it to the enumeration functions for loose and packed
      objects.  The disambiguation state can optionally take a callback
      function that takes a candidate object name and reports if the
      object satisifies additional criteria (e.g. when the caller knows
      that the short name must refer to a commit, this mechanism can be
      used to check the type of the given object).
      
      Compared to the earlier attempt, this round avoids the optional
      check if there is only one candidate that matches the short name in
      the first place.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a78fafe7
    • J
      sha1_name.c: correct misnamed "canonical" and "res" · 1703f9aa
      Junio C Hamano 提交于
      These are hexadecimal and binary representation of the short object
      name given to the callchain as its input.  Rename them with _pfx
      suffix to make it clear they are prefixes, and call them hex and bin
      respectively.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1703f9aa
    • J
      sha1_name.c: refactor find_short_packed_object() · f703e6ea
      Junio C Hamano 提交于
      Extract the logic to find object(s) that match a given prefix inside
      a single pack into a separate helper function, and give it a bit more
      comment.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f703e6ea
    • J
      sha1_name.c: rename "now" to "current" · 1b27c2f0
      Junio C Hamano 提交于
      This variable points at the element we are currently looking at, and
      does not have anything to do with the current time which the name
      "now" implies.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1b27c2f0
    • J
    • J
      sha1_name.c: get rid of get_sha1_with_mode() · 249c8f4a
      Junio C Hamano 提交于
      There are only two callers, and they will benefit from being able to
      pass disambiguation hints to underlying get_sha1_with_context() API
      once it happens.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      249c8f4a
    • J
      sha1_name.c: get rid of get_sha1_with_mode_1() · 8c135ea2
      Junio C Hamano 提交于
      The only external caller is setup.c that tries to give a nicer error
      message when an object name is misspelt (e.g. "HEAD:cashe.h").
      Retire it and give the caller a dedicated and more intuitive API
      function maybe_die_on_misspelt_object_name().
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8c135ea2
  3. 03 7月, 2012 1 次提交
  4. 19 6月, 2012 1 次提交
  5. 28 1月, 2012 1 次提交
  6. 27 1月, 2012 3 次提交
  7. 24 1月, 2012 1 次提交
  8. 19 1月, 2012 12 次提交
  9. 17 1月, 2012 3 次提交
    • J
      credential-cache: ignore "connection refused" errors · 35a71f14
      Jeff King 提交于
      The credential-cache helper will try to connect to its
      daemon over a unix socket. Originally, a failure to do so
      was silently ignored, and we would either give up (if
      performing a "get" or "erase" operation), or spawn a new
      daemon (for a "store" operation).
      
      But since 8ec6c8d7, we try to report more errors. We detect a
      missing daemon by checking for ENOENT on our connection
      attempt.  If the daemon is missing, we continue as before
      (giving up or spawning a new daemon). For any other error,
      we die and report the problem.
      
      However, checking for ENOENT is not sufficient for a missing
      daemon. We might also get ECONNREFUSED if a dead daemon
      process left a stale socket. This generally shouldn't
      happen, as the daemon cleans up after itself, but the daemon
      may not always be given a chance to do so (e.g., power loss,
      "kill -9").
      
      The resulting state is annoying not just because the helper
      outputs an extra useless message, but because it actually
      blocks the helper from spawning a new daemon to replace the
      stale socket.
      
      Fix it by checking for ECONNREFUSED.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      35a71f14
    • J
      Merge branch 'jn/maint-gitweb-grep-fix' · b63103e9
      Junio C Hamano 提交于
      * jn/maint-gitweb-grep-fix:
        gitweb: Harden "grep" search against filenames with ':'
        gitweb: Fix file links in "grep" search
      b63103e9
    • N
      diff-index: enable recursive pathspec matching in unpack_trees · 4838237c
      Nguyen Thai Ngoc Duy 提交于
      The pathspec structure has a few bits of data to drive various operation
      modes after we unified the pathspec matching logic in various codepaths.
      For example, max_depth field is there so that "git grep" can limit the
      output for files found in limited depth of tree traversal. Also in order
      to show just the surface level differences in "git diff-tree", recursive
      field stops us from descending into deeper level of the tree structure
      when it is set to false, and this also affects pathspec matching when
      we have wildcards in the pathspec.
      
      The diff-index has always wanted the recursive behaviour, and wanted to
      match pathspecs without any depth limit. But we forgot to do so when we
      updated tree_entry_interesting() logic to unify the pathspec matching
      logic.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      4838237c
  10. 15 1月, 2012 1 次提交