1. 26 1月, 2007 1 次提交
  2. 19 1月, 2007 1 次提交
  3. 16 1月, 2007 1 次提交
  4. 12 1月, 2007 1 次提交
    • L
      Better error messages for corrupt databases · 9130ac1e
      Linus Torvalds 提交于
      This fixes another problem that Andy's case showed: git-fsck-objects
      reports nonsensical results for corrupt objects.
      
      There were actually two independent and confusing problems:
      
       - when we had a zero-sized file and used map_sha1_file, mmap() would
         return EINVAL, and git-fsck-objects would report that as an insane and
         confusing error. I don't know when this was introduced, it might have
         been there forever.
      
       - when "parse_object()" returned NULL, fsck would say "object not found",
         which can be very confusing, since obviously the object might "exist",
         it's just unparseable because it's totally corrupt.
      
      So this just makes "xmmap()" return NULL for a zero-sized object (which is
      a valid thing pointer, exactly the same way "malloc()" can return NULL for
      a zero-sized allocation). That fixes the first problem (but we could have
      fixed it in the caller too - I don't personally much care whichever way it
      goes, but maybe somebody should check that the NO_MMAP case does
      something sane in this case too?).
      
      And the second problem is solved by just making the error message slightly
      clearer - the failure to parse an object may be because it's missing or
      corrupt, not necessarily because it's not "found".
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9130ac1e
  5. 10 1月, 2007 1 次提交
  6. 07 1月, 2007 2 次提交
  7. 30 12月, 2006 3 次提交
    • S
      Replace mmap with xmmap, better handling MAP_FAILED. · c4712e45
      Shawn O. Pearce 提交于
      In some cases we did not even bother to check the return value of
      mmap() and just assume it worked.  This is bad, because if we are
      out of virtual address space the kernel returned MAP_FAILED and we
      would attempt to dereference that address, segfaulting without any
      real error output to the user.
      
      We are replacing all calls to mmap() with xmmap() and moving all
      MAP_FAILED checking into that single location.  If a mmap call
      fails we try to release enough least-recently-used pack windows
      to possibly succeed, then retry the mmap() attempt.  If we cannot
      mmap even after releasing pack memory then we die() as none of our
      callers have any reasonable recovery strategy for a failed mmap.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      c4712e45
    • S
      Release pack windows before reporting out of memory. · 97bfeb34
      Shawn O. Pearce 提交于
      If we are about to fail because this process has run out of memory we
      should first try to automatically control our appetite for address
      space by releasing enough least-recently-used pack windows to gain
      back enough memory such that we might actually be able to meet the
      current allocation request.
      
      This should help users who have fairly large repositories but are
      working on systems with relatively small virtual address space.
      Many times we see reports on the mailing list of these users running
      out of memory during various Git operations.  Dynamically decreasing
      the amount of pack memory used when the demand for heap memory is
      increasing is an intelligent solution to this problem.
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      97bfeb34
    • S
      Default core.packdGitWindowSize to 1 MiB if NO_MMAP. · 8c82534d
      Shawn O. Pearce 提交于
      If the compiler has asked us to disable use of mmap() on their
      platform then we are forced to use git_mmap and its emulation via
      pread.  In this case large (e.g. 32 MiB) windows for pack access
      are simply too big as a command will wind up reading a lot more
      data than it will ever need, significantly reducing response time.
      
      To prevent a high latency when NO_MMAP has been selected we now
      use a default of 1 MiB for core.packedGitWindowSize.  Credit goes
      to Linus and Junio for recommending this more reasonable setting.
      
      [jc: upcased the name of the symbolic constant, and made another
       hardcoded constant into a symbolic constant while at it. ]
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      8c82534d
  8. 24 12月, 2006 1 次提交
  9. 23 12月, 2006 1 次提交
  10. 22 12月, 2006 2 次提交
  11. 21 12月, 2006 2 次提交
    • T
      Fix system header problems on Mac OS X · c902c9a6
      Terje Sten Bjerkseth 提交于
      For Mac OS X 10.4, _XOPEN_SOURCE defines _POSIX_C_SOURCE which
      hides many symbols from the program.
      
      Breakage noticed and initial analysis provided by Randal
      L. Schwartz.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      c902c9a6
    • J
      simplify inclusion of system header files. · 85023577
      Junio C Hamano 提交于
      This is a mechanical clean-up of the way *.c files include
      system header files.
      
       (1) sources under compat/, platform sha-1 implementations, and
           xdelta code are exempt from the following rules;
      
       (2) the first #include must be "git-compat-util.h" or one of
           our own header file that includes it first (e.g. config.h,
           builtin.h, pkt-line.h);
      
       (3) system headers that are included in "git-compat-util.h"
           need not be included in individual C source files.
      
       (4) "git-compat-util.h" does not have to include subsystem
           specific header files (e.g. expat.h).
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      85023577
  12. 16 9月, 2006 1 次提交
  13. 02 9月, 2006 1 次提交
    • S
      Replace uses of strdup with xstrdup. · 9befac47
      Shawn Pearce 提交于
      Like xmalloc and xrealloc xstrdup dies with a useful message if
      the native strdup() implementation returns NULL rather than a
      valid pointer.
      
      I just tried to use xstrdup in new code and found it to be missing.
      However I expected it to be present as xmalloc and xrealloc are
      already commonly used throughout the code.
      
      [jc: removed the part that deals with last_XXX, which I am
       finding more and more dubious these days.]
      Signed-off-by: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9befac47
  14. 27 8月, 2006 1 次提交
  15. 12 8月, 2006 1 次提交
    • R
      drop length argument of has_extension · 5bb1cda5
      Rene Scharfe 提交于
      As Fredrik points out the current interface of has_extension() is
      potentially confusing.  Its parameters include both a nul-terminated
      string and a length-limited string.
      
      This patch drops the length argument, requiring two nul-terminated
      strings; all callsites are updated.  I checked that all of them indeed
      provide nul-terminated strings.  Filenames need to be nul-terminated
      anyway if they are to be passed to open() etc.  The performance penalty
      of the additional strlen() is negligible compared to the system calls
      which inevitably surround has_extension() calls.
      
      Additionally, change has_extension() to use size_t inside instead of
      int, as that is the exact type strlen() returns and memcmp() expects.
      Signed-off-by: NRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5bb1cda5
  16. 11 8月, 2006 1 次提交
  17. 09 8月, 2006 1 次提交
  18. 25 6月, 2006 1 次提交
  19. 24 6月, 2006 1 次提交
    • P
      Customizable error handlers · 39a3f5ea
      Petr Baudis 提交于
      This patch makes the usage(), die() and error() handlers customizable.
      Nothing in the git code itself uses that but many other libgit users
      (like Git.pm) will.
      
      This is implemented using the mutator functions primarily because you
      cannot directly modifying global variables of libgit from a program that
      dlopen()ed it, apparently. But having functions for that is a better API
      anyway.
      Signed-off-by: NPetr Baudis <pasky@suse.cz>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      39a3f5ea
  20. 10 3月, 2006 1 次提交
  21. 26 1月, 2006 1 次提交
  22. 08 1月, 2006 1 次提交
    • J
      [PATCH] Compilation: zero-length array declaration. · 8f1d2e6f
      Junio C Hamano 提交于
      ISO C99 (and GCC 3.x or later) lets you write a flexible array
      at the end of a structure, like this:
      
      	struct frotz {
      		int xyzzy;
      		char nitfol[]; /* more */
      	};
      
      GCC 2.95 and 2.96 let you to do this with "char nitfol[0]";
      unfortunately this is not allowed by ISO C90.
      
      This declares such construct like this:
      
      	struct frotz {
      		int xyzzy;
      		char nitfol[FLEX_ARRAY]; /* more */
      	};
      
      and git-compat-util.h defines FLEX_ARRAY to 0 for gcc 2.95 and
      empty for others.
      
      If you are using a C90 C compiler, you should be able
      to override this with CFLAGS=-DFLEX_ARRAY=1 from the
      command line of "make".
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      8f1d2e6f
  23. 29 12月, 2005 1 次提交
  24. 20 12月, 2005 1 次提交
  25. 15 12月, 2005 1 次提交
  26. 06 12月, 2005 1 次提交
    • J
      Clean up compatibility definitions. · 4050c0df
      Junio C Hamano 提交于
      This attempts to clean up the way various compatibility
      functions are defined and used.
      
       - A new header file, git-compat-util.h, is introduced.  This
         looks at various NO_XXX and does necessary function name
         replacements, equivalent of -Dstrcasestr=gitstrcasestr in the
         Makefile.
      
       - Those function name replacements are removed from the Makefile.
      
       - Common features such as usage(), die(), xmalloc() are moved
         from cache.h to git-compat-util.h; cache.h includes
         git-compat-util.h itself.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      4050c0df