1. 15 5月, 2006 1 次提交
  2. 14 5月, 2006 1 次提交
    • D
      Fix git-pack-objects for 64-bit platforms · 66561f5a
      Dennis Stosberg 提交于
      The offset of an object in the pack is recorded as a 4-byte integer
      in the index file.  When reading the offset from the mmap'ed index
      in prepare_pack_revindex(), the address is dereferenced as a long*.
      This works fine as long as the long type is four bytes wide.  On
      NetBSD/sparc64, however, a long is 8 bytes wide and so dereferencing
      the offset produces garbage.
      
      [jc: taking suggestion by Linus to use uint32_t]
      Signed-off-by: NDennis Stosberg <dennis@stosberg.net>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      66561f5a
  3. 18 4月, 2006 1 次提交
  4. 08 4月, 2006 1 次提交
  5. 04 4月, 2006 1 次提交
  6. 20 3月, 2006 1 次提交
    • J
      unpack_delta_entry(): reduce memory footprint. · 67686d95
      Junio C Hamano 提交于
      Currently we unpack the delta data from the pack and then unpack
      the base object to apply that delta data to it.  When getting an
      object that is deeply deltified, we can reduce memory footprint
      by unpacking the base object first and then unpacking the delta
      data, because we will need to keep at most one delta data in
      memory that way.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      67686d95
  7. 23 2月, 2006 3 次提交
    • J
      Give no terminating LF to error() function. · bd2afde8
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      bd2afde8
    • J
      pack-objects: reuse data from existing packs. · 3f9ac8d2
      Junio C Hamano 提交于
      When generating a new pack, notice if we have already needed
      objects in existing packs.  If an object is stored deltified,
      and its base object is also what we are going to pack, then
      reuse the existing deltified representation unconditionally,
      bypassing all the expensive find_deltas() and try_deltas()
      calls.
      
      Also, notice if what we are going to write out exactly match
      what is already in an existing pack (either deltified or just
      compressed).  In such a case, we can just copy it instead of
      going through the usual uncompressing & recompressing cycle.
      
      Without this patch, in linux-2.6 repository with about 1500
      loose objects and a single mega pack:
      
          $ git-rev-list --objects v2.6.16-rc3 >RL
          $ wc -l RL
          184141 RL
          $ time git-pack-objects p <RL
          Generating pack...
          Done counting 184141 objects.
          Packing 184141 objects....................
          a1fc7b3e537fcb9b3c46b7505df859f0a11e79d2
      
          real    12m4.323s
          user    11m2.560s
          sys     0m55.950s
      
      With this patch, the same input:
      
          $ time ../git.junio/git-pack-objects q <RL
          Generating pack...
          Done counting 184141 objects.
          Packing 184141 objects.....................
          a1fc7b3e537fcb9b3c46b7505df859f0a11e79d2
          Total 184141, written 184141, reused 182441
      
          real    1m2.608s
          user    0m55.090s
          sys     0m1.830s
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      3f9ac8d2
    • J
      detect broken alternates. · 26125f6b
      Junio C Hamano 提交于
      The real problem triggered an earlier fix was that an alternate
      entry was pointing at a removed directory.  Complaining on
      object/pack directory that cannot be opendir-ed produces noise
      in an ancient repository that does not have object/pack
      directory and has never been packed.
      
      Detect the real user error and report it.  Also if opendir
      failed for other reasons (e.g. no read permissions), report that
      as well.
      
      Spotted by Andrew Vasquez <andrew.vasquez@qlogic.com>.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      26125f6b
  8. 18 2月, 2006 1 次提交
  9. 17 2月, 2006 1 次提交
    • J
      pack-objects: reuse data from existing packs. · a49dd05f
      Junio C Hamano 提交于
      When generating a new pack, notice if we have already needed
      objects in existing packs.  If an object is stored deltified,
      and its base object is also what we are going to pack, then
      reuse the existing deltified representation unconditionally,
      bypassing all the expensive find_deltas() and try_deltas()
      calls.
      
      Also, notice if what we are going to write out exactly match
      what is already in an existing pack (either deltified or just
      compressed).  In such a case, we can just copy it instead of
      going through the usual uncompressing & recompressing cycle.
      
      Without this patch, in linux-2.6 repository with about 1500
      loose objects and a single mega pack:
      
          $ git-rev-list --objects v2.6.16-rc3 >RL
          $ wc -l RL
          184141 RL
          $ time git-pack-objects p <RL
          Generating pack...
          Done counting 184141 objects.
          Packing 184141 objects....................
          a1fc7b3e537fcb9b3c46b7505df859f0a11e79d2
      
          real    12m4.323s
          user    11m2.560s
          sys     0m55.950s
      
      With this patch, the same input:
      
          $ time ../git.junio/git-pack-objects q <RL
          Generating pack...
          Done counting 184141 objects.
          Packing 184141 objects.....................
          a1fc7b3e537fcb9b3c46b7505df859f0a11e79d2
          Total 184141, written 184141, reused 182441
      
          real    1m2.608s
          user    0m55.090s
          sys     0m1.830s
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      a49dd05f
  10. 16 2月, 2006 1 次提交
  11. 10 2月, 2006 1 次提交
    • J
      stat() for existence in safe_create_leading_directories() · 67d42212
      Jason Riedy 提交于
      Use stat() to explicitly check for existence rather than
      relying on the non-portable EEXIST error in sha1_file.c's
      safe_create_leading_directories().  There certainly are
      optimizations possible, but then the code becomes almost
      the same as that in coreutil's lib/mkdir-p.c.
      
      Other uses of EEXIST seem ok.  Tested on Solaris 8, AIX 5.2L,
      and a few Linux versions.  AIX has some unrelated (I think)
      failures right now; I haven't tried many recent gits there.
      Anyone have an old Ultrix box to break everything?  ;)
      
      Also remove extraneous #includes.  Everything's already in
      git-compat-util.h, included through cache.h.
      Signed-off-by: NJason Riedy <ejr@cs.berkeley.edu>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      67d42212
  12. 20 1月, 2006 1 次提交
    • J
      Revert "check_packed_git_idx(): check integrity of the idx file itself." · e93ec6f9
      Junio C Hamano 提交于
      This reverts c5ced645 commit.
      It turns out that doing this check every time we map the idx file
      is quite expensive.  A corrupt idx file is caught by git-fsck-objects,
      so this check is not strictly necessary.
      
      In one unscientific test, 0.99.9m spent 10 seconds usertime for
      the same task 1.1.3 takes 37 seconds usertime.  Reverting this gives
      us the performance of 0.99.9 back.
      e93ec6f9
  13. 24 12月, 2005 2 次提交
    • J
      Introduce core.sharedrepository · 457f06d6
      Johannes Schindelin 提交于
      If the config variable 'core.sharedrepository' is set, the directories
      
      	$GIT_DIR/objects/
      	$GIT_DIR/objects/??
      	$GIT_DIR/objects/pack
      	$GIT_DIR/refs
      	$GIT_DIR/refs/heads
      	$GIT_DIR/refs/heads/tags
      
      are set group writable (and g+s, since the git group may be not the primary
      group of all users).
      
      Since all files are written as lock files first, and then moved to
      their destination, they do not have to be group writable.  Indeed, if
      this leads to problems you found a bug.
      
      Note that -- as in my first attempt -- the config variable is set in the
      function which checks the repository format. If this were done in
      git_default_config instead, a lot of programs would need to be modified
      to call git_config(git_default_config) first.
      
      [jc: git variables should be in environment.c unless there is a
       compelling reason to do otherwise.]
      Signed-off-by: NJohannes Schindelin <Johannes.Schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      457f06d6
    • J
      check_packed_git_idx(): check integrity of the idx file itself. · c5ced645
      Junio C Hamano 提交于
      Although pack-check.c had routine to verify the checksum for the
      pack index file itself, the core did not check it before using
      it.
      
      This is stolen from the patch to tighten packname requirements.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      (cherry picked from 797bd6f4 commit)
      c5ced645
  14. 23 12月, 2005 2 次提交
  15. 22 12月, 2005 2 次提交
  16. 11 12月, 2005 1 次提交
  17. 05 12月, 2005 1 次提交
    • J
      sha1_file.c: make sure packs in an alternate odb is named properly. · 1494e038
      Junio C Hamano 提交于
      We somehow ended up registering packs in alternate object
      directories as "dir/object//pack/pack-*", which confusd the
      update-server-info code very badly.  Also we did not attempt to
      detect a mistake of listing the object directory itself as one
      of the alternates. This does not lead to incorrect behaviour,
      but is simply wasteful, so try to do so when we are trivially
      able to.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      1494e038
  18. 17 11月, 2005 1 次提交
  19. 16 11月, 2005 1 次提交
  20. 12 11月, 2005 1 次提交
  21. 07 11月, 2005 1 次提交
  22. 27 10月, 2005 1 次提交
    • L
      Fix what to do and how to detect when hardlinking fails · 7ebb6fca
      Linus Torvalds 提交于
      Recent FAT workaround caused compilation trouble on OpenBSD;
      different platforms use different error codes when we try to
      hardlink the temporary file to its final location.  Existing
      Coda hack also checks its own error code, but the thing is,
      the case we care about is if link failed for a reason other
      than that the final file has already existed (which would be
      normal, or it could mean collision).  So just check the error
      code against EEXIST.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      7ebb6fca
  23. 26 10月, 2005 1 次提交
  24. 14 10月, 2005 1 次提交
  25. 12 10月, 2005 1 次提交
    • L
      Use git config file for committer name and email info · e1b10391
      Linus Torvalds 提交于
      This starts using the "user.name" and "user.email" config variables if
      they exist as the default name and email when committing.  This means
      that you don't have to use the GIT_COMMITTER_EMAIL environment variable
      to override your email - you can just edit the config file instead.
      
      The patch looks bigger than it is because it makes the default name and
      email information non-static and renames it appropriately.  And it moves
      the common git environment variables into a new library file, so that
      you can link against libgit.a and get the git environment without having
      to link in zlib and libcrypt.
      
      In short, most of it is renaming and moving, the real change core is
      just a few new lines in "git_default_config()" that copies the user
      config values to the new base.
      
      It also changes "git-var -l" to list the config variables.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      e1b10391
  26. 11 10月, 2005 1 次提交
    • J
      Use the same move_temp_to_file in git-http-fetch. · b721e01f
      Junio C Hamano 提交于
      The http commit walker cannot use the same temporary file
      creation code because it needs to use predictable temporary
      filename for partial fetch continuation purposes, but the code
      to move the temporary file to the final location should be
      usable from the ordinary object creation codepath.
      
      Export move_temp_to_file from sha1_file.c and use it, while
      losing the custom relink_or_rename function from http-fetch.c.
      
      Also the temporary object file creation part needs to make sure
      the leading path exists, in preparation of the really lazy
      fan-out directory creation.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      b721e01f
  27. 09 10月, 2005 1 次提交
    • L
      Create object subdirectories on demand · 230f1322
      Linus Torvalds 提交于
      This makes it possible to have a "sparse" git object subdirectory
      structure, something that has become much more attractive now that people
      use pack-files all the time.
      
      As a result of pack-files, a git object directory doesn't necessarily have
      any individual objects lying around, and in that case it's just wasting
      space to keep the empty first-level object directories around: on many
      filesystems the 256 empty directories will be aboue 1MB of diskspace.
      
      Even more importantly, after you re-pack a project that _used_ to be
      unpacked, you could be left with huge directories that no longer contain
      anything, but that waste space and take time to look through.
      
      With this change, "git prune-packed" can just do an rmdir() on the
      directories, and they'll get removed if empty, and re-created on demand.
      
      This patch also tries to fix up "write_sha1_from_fd()" to use the new
      common infrastructure for creating the object files, closing a hole where
      we might otherwise leave half-written objects in the object database.
      
      [jc: I unoptimized the part that really removes the fan-out directories
       to ease transition.  init-db still wastes 1MB of diskspace to hold 256
       empty fan-outs, and prune-packed rmdir()'s the grown but empty directories,
       but runs mkdir() immediately after that -- reducing the saving from 150KB
       to 146KB.  These parts will be re-introduced when everybody has the
       on-demand capability.]
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      230f1322
  28. 07 10月, 2005 1 次提交
    • J
      Show original and resulting blob object info in diff output. · ec1fcc16
      Junio C Hamano 提交于
      This adds more cruft to diff --git header to record the blob SHA1 and
      the mode the patch/diff is intended to be applied against, to help the
      receiving end fall back on a three-way merge.  The new header looks
      like this:
      
          diff --git a/apply.c b/apply.c
          index 7be5041..8366082 100644
          --- a/apply.c
          +++ b/apply.c
          @@ -14,6 +14,7 @@
           //    files that are being modified, but doesn't apply the patch
           //  --stat does just a diffstat, and doesn't actually apply
          +//  --show-index-info shows the old and new index info for...
          ...
      
      Upon receiving such a patch, if the patch did not apply cleanly to the
      target tree, the recipient can try to find the matching old objects in
      her object database and create a temporary tree, apply the patch to
      that temporary tree, and attempt a 3-way merge between the patched
      temporary tree and the target tree using the original temporary tree
      as the common ancestor.
      
      The patch lifts the code to compute the hash for an on-filesystem
      object from update-index.c and makes it available to the diff output
      routine.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      ec1fcc16
  29. 01 10月, 2005 1 次提交
  30. 30 9月, 2005 1 次提交
  31. 27 9月, 2005 1 次提交
  32. 14 9月, 2005 1 次提交
    • J
      [PATCH] Define relative .git/objects/info/alternates semantics. · ccfd3e99
      Junio C Hamano 提交于
      An entry in the alternates file can name a directory relative to
      the object store it describes.  A typical linux-2.6 maintainer
      repository would have "../../../torvalds/linux-2.6.git/objects" there,
      because the subsystem maintainer object store would live in
      
          /pub/scm/linux/kernel/git/$u/$system.git/objects/
      
      and the object store of Linus tree is in
      
          /pub/scm/linux/kernel/git/torvalds/linux-2.6.git/objects/
      
      This unfortunately is different from GIT_ALTERNATE_OBJECT_DIRECTORIES
      which is relative to the cwd of the running process, but there is no
      way to make it consistent with the behaviour of the environment
      variable.  The process typically is run in $system.git/ directory for
      a naked repository, or one level up for a repository with a working
      tree, so we just define it to be relative to the objects/ directory
      to be different from either ;-).
      
      Later, the dumb transport could be updated to read from info/alternates
      and make requests for the repository the repository borrows from.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      ccfd3e99
  33. 10 9月, 2005 1 次提交
  34. 05 9月, 2005 1 次提交
  35. 24 8月, 2005 1 次提交
    • J
      Fix ?: statements. · c7c81b3a
      Jason Riedy 提交于
      Omitting the first branch in ?: is a GNU extension.  Cute,
      but not supported by other compilers.  Replaced mostly
      by explicit tests.  Calls to getenv() simply are repeated
      on non-GNU compilers.
      Signed-off-by: NJason Riedy <ejr@cs.berkeley.edu>
      c7c81b3a