src/fileops.c


Log

Author Commit Date CI Message
Russell Belfer 97769280 2011-11-30T11:27:15 Use git_buf for path storage instead of stack-based buffers This converts virtually all of the places that allocate GIT_PATH_MAX buffers on the stack for manipulating paths to use git_buf objects instead. The patch is pretty careful not to touch the public API for libgit2, so there are a few places that still use GIT_PATH_MAX. This extends and changes some details of the git_buf implementation to add a couple of extra functions and to make error handling easier. This includes serious alterations to all the path.c functions, and several of the fileops.c ones, too. Also, there are a number of new functions that parallel existing ones except that use a git_buf instead of a stack-based buffer (such as git_config_find_global_r that exists alongsize git_config_find_global). This also modifies the win32 version of p_realpath to allocate whatever buffer size is needed to accommodate the realpath instead of hardcoding a GIT_PATH_MAX limit, but that change needs to be tested still.
Carlos Martín Nieto 0c49ec2d 2011-11-07T19:34:24 Implement p_rename Move the callers of git_futils_mv_atomic to use p_rename. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Vicent Martí 89fb8f02 2011-10-28T19:04:23 Merge pull request #456 from brodie/perm-fixes Create objects, indexes, and directories with the right file permissions
Vicent Marti 3286c408 2011-10-28T14:51:13 global: Properly use `git__` memory wrappers Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
Brodie Rao ce8cd006 2011-09-07T15:32:44 fileops/repository: create (most) directories with 0777 permissions To further match how Git behaves, this change makes most of the directories libgit2 creates in a git repo have a file mode of 0777. Specifically: - Intermediate directories created with git_futils_mkpath2file() have 0777 permissions. This affects odb_loose, reflog, and refs. - The top level folder for bare repos is created with 0777 permissions. - The top level folder for non-bare repos is created with 0755 permissions. - /objects/info/, /objects/pack/, /refs/heads/, and /refs/tags/ are created with 0777 permissions. Additionally, the following changes have been made: - fileops functions that create intermediate directories have grown a new dirmode parameter. The only exception to this is filebuf's lock_file(), which unconditionally creates intermediate directories with 0777 permissions when GIT_FILEBUF_FORCE is set. - The test runner now sets the umask to 0 before running any tests. This ensurses all file mode checks are consistent across systems. - t09-tree.c now does a directory permissions check. I've avoided adding this check to other tests that might reuse existing directories from the prefabricated test repos. Because they're checked into the repo, they have 0755 permissions. - Other assorted directories created by tests have 0777 permissions.
Brodie Rao 33127043 2011-10-14T14:18:02 fileops/posix: replace usage of "int mode" with "mode_t mode" Note: Functions exported from fileops take const mode_t, while the underlying POSIX wrappers take mode_t.
Carlos Martín Nieto dd44887a 2011-09-23T00:00:05 Implment p_access and use it in git_fileutils_exists Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Vicent Marti 87d9869f 2011-09-19T03:34:49 Tabify everything There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
Vicent Marti bb742ede 2011-09-19T01:54:32 Cleanup legal data 1. The license header is technically not valid if it doesn't have a copyright signature. 2. The COPYING file has been updated with the different licenses used in the project. 3. The full GPLv2 header in each file annoys me.
Vicent Marti f978b748 2011-08-30T13:34:14 compat: Move `mkstemp` to the POSIX compat layer
Carlos Martín Nieto c3da9f06 2011-07-21T22:55:20 Add git_futils_readbuffer_updated This extends the git_fuitls_readbuffer function to only read in if the file's modification date is later than the given one. Some code paths want to check a file's modification date in order to decide whether they should read it or not. If they do want to read it, another stat call is done by futils. This function combines these two operations so we avoid one stat call each time we read a new or updated file. The git_futils_readbuffer functions is now a wrapper around the new function. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Vicent Marti 858dba58 2011-07-06T18:08:13 refs: Cleanup reference renaming `git_futils_rmdir_r`: rename, clean up. `git_reference_rename`: cleanup. Do not use 3x4096 buffers on the stack or things will get ugly very fast. We can reuse the same buffer.
nulltoken 1b938a58 2011-07-03T22:27:05 Remove duplicated recursive directory removal related code
nulltoken 1ee5fd90 2011-07-03T14:42:32 Fix windows specific issues - msvc compilation warnings - not released file handle that prevents file removal
schu 42b3a460 2011-06-09T19:51:33 fileops: add git_futils_rmdir_recurs() git_futils_rmdir_recurs() shall remove the given directory and all subdirectories. This happens only if the directories are empty. Signed-off-by: schu <schu-github@schulog.org>
schu e190da78 2011-06-09T18:11:11 fileops: add convenience function is_dot_or_dotdot() Signed-off-by: schu <schu-github@schulog.org>
Vicent Marti eec3fe39 2011-07-05T01:11:33 fileutils: Finish dropping the old `prettify_path`
Vicent Marti 19ac1ed7 2011-07-04T21:33:26 fileops: Fix stat() on directories for W32 The `stat` methods were having issues when called with a trailing slash in Windows platforms. We now use GetFileAttributes() where possible, which doesn't have this restriction.
Vicent Marti 5ad739e8 2011-07-04T20:05:11 fileops: Drop `git_fileops_prettify_path` The old `git_fileops_prettify_path` has been replaced with `git_path_prettify`. This is a much simpler method that uses the OS's `realpath` call to obtain the full path for directories and resolve symlinks. The `realpath` syscall is the original POSIX call in Unix system and an emulated version under Windows using the Windows API.
Vicent Marti f79026b4 2011-07-04T11:43:34 fileops: Cleanup Cleaned up the structure of the whole OS-abstraction layer. fileops.c now contains a set of utility methods for file management used by the library. These are abstractions on top of the original POSIX calls. There's a new file called `posix.c` that contains emulations/reimplementations of all the POSIX calls the library uses. These are prefixed with `p_`. There's a specific posix file for each platform (win32 and unix). All the path-related methods have been moved from `utils.c` to `path.c` and have their own prefix.
Kirill A. Shutemov 932d1baf 2011-06-30T19:52:34 cleanup: remove trailing spaces Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
nulltoken 6ac91dfe 2011-06-29T14:06:18 Hide ".git" directory on Windows upon creation of a non bare repository Directory which name starts with a dot are hidden on Linux platforms. This patch makes libgit2 behaves similarly on Windows.
Vicent Marti ab7941b5 2011-06-28T21:04:59 test: Properly show error messages
schu 28f7869d 2011-06-20T17:25:13 gitfo_read: fix read-loop Signed-off-by: schu <schu-github@schulog.org>
Vicent Marti e35e9fb4 2011-06-18T13:23:19 mingw: Fix compilation
Vicent Marti 02285482 2011-06-17T19:19:30 fileops: Cast the GetProcAddress value
Vicent Marti 9c11bd0a 2011-06-17T19:08:06 fileops: Fix 'GetFinalPathNameByHandleA' in old platforms
Vicent Martí f2bb894e 2011-06-15T12:15:11 Merge pull request #251 from nulltoken/fix/msvc-warnings Fix compilation warnings in MSVC
nulltoken a64bf21b 2011-06-15T16:05:33 blob: Fix git_blob_create_fromfile()
nulltoken 63fadf99 2011-06-15T17:04:11 Add mode_t definition in MSVC compat layer
nulltoken 9e3aa947 2011-06-08T20:39:38 Fix compilation warnings in MSVC
Sebastian Schuberth 3f66c202 2011-06-10T13:57:01 Use "__inline" instead of "inline" with MSVC MSVC supports "inline" only in C++ code, not in C code.
Sebastian Schuberth 535ff384 2011-06-10T13:54:47 Prefer to use S_IFLNK instead of _S_IFLNK for consistency
Vicent Marti ae496955 2011-06-08T17:03:41 windows: Fix Symlink issues Handle Symlinks if they can be handled in Win32. This is not even compiled. Needs review. The lstat implementation is modified from core Git. The readlink implementation is modified from PHP.
Vicent Martí 3a12891f 2011-06-07T07:07:45 Merge pull request #243 from jpfender/symlinks2 Symlinks NEW
Vicent Martí 275c6a0b 2011-06-07T07:03:14 Merge pull request #242 from schu/fix-unused-2 fileops.c: fix unused warning v2
Jakob Pfender fdd1e04c 2011-06-07T14:10:06 fileops: Allow differentiation between deep and shallow exists() When calling gitfo_exists() on a symbolic link, sometimes we need to simply check whether the link exists and sometimes we need to check whether the file pointed to by the symlink exists. Introduce a new function gitfo_shallow_exists that only checks if the link exists and revert gitfo_exists to the original functionality of checking whether the file pointed to by the link exists.
Jakob Pfender 1869b31e 2011-05-25T16:11:57 index/fileops: Correctly process symbolic links gitfo_exists() used to error out if the given file was a symbolic link, due to access() returning an error code. This is not expected behaviour, as gitfo_exists() should only check whether the file itself exists, not its link target if it is a symbolic link. Fix this by calling gitfo_lstat() instead, which is just a wrapper for lstat(). Also fix the same error in index_init_entry().
schu 05b49b02 2011-06-06T12:17:58 fileops.c: fix unused warning Signed-off-by: schu <schu-github@schulog.org>
Romain Geissler a993e4fe 2011-06-05T00:20:35 Fileops: Fixed gitfo_mkdir_recurs so that it proprely works with a path without trailing slash. It used to discard the last directory if the path didn't have a trailing slash.
Romain Geissler f2e6b877 2011-06-03T23:44:38 Repository: Added some util functions that we'll need to discover repository path. retrieve_device returns the file device for a given path (so that we can detect device change while walking through parent directories). abspath returns a canonicalized path, symbolic link free. retrieive_ceiling_directories_offset returns the biggest path offset that path match in the ceiling directory list (so that we can stop at ceiling directories).
Romain Geissler 1549cba9 2011-06-03T21:18:24 Filebuf: Fixed a TODO in filebuf (real lock in lock_file) Added gitfo_creat_locked and gitfo_creat_locked_force
Romain Geissler bc648491 2011-06-03T21:09:14 Fileops: Added gitfo_isfile. Conflicts: src/fileops.c
unknown 26a98ec8 2011-06-03T20:47:56 Fileops: Added a fourth argument to the path prettifying functions to use an alternate basepath. Fixed a Windows TO-DO in the prettifying functions.
Romain Geissler 04fdc10d 2011-06-03T19:26:45 Fileops:retrieve_path_root_offset is now named gitfo_retrieve_path_root_offset (like other public functions). Added platform specific directory separator definition.
schu f5a86fef 2011-05-29T17:44:14 gitfo_isdir: fix error message Signed-off-by: schu <schu-github@schulog.org>
Vicent Marti d3ca89fe 2011-05-23T21:03:01 fileops: Cleanup
Jakob Pfender cc2ac058 2011-05-17T18:02:08 fileops.c: Move to new error handling mechanism
nulltoken 77c3999c 2011-05-14T14:40:56 Move fileops.c to the new error handling
Vicent Marti f6f72d7e 2011-03-23T18:44:53 Improve the ODB writing backend Temporary files when doing streaming writes are now stored inside the Objects folder, to prevent issues when moving files between disks/partitions. Add support for block writes to the ODB again (for those backends that cannot implement streaming).
Vicent Marti 7c80c19e 2011-03-23T01:58:18 Fix compilation in MinGW
nulltoken 3644e98f 2011-03-18T19:10:36 Fix detection of attempt to escape the root directory on Windows
nulltoken c90292ce 2011-03-18T16:56:43 Change gitfo_prettify_dir_path() and gitfo_prettify_file_path() behavior Those functions now return prettified rooted path.
nulltoken 677a3c07 2011-03-15T22:07:01 Add failing test for issue 84 see https://github.com/libgit2/libgit2/issues#issue/84
nulltoken ae6ba7f7 2011-03-22T19:45:01 Fix gitfo_mv() behavior when running on Windows When the system temporary folder is located on a different volume than the working directory into which libgit2 is executing, MoveFileEx() requires an additional flag.
Vicent Marti 72a3fe42 2011-03-18T19:38:49 I broke your bindings Hey. Apologies in advance -- I broke your bindings. This is a major commit that includes a long-overdue redesign of the whole object-database structure. This is expected to be the last major external API redesign of the library until the first non-alpha release. Please get your bindings up to date with these changes. They will be included in the next minor release. Sorry again! Major features include: - Real caching and refcounting on parsed objects - Real caching and refcounting on objects read from the ODB - Streaming writes & reads from the ODB - Single-method writes for all object types - The external API is now partially thread-safe The speed increases are significant in all aspects, specially when reading an object several times from the ODB (revwalking) and when writing big objects to the ODB. Here's a full changelog for the external API: blob.h ------ - Remove `git_blob_new` - Remove `git_blob_set_rawcontent` - Remove `git_blob_set_rawcontent_fromfile` - Rename `git_blob_writefile` -> `git_blob_create_fromfile` - Change `git_blob_create_fromfile`: The `path` argument is now relative to the repository's working dir - Add `git_blob_create_frombuffer` commit.h -------- - Remove `git_commit_new` - Remove `git_commit_add_parent` - Remove `git_commit_set_message` - Remove `git_commit_set_committer` - Remove `git_commit_set_author` - Remove `git_commit_set_tree` - Add `git_commit_create` - Add `git_commit_create_v` - Add `git_commit_create_o` - Add `git_commit_create_ov` tag.h ----- - Remove `git_tag_new` - Remove `git_tag_set_target` - Remove `git_tag_set_name` - Remove `git_tag_set_tagger` - Remove `git_tag_set_message` - Add `git_tag_create` - Add `git_tag_create_o` tree.h ------ - Change `git_tree_entry_2object`: New signature is `(git_object **object_out, git_repository *repo, git_tree_entry *entry)` - Remove `git_tree_new` - Remove `git_tree_add_entry` - Remove `git_tree_remove_entry_byindex` - Remove `git_tree_remove_entry_byname` - Remove `git_tree_clearentries` - Remove `git_tree_entry_set_id` - Remove `git_tree_entry_set_name` - Remove `git_tree_entry_set_attributes` object.h ------------ - Remove `git_object_new - Remove `git_object_write` - Change `git_object_close`: This method is now *mandatory*. Not closing an object causes a memory leak. odb.h ----- - Remove type `git_rawobj` - Remove `git_rawobj_close` - Rename `git_rawobj_hash` -> `git_odb_hash` - Change `git_odb_hash`: New signature is `(git_oid *id, const void *data, size_t len, git_otype type)` - Add type `git_odb_object` - Add `git_odb_object_close` - Change `git_odb_read`: New signature is `(git_odb_object **out, git_odb *db, const git_oid *id)` - Change `git_odb_read_header`: New signature is `(size_t *len_p, git_otype *type_p, git_odb *db, const git_oid *id)` - Remove `git_odb_write` - Add `git_odb_open_wstream` - Add `git_odb_open_rstream` odb_backend.h ------------- - Change type `git_odb_backend`: New internal signatures are as follows int (* read)(void **, size_t *, git_otype *, struct git_odb_backend *, const git_oid *) int (* read_header)(size_t *, git_otype *, struct git_odb_backend *, const git_oid *) int (* writestream)(struct git_odb_stream **, struct git_odb_backend *, size_t, git_otype) int (* readstream)( struct git_odb_stream **, struct git_odb_backend *, const git_oid *) - Add type `git_odb_stream` - Add enum `git_odb_streammode` Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 55ffebe3 2011-03-05T14:34:32 Fix creation of deeply-rooted references Use a new `gitfo_creat_force` that will create the full path to a file before creating it. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 19a30a3f 2011-03-03T19:53:17 Add new move function, `gitfo_mv_force` Forces a move by creating the folder for the destination file, if it doesn't exist. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti ccef1c9d 2011-02-27T22:09:36 Move the path comparison method to fileops.c Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 7360122b 2011-02-24T23:53:40 Fix file renaming in MinGW We now use MoveFileEx, which is not assured to be atomic but works for always (both if the destination exists, or if it doesn't) and is available in MinGW. Since this is a Win32 API call, complaint about lost or overwritten files should be forwarded at Steve Ballmer. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 3eb47c9f 2011-02-24T21:43:08 Fix renaming of files in Win32 The `rename` call doesn't quite work on Win32: expects the destination file to not exist. We're using a native Win32 call in those cases -- that should do the trick. Signed-off-by: Vicent Marti <tanoku@gmail.com>
nulltoken f2c24713 2011-01-26T20:29:06 Made path prettifying functions return GIT_EINVALIDPATH instead of GIT_ERROR.
nulltoken 2e6fd09c 2011-01-25T21:52:24 Fixed naming convention related issue.
nulltoken 618818dc 2011-01-23T16:15:11 Added git_prettify_file_path().
nulltoken 4581c22a 2011-01-22T14:38:47 Optimized git_prettify_dir_path() parsing.
nulltoken ae7ffea9 2011-01-22T14:04:32 Fixed a parsing issue in git_prettify_dir_path().
nulltoken e16c2f6a 2011-01-20T19:51:34 Small enhancements to git_prettify_dir_path(). - Secured buffer ahead reading. - Guard against potential multiple dot path traversal (cf http://cwe.mitre.org/data/definitions/33.html)
Vicent Marti b5e567b9 2011-01-19T17:15:02 Merge branch 'dir-path-prettifying' of https://github.com/nulltoken/libgit2
nulltoken 170d3f2f 2011-01-11T20:12:53 Added git_prettify_dir_path(). Clean up a provided absolute or relative directory path. This prettification relies on basic operations such as coalescing multiple forward slashes into a single slash, removing '.' and './' current directory segments, and removing parent directory whenever '..' is encountered. If not empty, the returned path ends with a forward slash. For instance, this will turn "d1/s1///s2/..//../s3" into "d1/s3/". This only performs a string based analysis of the path. No checks are done to make sure the path actually makes sense from the file system perspective.
Alex Budovski f0bde7fa 2011-01-11T16:07:45 Revised platform types to use 'best supported' size. This will allow graceful migration to 64 bit file sizes and timestamps should git's binary interface be extended to allow this.
Vicent Marti d5f25204 2011-01-03T21:37:14 Merge branch 'repo-init' of https://github.com/nulltoken/libgit2 into nulltoken-repo-init
nulltoken 951d06e4 2010-12-26T17:00:35 Fixed placement of pointer argument.
nulltoken 98e3b298 2010-12-23T09:22:15 Merge branch 'master' into repo-init
Vicent Marti 9f54fe48 2010-12-23T00:15:09 Remove git_errno It was not being used by any methods (only by malloc and calloc), and since it needs to be TLS, it cannot be exported on DLLs on Windows. Burn it with fire. The API always returns error codes! Signed-off-by: Vicent Marti <tanoku@gmail.com>
nulltoken 2c08c3f0 2010-12-21T06:52:07 Made is_windows_rooted_path() able to cope with awkward but valid relative paths such as "C:..\File.txt". Path "C:..\File.txt" refers to a file called File.txt located in the parent directory of the current directory on drive C:.
nulltoken 23a1edbd 2010-12-21T05:43:47 Wrapped the detection of a Windows rooted path within a conditional compilation directive.
nulltoken 2e29957a 2010-12-20T10:56:32 Made gitfo_mkdir_recurs() skip creation of the root of the path if it looks like a Windows drive.
nulltoken 412de9a6 2010-12-20T10:43:23 Made gitfo_mkdir_recurs() gracefully recover when a given directory already exists.
Vicent Marti 40c44d2f 2010-12-19T22:50:20 Fix issues in repository initialization Implemented recursive directory creation Fix style issues Signed-off-by: Vicent Marti <tanoku@gmail.com>
nulltoken d13e7e02 2010-12-17T15:58:30 Added a comment reminding that the gitfo_mkdir_recurs() is far from being fully implemented.
nulltoken f0b2bfe5 2010-12-17T14:24:47 Made gitfo_mkdir_recurs() more tolerant. Doesn't err any more when the directory already exists.
nulltoken 1a5204a7 2010-12-17T10:08:01 Added gitfo_mkdir_recurs() placeholder.
Vicent Marti 1f080e2d 2010-12-13T03:43:56 Fix initialization & freeing of inexistent repos Signed-off-by: Vicent Marti <tanoku@gmail.com>
nulltoken 6f02c3ba 2010-12-05T20:18:56 Small source code readability improvements. Replaced magic number "0" with GIT_SUCCESS constant wherever it made sense.
Vicent Marti 43e380a8 2010-11-23T15:18:53 Fix gitfo_isdir() in Win32 systems Because adhering to the POSIX standards is overrated. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti 6fd195d7 2010-11-02T18:42:42 Change git_repository initialization to use a path The constructor to git_repository is now called 'git_repository_open(path)' and takes a path to a git repository instead of an existing ODB object. Unit tests have been updated accordingly and the two test repositories have been merged into one. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Ramsay Jones 3cc60635 2010-03-05T19:06:28 Add some more (macro) file operation wrappers Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones e8a95256 2010-01-04T18:57:13 msvc: Fix some -W4 warnings Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 803a6b4d 2010-01-03T19:12:05 Save the git_file in the gitfo_cache when enabling caching Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 90d4d2f0 2010-01-11T19:27:50 win32: Use an 64-bit file offset type Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Ramsay Jones 4c9a3973 2009-06-04T17:13:49 Improve the portability of the gitfo_cache code (to 64-bit systems) This supresses some "conversion from 'size_t' to 'unsigned int', possible loss of data" warning messages from the MS Visual C/C++ compiler with -Wp64. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones ca481fc4 2009-06-04T16:46:54 Add the git_move_file() function Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 4d503f88 2009-06-04T16:48:53 gitfo_exists: replace call to stat() with access() Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
Ramsay Jones 79ca2edc 2009-03-20T19:51:48 win32: Add routines to abstract memory-mapped file functions In particular, the git__mmap() and git__munmap() routines provide the interface to platform specific memory-mapped file facilities. We provide implementations for unix and win32, which can be found in their own sub-directories. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 7a6cf815 2009-03-16T17:08:45 win32: Open or create files in binary mode On windows, unless we use the O_BINARY flag in the open() call, the file I/O routines will perform line ending conversion (\r\n => \n on input, \n => \r\n on output). In addition to the performance penalty, most files in the object database are binary and will, therefore, become corrupted by this conversion. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones 840fb8b7 2009-02-18T18:53:48 win32: fixup some headers to improve win32 compilation Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones a9984a4e 2009-02-18T18:52:13 Fix some (digital-mars) compiler warnings In particular, conditional expressions which contain an assignment statement, where the expression type is not explicitly made to be boolean, elicits the following message: warning 2: possible unintended assignment Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Ramsay Jones fc3c3a20 2009-02-18T18:50:36 Avoid using a gcc compiler language extension In particular, using pointer arithmetic on void pointers, despite being quite useful, is not legal in standard C. Avoiding non-standard C constructs will help in porting the library to other compilers/platforms. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 20e7f426 2009-01-03T00:36:10 Add a simple mmap wrapper for cross-platform mmap usage Win32 has a variant of mmap that is harder to use than POSIX, but to run natively and efficiently on Win32 we need some form of it. gitfo_map_ro() provides a basic mmap function for use in locations where we need read-only random data access to large ranges of a file, such as a pack-*.idx. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce 7350e633 2008-12-31T16:07:38 Define gitfo_exists to determine file presence When scanning the pack directory we need to see if the path name is present for ".idx" when we discover a ".pack" file. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>