1. 03 2月, 2012 5 次提交
    • J
      grep: drop grep_buffer's "name" parameter · c876d6da
      Jeff King 提交于
      Before the grep_source interface existed, grep_buffer was
      used by two types of callers:
      
        1. Ones which pulled a file into a buffer, and then wanted
           to supply the file's name for the output (i.e.,
           git grep).
      
        2. Ones which really just wanted to grep a buffer (i.e.,
           git log --grep).
      
      Callers in set (1) should now be using grep_source. Callers
      in set (2) always pass NULL for the "name" parameter of
      grep_buffer. We can therefore get rid of this now-useless
      parameter.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c876d6da
    • J
      convert git-grep to use grep_source interface · 8f24a632
      Jeff King 提交于
      The grep_source interface (as opposed to grep_buffer) will
      eventually gives us a richer interface for telling the
      low-level grep code about our buffers. Eventually this will
      lead to things like better binary-file handling. For now, it
      lets us drop a lot of now-redundant code.
      
      The conversion is mostly straight-forward. One thing to note
      is that the memory ownership rules for "struct grep_source"
      are different than the "struct work_item" found here (the
      former will copy things like the filename, rather than
      taking ownership). Therefore you will also see some slight
      tweaking of when filename buffers are released.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8f24a632
    • J
      grep: refactor the concept of "grep source" into an object · e1327023
      Jeff King 提交于
      The main interface to the low-level grep code is
      grep_buffer, which takes a pointer to a buffer and a size.
      This is convenient and flexible (we use it to grep commit
      bodies, files on disk, and blobs by sha1), but it makes it
      hard to pass extra information about what we are grepping
      (either for correctness, like overriding binary
      auto-detection, or for optimizations, like lazily loading
      blob contents).
      
      Instead, let's encapsulate the idea of a "grep source",
      including the buffer, its size, and where the data is coming
      from. This is similar to the diff_filespec structure used by
      the diff code (unsurprising, since future patches will
      implement some of the same optimizations found there).
      
      The diffstat is slightly scarier than the actual patch
      content. Most of the modified lines are simply replacing
      access to raw variables with their counterparts that are now
      in a "struct grep_source". Most of the added lines were
      taken from builtin/grep.c, which partially abstracted the
      idea of grep sources (for file vs sha1 sources).
      
      Instead of dropping the now-redundant code, this patch
      leaves builtin/grep.c using the traditional grep_buffer
      interface (which now wraps the grep_source interface). That
      makes it easy to test that there is no change of behavior
      (yet).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e1327023
    • J
      grep: move sha1-reading mutex into low-level code · b3aeb285
      Jeff King 提交于
      The multi-threaded git-grep code needs to serialize access
      to the thread-unsafe read_sha1_file call. It does this with
      a mutex that is local to builtin/grep.c.
      
      Let's instead push this down into grep.c, where it can be
      used by both builtin/grep.c and grep.c. This will let us
      safely teach the low-level grep.c code tricks that involve
      reading from the object db.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b3aeb285
    • J
      grep: make locking flag global · 78db6ea9
      Jeff King 提交于
      The low-level grep code traditionally didn't care about
      threading, as it doesn't do any threading itself and didn't
      call out to other non-thread-safe code.  That changed with
      0579f91d (grep: enable threading with -p and -W using lazy
      attribute lookup, 2011-12-12), which pushed the lookup of
      funcname attributes (which is not thread-safe) into the
      low-level grep code.
      
      As a result, the low-level code learned about a new global
      "grep_attr_mutex" to serialize access to the attribute code.
      A multi-threaded caller (e.g., builtin/grep.c) is expected
      to initialize the mutex and set "use_threads" in the
      grep_opt structure. The low-level code only uses the lock if
      use_threads is set.
      
      However, putting the use_threads flag into the grep_opt
      struct is not the most logical place. Whether threading is
      in use is not something that matters for each call to
      grep_buffer, but is instead global to the whole program
      (i.e., if any thread is doing multi-threaded grep, every
      other thread, even if it thinks it is doing its own
      single-threaded grep, would need to use the locking).  In
      practice, this distinction isn't a problem for us, because
      the only user of multi-threaded grep is "git-grep", which
      does nothing except call grep.
      
      This patch turns the opt->use_threads flag into a global
      flag. More important than the nit-picking semantic argument
      above is that this means that the locking functions don't
      need to actually have access to a grep_opt to know whether
      to lock. Which in turn can make adding new locks simpler, as
      we don't need to pass around a grep_opt.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      78db6ea9
  2. 28 1月, 2012 1 次提交
  3. 27 1月, 2012 3 次提交
  4. 24 1月, 2012 1 次提交
  5. 19 1月, 2012 12 次提交
  6. 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
  7. 15 1月, 2012 1 次提交
  8. 14 1月, 2012 2 次提交
  9. 13 1月, 2012 12 次提交
    • J
      Git 1.7.9-rc1 · 6db5c6e4
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6db5c6e4
    • J
      Merge branch 'jc/request-pull-show-head-4' · 478c4465
      Junio C Hamano 提交于
      * jc/request-pull-show-head-4:
        request-pull: use the real fork point when preparing the message
      478c4465
    • J
      Merge branch 'tr/maint-mailinfo' · b51ffa80
      Junio C Hamano 提交于
      * tr/maint-mailinfo:
        mailinfo documentation: accurately describe non -k case
      b51ffa80
    • J
      Merge branch 'ss/maint-msys-cvsexportcommit' · 96e33609
      Junio C Hamano 提交于
      * ss/maint-msys-cvsexportcommit:
        git-cvsexportcommit: Fix calling Perl's rel2abs() on MSYS
        t9200: On MSYS, do not pass Windows-style paths to CVS
      96e33609
    • J
      Merge branch 'jk/maint-upload-archive' · bdb8cb52
      Junio C Hamano 提交于
      * jk/maint-upload-archive:
        archive: re-allow HEAD:Documentation on a remote invocation
      bdb8cb52
    • J
      Merge branch 'maint' · c4a01a3c
      Junio C Hamano 提交于
      * maint:
        Update draft release notes to 1.7.8.4
        Update draft release notes to 1.7.7.6
        Update draft release notes to 1.7.6.6
        thin-pack: try harder to use preferred base objects as base
      c4a01a3c
    • J
      Update draft release notes to 1.7.8.4 · ab8a7808
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ab8a7808
    • J
      Merge branch 'maint-1.7.7' into maint · 5a6a9394
      Junio C Hamano 提交于
      * maint-1.7.7:
        Update draft release notes to 1.7.7.6
        Update draft release notes to 1.7.6.6
        thin-pack: try harder to use preferred base objects as base
      5a6a9394
    • J
      Update draft release notes to 1.7.7.6 · 8f83acf7
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8f83acf7
    • J
      Merge branch 'maint-1.7.6' into maint-1.7.7 · 901c907d
      Junio C Hamano 提交于
      * maint-1.7.6:
        Update draft release notes to 1.7.6.6
        thin-pack: try harder to use preferred base objects as base
      901c907d
    • J
      Update draft release notes to 1.7.6.6 · 04f6785a
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      04f6785a
    • J
      thin-pack: try harder to use preferred base objects as base · 15f07e06
      Jeff King 提交于
      When creating a pack using objects that reside in existing packs, we try
      to avoid recomputing futile delta between an object (trg) and a candidate
      for its base object (src) if they are stored in the same packfile, and trg
      is not recorded as a delta already. This heuristics makes sense because it
      is likely that we tried to express trg as a delta based on src but it did
      not produce a good delta when we created the existing pack.
      
      As the pack heuristics prefer producing delta to remove data, and Linus's
      law dictates that the size of a file grows over time, we tend to record
      the newest version of the file as inflated, and older ones as delta
      against it.
      
      When creating a thin-pack to transfer recent history, it is likely that we
      will try to send an object that is recorded in full, as it is newer.  But
      the heuristics to avoid recomputing futile delta effectively forbids us
      from attempting to express such an object as a delta based on another
      object. Sending an object in full is often more expensive than sending a
      suboptimal delta based on other objects, and it is even more so if we
      could use an object we know the receiving end already has (i.e. preferred
      base object) as the delta base.
      
      Tweak the recomputation avoidance logic, so that we do not punt on
      computing delta against a preferred base object.
      
      The effect of this change can be seen on two simulated upload-pack
      workloads. The first is based on 44 reflog entries from my git.git
      origin/master reflog, and represents the packs that kernel.org sent me git
      updates for the past month or two. The second workload represents much
      larger fetches, going from git's v1.0.0 tag to v1.1.0, then v1.1.0 to
      v1.2.0, and so on.
      
      The table below shows the average generated pack size and the average CPU
      time consumed for each dataset, both before and after the patch:
      
                        dataset
                  | reflog | tags
      ---------------------------------
           before | 53358  | 2750977
      size  after | 32398  | 2668479
           change |   -39% |      -3%
      ---------------------------------
           before |  0.18  | 1.12
      CPU   after |  0.18  | 1.15
           change |    +0% |      +3%
      
      This patch makes a much bigger difference for packs with a shorter slice
      of history (since its effect is seen at the boundaries of the pack) though
      it has some benefit even for larger packs.
      Signed-off-by: NJeff King <peff@peff.net>
      Acked-by: NNicolas Pitre <nico@fluxnic.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      15f07e06