summaryrefslogtreecommitdiff
path: root/git-compat-util.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'il/maint-xmallocz'Junio C Hamano2010-01-271-0/+1
|\ | | | | | | | | | | | | | | * il/maint-xmallocz: Fix integer overflow in unpack_compressed_entry() Fix integer overflow in unpack_sha1_rest() Fix integer overflow in patch_delta() Add xmallocz()
| * Add xmallocz()Ilari Liusvaara2010-01-261-0/+1
| | | | | | | | | | | | | | | | | | | | Add routine for allocating NUL-terminated memory block without risking integer overflow in addition of +1 for NUL byte. [jc: with suggestion from Bill Lear] Signed-off-by: Ilari Liusvaara <ilari.liusvaara@elisanet.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | msvc: Add a definition of NORETURN compatible with msvc compilerRamsay Jones2010-01-221-0/+3
| | | | | | | | | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Acked-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'ap/merge-backend-opts'Junio C Hamano2010-01-201-0/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * ap/merge-backend-opts: Document that merge strategies can now take their own options Extend merge-subtree tests to test -Xsubtree=dir. Make "subtree" part more orthogonal to the rest of merge-recursive. pull: Fix parsing of -X<option> Teach git-pull to pass -X<option> to git-merge git merge -X<option> git-merge-file --ours, --theirs Conflicts: git-compat-util.h
| * | git merge -X<option>Avery Pennarun2010-01-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Teach "-X <option>" command line argument to "git merge" that is passed to strategy implementations. "ours" and "theirs" autoresolution introduced by the previous commit can be asked to the recursive strategy. Signed-off-by: Avery Pennarun <apenwarr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'jc/symbol-static'Junio C Hamano2010-01-201-1/+0
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * jc/symbol-static: date.c: mark file-local function static Replace parse_blob() with an explanatory comment symlinks.c: remove unused functions object.c: remove unused functions strbuf.c: remove unused function sha1_file.c: remove unused function mailmap.c: remove unused function utf8.c: mark file-local function static submodule.c: mark file-local function static quote.c: mark file-local function static remote-curl.c: mark file-local function static read-cache.c: mark file-local functions static parse-options.c: mark file-local function static entry.c: mark file-local function static http.c: mark file-local functions static pretty.c: mark file-local function static builtin-rev-list.c: mark file-local function static bisect.c: mark file-local function static
| * | | date.c: mark file-local function staticJunio C Hamano2010-01-201-1/+0
| |/ / | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Add missing #include to support TIOCGWINSZ on SolarisNguyễn Thái Ngọc Duy2010-01-111-0/+1
|/ / | | | | | | | | | | | | | | | | | | On Linux TIOCGWINSZ is defined somehwere in ioctl.h, which is already included. On Solaris we also need to include termios.h. Without this term_columns() in help.c will think TIOCGWINSZ is not supported and always return 80 columns. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Introduce usagef() that takes a printf-style formatJonathan Nieder2009-11-101-0/+1
|/ | | | | | | | | | | | | | | | | | Some new callers would want to use printf-like formatting, when issuing their usage messages. An option is to change usage() itself also be like printf(), which would make it similar to die() and warn(). But usage() is typically fixed, as opposed to die() and warn() that gives diagnostics depending on the situation. Indeed, the majority of strings given by existing callsites to usage() are fixed strings. If we were to make usage() take printf-style format, they all need to be changed to have "%s" as their first argument. So instead, introduce usagef() so that limited number of callers can use it. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* add NORETURN_PTR for function pointersErik Faye-Lund2009-10-011-1/+3
| | | | | | | | | | | | Some compilers (including at least MSVC and ARM RVDS) supports NORETURN on function declarations, but not on function pointers. This patch makes it possible to define NORETURN for these compilers, by splitting the NORETURN macro into two - one for function declarations and one for function pointers. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Jeff King <peff@peff.net>
* increase portability of NORETURN declarationsErik Faye-Lund2009-10-011-4/+4
| | | | | | | | | | | Some compilers (including at least MSVC) support NORETURN on function declarations, but only before the function-name. This patch makes it possible to define NORETURN to something meaningful for those compilers. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Jeff King <peff@peff.net>
* Make usage of windows.h lean and meanMarius Storm-Olsen2009-09-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | Centralize the include of windows.h in git-compat-util.h, turn on WIN32_LEAN_AND_MEAN to avoid including plenty of other header files which is not needed in Git. Also ensure we load winsock2.h first, so we don't load the older winsock definitions at a later stage, since they contain duplicate definitions. When moving windows.h into git-compat-util.h, we need to protect the definition of struct pollfd in mingw.h, since this file is used by both MinGW and MSVC, and the latter defines this struct in winsock2.h. We need to keep the windows.h include in compat/win32.h, since its shared by both MinGW and Cygwin, and we're not touching Cygwin in this commit. The include in git-compat-util.h is protected with an ifdef WIN32, which is not the case when compiling for Cygwin. Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add platform files for porting to MSVCFrank Li2009-09-181-0/+3
| | | | | | | | | Add msvc.c and msvc.h to build git under MSVC. Signed-off-by: Frank Li <lznuaa@gmail.com> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'lt/block-sha1'Junio C Hamano2009-08-271-0/+2
|\ | | | | | | | | | | | | | | * lt/block-sha1: remove ARM and Mozilla SHA1 implementations block-sha1: guard gcc extensions with __GNUC__ make sure byte swapping is optimal for git block-sha1: make the size member first in the context struct
| * make sure byte swapping is optimal for gitNicolas Pitre2009-08-181-0/+2
| | | | | | | | | | | | | | | | | | | | We rely on ntohl() and htonl() to perform byte swapping in many places. However, some platforms have libraries providing really poor implementations of those which might cause significant performance issues, especially with the block-sha1 code. Signed-off-by: Nicolas Pitre <nico@cam.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-compat-util.h: remove superfluous test for __sun__Brandon Casey2009-08-191-2/+0
|/ | | | | | | | | | This 'ifndef' macro is entered only when __sun__ is not defined. This test will never fail since it is located inside of the 'else' branch of an 'if' macro which tests whether __sun__ is defined. It has had no effect since the merge at 436f66b7. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* janitor: add DIV_ROUND_UP and use it.Pierre Habouzit2009-07-221-0/+2
| | | | | Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* refactor: use bitsizeof() instead of 8 * sizeof()Pierre Habouzit2009-07-221-1/+2
| | | | | Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-compat-util.h: adjust for SGI IRIX 6.5Brandon Casey2009-07-101-1/+2
| | | | | | | | | | | | | | | | | | | Don't define _XOPEN_SOURCE Do define _SGI_SOURCE Defining _XOPEN_SOURCE prevents many of the common functions and macros from being defined. _Not_ setting _XOPEN_SOURCE, and instead setting _SGI_SOURCE, provides all of the XPG4, XPG5, BSD, POSIX functions and declarations, _BUT_ provides a horribly broken snprintf(). SGI does have a working snprintf(), but it is only provided when _NO_XOPEN5 evaluates to zero, and this only happens if _XOPEN_SOURCE is defined which, as mentioned above, prevents many other common functions and defines. The broken snprintf will be worked around with SNPRINTF_RETURNS_BOGUS in the Makefile in a later patch. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'tr/die_errno'Junio C Hamano2009-07-061-0/+1
|\ | | | | | | | | | | | | | | * tr/die_errno: Use die_errno() instead of die() when checking syscalls Convert existing die(..., strerror(errno)) to die_errno() die_errno(): double % in strerror() output just in case Introduce die_errno() that appends strerror(errno) to die()
| * Introduce die_errno() that appends strerror(errno) to die()Thomas Rast2009-06-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are many calls to die() that do, or should, report strerror(errno) to indicate how the syscall they guard failed. Introduce a small helper function for this case. Note: - POSIX says vsnprintf can modify errno in some unlikely cases, so we have to use errno early. - We take some care to pass the original format to die_routine(), in case someone wants to call die_errno() with custom format characters. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'bc/solaris'Junio C Hamano2009-06-131-2/+15
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bc/solaris: configure: test whether -lresolv is needed Makefile: insert SANE_TOOL_PATH to PATH before /bin or /usr/bin git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8 Makefile: add section for SunOS 5.7 Makefile: introduce SANE_TOOL_PATH for prepending required elements to PATH Makefile: define __sun__ on SunOS git-compat-util.h: tweak the way _XOPEN_SOURCE is set on Solaris On Solaris choose the OLD_ICONV iconv() declaration based on the UNIX spec Makefile: add NEEDS_RESOLV to optionally add -lresolv to compile arguments Makefile: use /usr/ucb/install on SunOS platforms rather than ginstall Conflicts: Makefile
| * git-compat-util.h: avoid using c99 flex array feature with Sun compiler 5.8Brandon Casey2009-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Sun c99 compiler as recent as version 5.8 Patch 121016-06 2007/08/01 produces an error when compiling diff-delta.c. This source file #includes the delta.h header file which pre-declares a struct which is later defined to contain a flex array member. The Sun c99 compiler fails to compile diff-delta.c and gives the following error: "diff-delta.c", line 314: identifier redeclared: create_delta current : function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void previous: function(pointer to const struct delta_index {unsigned long memsize, pointer to const void src_buf, unsigned long src_size, unsigned int hash_mask, array[-1] of pointer to struct index_entry {..} hash}, pointer to const void, unsigned long, pointer to unsigned long, unsigned long) returning pointer to void : "delta.h", line 44 c99: acomp failed for diff-delta.c So, avoid using this c99 feature when compiling with the Sun c compilers version 5.8 and older (the most recent version tested). Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git-compat-util.h: tweak the way _XOPEN_SOURCE is set on SolarisBrandon Casey2009-06-061-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On Solaris, when _XOPEN_EXTENDED is set, its header file forces the programs to be XPG4v2, defeating any _XOPEN_SOURCE setting to say we are XPG5 or XPG6. Also on Solaris, XPG6 programs must be compiled with a c99 compiler, while non XPG6 programs must be compiled with a pre-c99 compiler. So when compiling on Solaris, always refrain from setting _XOPEN_EXTENDED, and then set _XOPEN_SOURCE to 600 or 500 based on whether a c99 compiler is being used or not. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'da/pretty-tempname'Junio C Hamano2009-06-031-0/+12
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | * da/pretty-tempname: diff: generate pretty filenames in prep_temp_blob() compat: add a basename() compatibility function compat: add a mkstemps() compatibility function Conflicts: Makefile
| * | compat: add a basename() compatibility functionDavid Aguilar2009-05-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some systems such as Windows lack libgen.h so provide a basename() implementation for cross-platform use. This introduces the NO_LIBGEN_H construct to the Makefile and autoconf scripts. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | compat: add a mkstemps() compatibility functionDavid Aguilar2009-05-311-0/+5
| |/ | | | | | | | | | | | | | | | | mkstemps() is a BSD extension so provide an implementation for cross-platform use. Signed-off-by: David Aguilar <davvid@gmail.com> Tested-by: Johannes Sixt <j6t@kdbg.org> (Windows) Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Teach Solaris that _XOPEN_SOURCE=600 really menas XPG6Junio C Hamano2009-05-221-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In git-compat-util.h, we do #define _XOPEN_SOURCE 600 #define _XOPEN_SOURCE_EXTENDED 1 unless we are on BSD or SCO. On OpenSolaris (200811), /usr/include/sys/feature_tests.h has this nice table: Feature Test Macro Specification ------------------------------------------------ ------------- _XOPEN_SOURCE XPG3 _XOPEN_SOURCE && _XOPEN_VERSION = 4 XPG4 _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED = 1 XPG4v2 _XOPEN_SOURCE = 500 XPG5 _XOPEN_SOURCE = 600 (or POSIX_C_SOURCE=200112L) XPG6 Later in the same header, compilation with -c99 is made to fail if _XPG6 is not set, like this: #if defined(_STDC_C99) && (defined(__XOPEN_OR_POSIX) && !defined(_XPG6)) #error "Compiler or options invalid for pre-UNIX 03 X/Open applications \ and pre-2001 POSIX applications" #elif ... The problem is that they check things in an order that is inconvenient for us. When they see _XOPEN_SOURCE_EXTENDED, they declare that we are XPG4v2, regardless of the value of _XOPEN_SOURCE. To work around this problem, do not define _XOPEN_SOURCE_EXTENDED on Sun's. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Introduce an unlink(2) wrapper which gives warning if unlink failedAlex Riesen2009-04-291-0/+6
| | | | | | | | | | | | | | This seem to be a very common pattern in the current code. The function prints a generic removal failure message, the file name which failed and readable errno presentation. The function preserves errno and always returns the value unlink(2) returned, but prints no message for ENOENT, as it was the most often filtered out in the code calling unlink. Besides, removing a file is anyway the purpose of calling unlink. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* NetBSD compilation fixPatrick Welche2009-04-271-0/+1
| | | | | | Similar to other BSD variants, it needs USE_ST_TIMESPEC. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Windows: Skip fstat/lstat optimization in write_entry()Johannes Sixt2009-04-201-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Commit e4c72923 (write_entry(): use fstat() instead of lstat() when file is open, 2009-02-09) introduced an optimization of write_entry(). Unfortunately, we cannot take advantage of this optimization on Windows because there is no guarantee that the time stamps are updated before the file is closed: "The only guarantee about a file timestamp is that the file time is correctly reflected when the handle that makes the change is closed." (http://msdn.microsoft.com/en-us/library/ms724290(VS.85).aspx) The failure of this optimization on Windows can be observed most easily by running a 'git checkout' that has to update several large files. In this case, 'git checkout' will report modified files, but infact only the timestamps were incorrectly recorded in the index, as can be verified by a subsequent 'git diff', which shows no change. Dmitry Potapov reports the same fix needs on Cygwin; this commit contains his updates for that. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* MinGW: implement mmapJanos Laube2009-03-181-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | Add USE_WIN32_MMAP which triggers the use of windows' native file memory mapping functionality in git_mmap()/git_munmap() functions. As git functions currently use mmap with MAP_PRIVATE set only, this implementation supports only that mode for now. On Windows, offsets for memory mapped files need to match the allocation granularity. Take this into account when calculating the packed git- windowsize and file offsets. At the moment, the only function which makes use of offsets in conjunction with mmap is use_pack() in sha1-file.c. Git fast-import's code path tries to map a portion of the temporary packfile that exceeds the current filesize, i.e. offset+length is greater than the filesize. The NO_MMAP code worked with that since pread() just reads the file content until EOF and returns gracefully, while MapViewOfFile() aborts the mapping and returns 'Access Denied'. Working around that by determining the filesize and adjusting the length parameter. Signed-off-by: Janos Laube <janos.dev@gmail.com> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'kb/checkout-optim'Junio C Hamano2009-03-171-0/+14
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * kb/checkout-optim: Revert "lstat_cache(): print a warning if doing ping-pong between cache types" checkout bugfix: use stat.mtime instead of stat.ctime in two places Makefile: Set compiler switch for USE_NSEC Create USE_ST_TIMESPEC and turn it on for Darwin Not all systems use st_[cm]tim field for ns resolution file timestamp Record ns-timestamps if possible, but do not use it without USE_NSEC write_index(): update index_state->timestamp after flushing to disk verify_uptodate(): add ce_uptodate(ce) test make USE_NSEC work as expected fix compile error when USE_NSEC is defined check_updates(): effective removal of cache entries marked CE_REMOVE lstat_cache(): print a warning if doing ping-pong between cache types show_patch_diff(): remove a call to fstat() write_entry(): use fstat() instead of lstat() when file is open write_entry(): cleanup of some duplicated code create_directories(): remove some memcpy() and strchr() calls unlink_entry(): introduce schedule_dir_for_removal() lstat_cache(): swap func(length, string) into func(string, length) lstat_cache(): generalise longest_match_lstat_cache() lstat_cache(): small cleanup and optimisation
| * Create USE_ST_TIMESPEC and turn it on for DarwinBrian Gernhardt2009-03-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Not all OSes use st_ctim and st_mtim in their struct stat. In particular, it appears that OS X uses st_*timespec instead. So add a Makefile variable and #define called USE_ST_TIMESPEC to switch the USE_NSEC defines to use st_*timespec. This also turns it on by default for OS X (Darwin) machines. Likely this is a sane default for other BSD kernels as well, but I don't have any to test that assumption on. Signed-off-by: Brian Gernhardt <benji@silverinsanity.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Record ns-timestamps if possible, but do not use it without USE_NSECKjetil Barvik2009-03-071-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Traditionally, the lack of USE_NSEC meant "do not record nor use the nanosecond resolution part of the file timestamps". To avoid problems on filesystems that lose the ns part when the metadata is flushed to the disk and then later read back in, disabling USE_NSEC has been a good idea in general. If you are on a filesystem without such an issue, it does not hurt to read and store them in the cached stat data in the index entries even if your git is compiled without USE_NSEC. The index left with such a version of git can be read by git compiled with USE_NSEC and it can make use of the nanosecond part to optimize the check to see if the path on the filesystem hsa been modified since we last looked at. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | cleanup: add isascii()René Scharfe2009-03-071-0/+2
| | | | | | | | | | | | | | | | | | | | Add a standard definition of isascii() and use it to replace an open coded high-bit test in pretty.c. While we're there, write the ESC char as the more commonly used '\033' instead of as 0x1b to enhance its grepability. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jc/maint-1.6.0-pack-directory'Junio C Hamano2009-02-251-0/+2
|\ \ | |/ |/| | | | | * jc/maint-1.6.0-pack-directory: Make sure objects/pack exists before creating a new pack
| * Make sure objects/pack exists before creating a new packJunio C Hamano2009-02-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a repository created with git older than f49fb35 (git-init-db: create "pack" subdirectory under objects, 2005-06-27), objects/pack/ directory is not created upon initialization. It was Ok because subdirectories are created as needed inside directories init-db creates, and back then, packfiles were recent invention. After the said commit, new codepaths started relying on the presense of objects/pack/ directory in the repository. This was exacerbated with 8b4eb6b (Do not perform cross-directory renames when creating packs, 2008-09-22) that moved the location temporary pack files are created from objects/ directory to objects/pack/ directory, because moving temporary to the final location was done carefully with lazy leading directory creation. Many packfile related operations in such an old repository can fail mysteriously because of this. This commit introduces two helper functions to make things work better. - odb_mkstemp() is a specialized version of mkstemp() to refactor the code and teach it to create leading directories as needed; - odb_pack_keep() refactors the code to create a ".keep" file while create leading directories as needed. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Add is_regex_special()René Scharfe2009-01-171-0/+2
| | | | | | | | | | | | | | | | Add is_regex_special(), a character class macro for chars that have a special meaning in regular expressions. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Change NUL char handling of isspecial()René Scharfe2009-01-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace isspecial() by the new macro is_glob_special(), which is more, well, specialized. The former included the NUL char in its character class, while the letter only included characters that are special to file name globbing. The new name contains underscores because they enhance readability considerably now that it's made up of three words. Renaming the function is necessary to document its changed scope. The call sites of isspecial() are updated to check explicitly for NUL. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | cygwin: Use native Win32 API for statDmitry Potapov2008-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lstat/stat functions in Cygwin are very slow, because they try to emulate some *nix things that Git does not actually need. This patch adds Win32 specific implementation of these functions for Cygwin. This implementation handles most situation directly but in some rare cases it falls back on the implementation provided for Cygwin. This is necessary for two reasons: - Cygwin has its own file hierarchy, so absolute paths used in Cygwin is not suitable to be used Win32 API. cygwin_conv_to_win32_path can not be used because it automatically dereference Cygwin symbol links, also it causes extra syscall. Fortunately Git rarely use absolute paths, so we always use Cygwin implementation for absolute paths. - Support of symbol links. Cygwin stores symbol links as ordinary using one of two possible formats. Therefore, the fast implementation falls back to Cygwin functions if it detects potential use of symbol links. The speed of this implementation should be the same as mingw_lstat for common cases, but it is considerable slower when the specified file name does not exist. Despite all efforts to make the fast implementation as robust as possible, it may not work well for some very rare situations. I am aware only one situation: use Cygwin mount to bind unrelated paths inside repository together. Therefore, the core.ignoreCygwinFSTricks configuration option is provided, which controls whether native or Cygwin version of stat is used. Signed-off-by: Dmitry Potapov <dpotapov@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | usage.c: remove unused functionsNanako Shiraishi2008-09-291-3/+0
| | | | | | | | | | | | | | | | This removes three functions that are not used anywhere. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Acked-by: Lars Hjemli <hjemli@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* | dir.c: Avoid c99 array initializationBrandon Casey2008-08-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following syntax: char foo[] = { [0] = 1, [7] = 2, [15] = 3 }; is a c99 construct which some compilers do not support even though they support other c99 constructs. This construct can be avoided by folding these 'special' test cases into the sane_ctype array and making use of the related infrastructure. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'rs/imap'Junio C Hamano2008-08-191-0/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | * rs/imap: Documentation: Improve documentation for git-imap-send(1) imap-send.c: more style fixes imap-send.c: style fixes git-imap-send: Support SSL git-imap-send: Allow the program to be run from subdirectories of a git tree
| * | git-imap-send: Support SSLRobert Shearman2008-07-251-0/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | Allow SSL to be used when a imaps:// URL is used for the host name. Also, automatically use TLS when not using imaps:// by using the IMAP STARTTLS command, if the server supports it. Tested with Courier and Gimap IMAP servers. Signed-off-by: Robert Shearman <robertshearman@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | compat: introduce on_disk_bytes()Junio C Hamano2008-08-181-0/+6
|/ | | | | | | | | | | | | Some platforms do not have st_blocks member in "struct stat"; mingw already emulates it by rounding it up to closest 512-byte blocks (even though it could overcount when a file has holes). The reason to use the member is only to figure out how many kilobytes the files occupy on-disk, so give a helper function in git-compat-util.h to compute this value. Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
* Merge branch 'mv/merge-in-c'Junio C Hamano2008-07-151-0/+6
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * mv/merge-in-c: reduce_heads(): protect from duplicate input reduce_heads(): thinkofix Add a new test for git-merge-resolve t6021: add a new test for git-merge-resolve Teach merge.log to "git-merge" again Build in merge Fix t7601-merge-pull-config.sh on AIX git-commit-tree: make it usable from other builtins Add new test case to ensure git-merge prepends the custom merge message Add new test case to ensure git-merge reduces octopus parents when possible Introduce reduce_heads() Introduce get_merge_bases_many() Add new test to ensure git-merge handles more than 25 refs. Introduce get_octopus_merge_bases() in commit.c git-fmt-merge-msg: make it usable from other builtins Move read_cache_unmerged() to read-cache.c Add new test to ensure git-merge handles pull.twohead and pull.octopus Move parse-options's skip_prefix() to git-compat-util.h Move commit_list_count() to commit.c Move split_cmdline() to alias.c Conflicts: Makefile parse-options.c
| * Move parse-options's skip_prefix() to git-compat-util.hMiklos Vajna2008-06-301-0/+6
| | | | | | | | | | | | | | | | | | builtin-remote.c and parse-options.c both have a skip_prefix() function, for the same purpose. Move parse-options's one to git-compat-util.h and let builtin-remote use it as well. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Provide fallback definitions of PRIu32 and PRIx32Johannes Sixt2008-07-091-0/+8
| | | | | | | | | | | | | | | | Since 6e1c23442 we make use of these C99 constructs, but this commit did not provide fallbacks for non-C99 systems. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'j6t/mingw'Junio C Hamano2008-07-021-4/+32
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * j6t/mingw: (38 commits) compat/pread.c: Add a forward declaration to fix a warning Windows: Fix ntohl() related warnings about printf formatting Windows: TMP and TEMP environment variables specify a temporary directory. Windows: Make 'git help -a' work. Windows: Work around an oddity when a pipe with no reader is written to. Windows: Make the pager work. When installing, be prepared that template_dir may be relative. Windows: Use a relative default template_dir and ETC_GITCONFIG Windows: Compute the fallback for exec_path from the program invocation. Turn builtin_exec_path into a function. Windows: Use a customized struct stat that also has the st_blocks member. Windows: Add a custom implementation for utime(). Windows: Add a new lstat and fstat implementation based on Win32 API. Windows: Implement a custom spawnve(). Windows: Implement wrappers for gethostbyname(), socket(), and connect(). Windows: Work around incompatible sort and find. Windows: Implement asynchronous functions as threads. Windows: Disambiguate DOS style paths from SSH URLs. Windows: A rudimentary poll() emulation. Windows: Implement start_command(). ...