1. 14 6月, 2014 1 次提交
    • N
      read-cache: split-index mode · 5fc2fc8f
      Nguyễn Thái Ngọc Duy 提交于
      This split-index mode is designed to keep write cost proportional to
      the number of changes the user has made, not the size of the work
      tree. (Read cost is another matter, to be dealt separately.)
      
      This mode stores index info in a pair of $GIT_DIR/index and
      $GIT_DIR/sharedindex.<SHA-1>. sharedindex is large and unchanged over
      time while "index" is smaller and updated often. Format details are in
      index-format.txt, although not everything is implemented in this
      patch.
      
      Shared indexes are not automatically removed, because it's unclear if
      the shared index is needed by any (even temporary) indexes by just
      looking at it. After a while you'll collect stale shared indexes. The
      good news is one shared index is useable for long, until
      $GIT_DIR/index becomes too big and sluggish that the new shared index
      must be created.
      
      The safest way to clean shared indexes is to turn off split index
      mode, so shared files are all garbage, delete them all, then turn on
      split index mode again.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5fc2fc8f
  2. 29 4月, 2014 1 次提交
    • D
      Makefile: default to -lcurl when no CURL_CONFIG or CURLDIR · f3f11fa6
      Dave Borowitz 提交于
      The original implementation of CURL_CONFIG support did not match the
      original behavior of using -lcurl when CURLDIR was not set. This broke
      implementations that were lacking curl-config but did have libcurl
      installed along system libraries, such as MSysGit. In other words, the
      assumption that curl-config is always installed was incorrect.
      
      Instead, if CURL_CONFIG is empty or returns an empty result (e.g. due
      to curl-config being missing), use the old behavior of falling back to
      -lcurl.
      Signed-off-by: NDave Borowitz <dborowitz@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f3f11fa6
  3. 18 4月, 2014 1 次提交
    • J
      i18n: only extract comments marked with "TRANSLATORS:" · 47fbfded
      Jiang Xin 提交于
      When extract l10n messages, we use "--add-comments" option to keep
      comments right above the l10n messages for references.  But sometimes
      irrelevant comments are also extracted.  For example in the following
      code block, the comment in line 2 will be extracted as comment for the
      l10n message in line 3, but obviously it's wrong.
      
              { OPTION_CALLBACK, 0, "ignore-removal", &addremove_explicit,
                NULL /* takes no arguments */,
                N_("ignore paths removed in the working tree (same as
                --no-all)"),
                PARSE_OPT_NOARG, ignore_removal_cb },
      
      Since almost all comments for l10n translators are marked with the same
      prefix (tag): "TRANSLATORS:", it's safe to only extract comments with
      this special tag.  I.E. it's better to call xgettext as:
      
              xgettext --add-comments=TRANSLATORS: ...
      
      Also tweaks the multi-line comment in "init-db.c", to make it start with
      the proper tag, not "* TRANSLATORS:" (which has a star before the tag).
      Signed-off-by: NJiang Xin <worldhello.net@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      47fbfded
  4. 16 4月, 2014 2 次提交
    • D
      Makefile: allow static linking against libcurl · d5067112
      Dave Borowitz 提交于
      This requires more flags than can be guessed with the old-style
      CURLDIR and related options, so is only supported when curl-config is
      present.
      Signed-off-by: NDave Borowitz <dborowitz@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d5067112
    • D
      Makefile: use curl-config to determine curl flags · 61a64fff
      Dave Borowitz 提交于
      curl-config should always be installed alongside a curl distribution,
      and its purpose is to provide flags for building against libcurl, so
      use it instead of guessing flags and dependent libraries.
      
      Allow overriding CURL_CONFIG to a custom path to curl-config, to
      compile against a curl installation other than the first in PATH.
      
      Depending on the set of features curl is compiled with, there may be
      more libraries required than the previous two options of -lssl and
      -lidn. For example, with a vanilla build of libcurl-7.36.0 on Mac OS X
      10.9:
      
      $ ~/d/curl-out-7.36.0/lib/curl-config --libs
      -L/Users/dborowitz/d/curl-out-7.36.0/lib -lcurl -lgssapi_krb5 -lresolv -lldap -lz
      
      Use this only when CURLDIR is not explicitly specified, to continue
      supporting older builds.
      Signed-off-by: NDave Borowitz <dborowitz@google.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      61a64fff
  5. 02 4月, 2014 1 次提交
  6. 01 4月, 2014 1 次提交
  7. 24 3月, 2014 1 次提交
  8. 28 2月, 2014 1 次提交
  9. 25 2月, 2014 1 次提交
  10. 21 2月, 2014 1 次提交
  11. 28 1月, 2014 1 次提交
  12. 24 1月, 2014 1 次提交
    • J
      Makefile: Fix compilation of Windows resource file · b594c975
      Johannes Sixt 提交于
      If the git version number consists of less than three period
      separated numbers, then the Windows resource file compilation
      issues a syntax error:
      
        $ touch git.rc
        $ make V=1 git.res
        GIT_VERSION = 1.9.rc0
        windres -O coff \
                  -DMAJOR=1 -DMINOR=9 -DPATCH=rc0 \
                  -DGIT_VERSION="\\\"1.9.rc0\\\"" git.rc -o git.res
        C:\msysgit\msysgit\mingw\bin\windres.exe: git.rc:2: syntax error
        make: *** [git.res] Error 1
        $
      
      Note that -DPATCH=rc0.
      
      The values passed via -DMAJOR=, -DMINOR=, and -DPATCH= are used in
      FILEVERSION and PRODUCTVERSION statements, which expect up to four numeric
      values. These version numbers are intended for machine consumption. They
      are typically inspected by installers to decide whether a file to be
      installed is newer than one that exists on the system, but are not used
      for much else.
      
      We can be pretty certain that there are no tools that look at these
      version numbers, not even the installer of Git for Windows does.
      Therefore, to fix the syntax error, fill in only the first two numbers,
      which we are guaranteed to find in Git version numbers.
      Signed-off-by: NJohannes Sixt <j6t@kdbg.org>
      Acked-by: NPat Thoyts <patthoyts@users.sourceforge.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b594c975
  13. 31 12月, 2013 3 次提交
    • V
      pack-objects: implement bitmap writing · 7cc8f971
      Vicent Marti 提交于
      This commit extends more the functionality of `pack-objects` by allowing
      it to write out a `.bitmap` index next to any written packs, together
      with the `.idx` index that currently gets written.
      
      If bitmap writing is enabled for a given repository (either by calling
      `pack-objects` with the `--write-bitmap-index` flag or by having
      `pack.writebitmaps` set to `true` in the config) and pack-objects is
      writing a packfile that would normally be indexed (i.e. not piping to
      stdout), we will attempt to write the corresponding bitmap index for the
      packfile.
      
      Bitmap index writing happens after the packfile and its index has been
      successfully written to disk (`finish_tmp_packfile`). The process is
      performed in several steps:
      
          1. `bitmap_writer_set_checksum`: this call stores the partial
             checksum for the packfile being written; the checksum will be
             written in the resulting bitmap index to verify its integrity
      
          2. `bitmap_writer_build_type_index`: this call uses the array of
             `struct object_entry` that has just been sorted when writing out
             the actual packfile index to disk to generate 4 type-index bitmaps
             (one for each object type).
      
             These bitmaps have their nth bit set if the given object is of
             the bitmap's type. E.g. the nth bit of the Commits bitmap will be
             1 if the nth object in the packfile index is a commit.
      
             This is a very cheap operation because the bitmap writing code has
             access to the metadata stored in the `struct object_entry` array,
             and hence the real type for each object in the packfile.
      
          3. `bitmap_writer_reuse_bitmaps`: if there exists an existing bitmap
             index for one of the packfiles we're trying to repack, this call
             will efficiently rebuild the existing bitmaps so they can be
             reused on the new index. All the existing bitmaps will be stored
             in a `reuse` hash table, and the commit selection phase will
             prioritize these when selecting, as they can be written directly
             to the new index without having to perform a revision walk to
             fill the bitmap. This can greatly speed up the repack of a
             repository that already has bitmaps.
      
          4. `bitmap_writer_select_commits`: if bitmap writing is enabled for
             a given `pack-objects` run, the sequence of commits generated
             during the Counting Objects phase will be stored in an array.
      
             We then use that array to build up the list of selected commits.
             Writing a bitmap in the index for each object in the repository
             would be cost-prohibitive, so we use a simple heuristic to pick
             the commits that will be indexed with bitmaps.
      
             The current heuristics are a simplified version of JGit's
             original implementation. We select a higher density of commits
             depending on their age: the 100 most recent commits are always
             selected, after that we pick 1 commit of each 100, and the gap
             increases as the commits grow older. On top of that, we make sure
             that every single branch that has not been merged (all the tips
             that would be required from a clone) gets their own bitmap, and
             when selecting commits between a gap, we tend to prioritize the
             commit with the most parents.
      
             Do note that there is no right/wrong way to perform commit
             selection; different selection algorithms will result in
             different commits being selected, but there's no such thing as
             "missing a commit". The bitmap walker algorithm implemented in
             `prepare_bitmap_walk` is able to adapt to missing bitmaps by
             performing manual walks that complete the bitmap: the ideal
             selection algorithm, however, would select the commits that are
             more likely to be used as roots for a walk in the future (e.g.
             the tips of each branch, and so on) to ensure a bitmap for them
             is always available.
      
          5. `bitmap_writer_build`: this is the computationally expensive part
             of bitmap generation. Based on the list of commits that were
             selected in the previous step, we perform several incremental
             walks to generate the bitmap for each commit.
      
             The walks begin from the oldest commit, and are built up
             incrementally for each branch. E.g. consider this dag where A, B,
             C, D, E, F are the selected commits, and a, b, c, e are a chunk
             of simplified history that will not receive bitmaps.
      
                  A---a---B--b--C--c--D
                           \
                            E--e--F
      
             We start by building the bitmap for A, using A as the root for a
             revision walk and marking all the objects that are reachable
             until the walk is over. Once this bitmap is stored, we reuse the
             bitmap walker to perform the walk for B, assuming that once we
             reach A again, the walk will be terminated because A has already
             been SEEN on the previous walk.
      
             This process is repeated for C, and D, but when we try to
             generate the bitmaps for E, we can reuse neither the current walk
             nor the bitmap we have generated so far.
      
             What we do now is resetting both the walk and clearing the
             bitmap, and performing the walk from scratch using E as the
             origin. This new walk, however, does not need to be completed.
             Once we hit B, we can lookup the bitmap we have already stored
             for that commit and OR it with the existing bitmap we've composed
             so far, allowing us to limit the walk early.
      
             After all the bitmaps have been generated, another iteration
             through the list of commits is performed to find the best XOR
             offsets for compression before writing them to disk. Because of
             the incremental nature of these bitmaps, XORing one of them with
             its predecesor results in a minimal "bitmap delta" most of the
             time. We can write this delta to the on-disk bitmap index, and
             then re-compose the original bitmaps by XORing them again when
             loaded.
      
             This is a phase very similar to pack-object's `find_delta` (using
             bitmaps instead of objects, of course), except the heuristics
             have been greatly simplified: we only check the 10 bitmaps before
             any given one to find best compressing one. This gives good
             results in practice, because there is locality in the ordering of
             the objects (and therefore bitmaps) in the packfile.
      
           6. `bitmap_writer_finish`: the last step in the process is
      	serializing to disk all the bitmap data that has been generated
      	in the two previous steps.
      
      	The bitmap is written to a tmp file and then moved atomically to
      	its final destination, using the same process as
      	`pack-write.c:write_idx_file`.
      Signed-off-by: NVicent Marti <tanoku@gmail.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      7cc8f971
    • V
      pack-bitmap: add support for bitmap indexes · fff42755
      Vicent Marti 提交于
      A bitmap index is a `.bitmap` file that can be found inside
      `$GIT_DIR/objects/pack/`, next to its corresponding packfile, and
      contains precalculated reachability information for selected commits.
      The full specification of the format for these bitmap indexes can be found
      in `Documentation/technical/bitmap-format.txt`.
      
      For a given commit SHA1, if it happens to be available in the bitmap
      index, its bitmap will represent every single object that is reachable
      from the commit itself. The nth bit in the bitmap is the nth object in
      the packfile; if it's set to 1, the object is reachable.
      
      By using the bitmaps available in the index, this commit implements
      several new functions:
      
      	- `prepare_bitmap_git`
      	- `prepare_bitmap_walk`
      	- `traverse_bitmap_commit_list`
      	- `reuse_partial_packfile_from_bitmap`
      
      The `prepare_bitmap_walk` function tries to build a bitmap of all the
      objects that can be reached from the commit roots of a given `rev_info`
      struct by using the following algorithm:
      
      - If all the interesting commits for a revision walk are available in
      the index, the resulting reachability bitmap is the bitwise OR of all
      the individual bitmaps.
      
      - When the full set of WANTs is not available in the index, we perform a
      partial revision walk using the commits that don't have bitmaps as
      roots, and limiting the revision walk as soon as we reach a commit that
      has a corresponding bitmap. The earlier OR'ed bitmap with all the
      indexed commits can now be completed as this walk progresses, so the end
      result is the full reachability list.
      
      - For revision walks with a HAVEs set (a set of commits that are deemed
      uninteresting), first we perform the same method as for the WANTs, but
      using our HAVEs as roots, in order to obtain a full reachability bitmap
      of all the uninteresting commits. This bitmap then can be used to:
      
      	a) limit the subsequent walk when building the WANTs bitmap
      	b) finding the final set of interesting commits by performing an
      	   AND-NOT of the WANTs and the HAVEs.
      
      If `prepare_bitmap_walk` runs successfully, the resulting bitmap is
      stored and the equivalent of a `traverse_commit_list` call can be
      performed by using `traverse_bitmap_commit_list`; the bitmap version
      of this call yields the objects straight from the packfile index
      (without having to look them up or parse them) and hence is several
      orders of magnitude faster.
      
      As an extra optimization, when `prepare_bitmap_walk` succeeds, the
      `reuse_partial_packfile_from_bitmap` call can be attempted: it will find
      the amount of objects at the beginning of the on-disk packfile that can
      be reused as-is, and return an offset into the packfile. The source
      packfile can then be loaded and the bytes up to `offset` can be written
      directly to the result without having to consider the entires inside the
      packfile individually.
      
      If the `prepare_bitmap_walk` call fails (e.g. because no bitmap files
      are available), the `rev_info` struct is left untouched, and can be used
      to perform a manual rev-walk using `traverse_commit_list`.
      
      Hence, this new set of functions are a generic API that allows to
      perform the equivalent of
      
      	git rev-list --objects [roots...] [^uninteresting...]
      
      for any set of commits, even if they don't have specific bitmaps
      generated for them.
      
      In further patches, we'll use this bitmap traversal optimization to
      speed up the `pack-objects` and `rev-list` commands.
      Signed-off-by: NVicent Marti <tanoku@gmail.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      fff42755
    • V
      ewah: compressed bitmap implementation · e1273106
      Vicent Marti 提交于
      EWAH is a word-aligned compressed variant of a bitset (i.e. a data
      structure that acts as a 0-indexed boolean array for many entries).
      
      It uses a 64-bit run-length encoding (RLE) compression scheme,
      trading some compression for better processing speed.
      
      The goal of this word-aligned implementation is not to achieve
      the best compression, but rather to improve query processing time.
      As it stands right now, this EWAH implementation will always be more
      efficient storage-wise than its uncompressed alternative.
      
      EWAH arrays will be used as the on-disk format to store reachability
      bitmaps for all objects in a repository while keeping reasonable sizes,
      in the same way that JGit does.
      
      This EWAH implementation is a mostly straightforward port of the
      original `javaewah` library that JGit currently uses. The library is
      self-contained and has been embedded whole (4 files) inside the `ewah`
      folder to ease redistribution.
      
      The library is re-licensed under the GPLv2 with the permission of Daniel
      Lemire, the original author. The source code for the C version can
      be found on GitHub:
      
      	https://github.com/vmg/libewok
      
      The original Java implementation can also be found on GitHub:
      
      	https://github.com/lemire/javaewah
      
      [jc: stripped debug-only code per Peff's $gmane/239768]
      Signed-off-by: NVicent Marti <tanoku@gmail.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Helped-by: NRamsay Jones <ramsay@ramsay1.demon.co.uk>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e1273106
  14. 04 12月, 2013 1 次提交
    • J
      stop installing git-tar-tree link · bb5d531e
      Jonathan Nieder 提交于
      When the built-in "git tar-tree" command (a thin wrapper around "git
      archive") was removed in 925ceccf (tar-tree: remove deprecated
      command, 2013-11-10), the build continued to install a non-functioning
      git-tar-tree command in gitexecdir by mistake:
      
      	$ PATH=$(git --exec-path):$PATH
      	$ git-tar-tree -h
      	fatal: cannot handle tar-tree internally
      
      The list of links in gitexecdir is populated from BUILTIN_OBJS, which
      includes builtin/tar-tree.o to implement "git get-tar-commit-id".
      Rename the get-tar-commit-id source file to builtin/get-tar-commit-id.c
      to reflect its purpose and fix 'make install'.
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      bb5d531e
  15. 19 11月, 2013 4 次提交
  16. 16 11月, 2013 1 次提交
  17. 13 11月, 2013 3 次提交
  18. 25 10月, 2013 1 次提交
    • V
      pack-objects: refactor the packing list · 2834bc27
      Vicent Marti 提交于
      The hash table that stores the packing list for a given `pack-objects`
      run was tightly coupled to the pack-objects code.
      
      In this commit, we refactor the hash table and the underlying storage
      array into a `packing_data` struct. The functionality for accessing and
      adding entries to the packing list is hence accessible from other parts
      of Git besides the `pack-objects` builtin.
      
      This refactoring is a requirement for further patches in this series
      that will require accessing the commit packing list from outside of
      `pack-objects`.
      
      The hash table implementation has been minimally altered: we now
      use table sizes which are always a power of two, to ensure a uniform
      index distribution in the array.
      Signed-off-by: NVicent Marti <tanoku@gmail.com>
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2834bc27
  19. 15 10月, 2013 1 次提交
    • R
      sparse: suppress some "using sizeof on a function" warnings · 9371322a
      Ramsay Jones 提交于
      Sparse issues an "using sizeof on a function" warning for each
      call to curl_easy_setopt() which sets an option that takes a
      function pointer parameter. (currently 12 such warnings over 4
      files.)
      
      The warnings relate to the use of the "typecheck-gcc.h" header
      file which adds a layer of type-checking macros to the curl
      function invocations (for gcc >= 4.3 and !__cplusplus). As part
      of the type-checking layer, 'sizeof' is applied to the function
      parameter of curl_easy_setopt(). Note that, in the context of
      sizeof, the function to function pointer conversion is not
      performed and that sizeof(f) != sizeof(&f).
      
      A simple solution, therefore, would be to replace the function
      name in each such call to curl_easy_setopt() with an explicit
      function pointer expression (i.e. replace f with &f).
      
      However, the "typecheck-gcc.h" header file is only conditionally
      included, in addition to the gcc and C++ checks mentioned above,
      depending on the CURL_DISABLE_TYPECHECK preprocessor variable.
      
      In order to suppress the warnings, we use target-specific variable
      assignments to add -DCURL_DISABLE_TYPECHECK to SPARSE_FLAGS for
      each file affected (http-push.c, http.c, http-walker.c and
      remote-curl.c).
      Signed-off-by: NRamsay Jones <ramsay@ramsay1.demon.co.uk>
      Signed-off-by: NJonathan Nieder <jrnieder@gmail.com>
      9371322a
  20. 18 9月, 2013 1 次提交
    • S
      repack: rewrite the shell script in C · a1bbc6c0
      Stefan Beller 提交于
      The motivation of this patch is to get closer to a goal of being
      able to have a core subset of git functionality built in to git.
      That would mean
      
       * people on Windows could get a copy of at least the core parts
         of Git without having to install a Unix-style shell
      
       * people using git in on servers with chrooted environments
         do not need to worry about standard tools lacking for shell
         scripts.
      
      This patch is meant to be mostly a literal translation of the
      git-repack script; the intent is that later patches would start using
      more library facilities, but this patch is meant to be as close to a
      no-op as possible so it doesn't do that kind of thing.
      Signed-off-by: NStefan Beller <stefanbeller@googlemail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a1bbc6c0
  21. 09 9月, 2013 1 次提交
  22. 21 8月, 2013 1 次提交
  23. 06 8月, 2013 2 次提交
  24. 30 7月, 2013 1 次提交
  25. 19 7月, 2013 1 次提交
  26. 14 7月, 2013 1 次提交
    • E
      builtin: add git-check-mailmap command · 226ad348
      Eric Sunshine 提交于
      Introduce command check-mailmap, similar to check-attr and check-ignore,
      which allows direct testing of .mailmap configuration.
      
      As plumbing accessible to scripts and other porcelain, check-mailmap
      publishes the stable, well-tested .mailmap functionality employed by
      built-in Git commands.  Consequently, script authors need not
      re-implement .mailmap functionality manually, thus avoiding potential
      quirks and behavioral differences.
      Signed-off-by: NEric Sunshine <sunshine@sunshineco.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      226ad348
  27. 04 7月, 2013 1 次提交
  28. 13 6月, 2013 1 次提交
    • J
      Move copy_note_for_rewrite + friends from builtin/notes.c to notes-utils.c · 49c24704
      Johan Herland 提交于
      This is a pure code movement of the machinery for copying notes to
      rewritten objects. This code was located in builtin/notes.c for
      historical reasons. In order to make it available to builtin/commit.c
      it was declared in builtin.h. This was more of an accident of history
      than a concious design, and we now want to make this machinery more
      widely available.
      
      Hence, this patch moves the code into the new notes-utils.[hc] files
      which are included into libgit.a. Except for adjusting #includes
      accordingly, this patch merely moves the relevant functions verbatim
      into the new files.
      
      Cc: Thomas Rast <trast@inf.ethz.ch>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      49c24704
  29. 12 6月, 2013 1 次提交
    • J
      prio-queue: priority queue of pointers to structs · b4b594a3
      Junio C Hamano 提交于
      Traditionally we used a singly linked list of commits to hold a set
      of in-flight commits while traversing history.  The most typical use
      of the list is to add commits that are newly discovered to it, keep
      the list sorted by commit timestamp, pick up the newest one from the
      list, and keep digging.  The cost of keeping the singly linked list
      sorted is nontrivial, and this typical use pattern better matches a
      priority queue.
      
      Introduce a prio-queue structure, that can be used either as a LIFO
      stack, or a priority queue.  This will be used in the next patch to
      hold in-flight commits during sort-in-topological-order.
      
      Tests and the idea to make it usable for any "void *" pointers to
      "things" are by Jeff King.  Bugs are mine.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b4b594a3
  30. 10 6月, 2013 2 次提交