summaryrefslogtreecommitdiff
path: root/src/fileops.c
Commit message (Collapse)AuthorAgeFilesLines
...
* fileops.c: Move to new error handling mechanismJakob Pfender2011-05-231-16/+18
|
* Move fileops.c to the new error handlingnulltoken2011-05-141-25/+36
|
* Improve the ODB writing backendVicent Marti2011-03-231-62/+2
| | | | | | | | | 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).
* Fix compilation in MinGWVicent Marti2011-03-231-1/+1
|
* Fix detection of attempt to escape the root directory on Windowsnulltoken2011-03-231-5/+7
|
* Change gitfo_prettify_dir_path() and gitfo_prettify_file_path() behaviornulltoken2011-03-231-19/+41
| | | | Those functions now return prettified rooted path.
* Add failing test for issue 84nulltoken2011-03-231-0/+31
| | | | see https://github.com/libgit2/libgit2/issues#issue/84
* Fix gitfo_mv() behavior when running on Windowsnulltoken2011-03-231-1/+1
| | | | 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.
* I broke your bindingsVicent Marti2011-03-201-4/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix creation of deeply-rooted referencesVicent Marti2011-03-051-17/+33
| | | | | | | 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>
* Add new move function, `gitfo_mv_force`Vicent Marti2011-03-031-1/+24
| | | | | | | Forces a move by creating the folder for the destination file, if it doesn't exist. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Move the path comparison method to fileops.cVicent Marti2011-03-031-0/+19
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Fix file renaming in MinGWVicent Marti2011-02-241-4/+2
| | | | | | | | | | | 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>
* Fix renaming of files in Win32Vicent Marti2011-02-241-0/+12
| | | | | | | | 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>
* Made path prettifying functions return GIT_EINVALIDPATH instead of GIT_ERROR.nulltoken2011-01-291-4/+4
|
* Fixed naming convention related issue.nulltoken2011-01-291-3/+3
|
* Added git_prettify_file_path().nulltoken2011-01-291-0/+27
|
* Optimized git_prettify_dir_path() parsing.nulltoken2011-01-291-21/+18
|
* Fixed a parsing issue in git_prettify_dir_path().nulltoken2011-01-291-26/+39
|
* Small enhancements to git_prettify_dir_path().nulltoken2011-01-201-2/+6
| | | | | - Secured buffer ahead reading. - Guard against potential multiple dot path traversal (cf http://cwe.mitre.org/data/definitions/33.html)
* Merge branch 'dir-path-prettifying' of https://github.com/nulltoken/libgit2Vicent Marti2011-01-191-0/+76
|\
| * Added git_prettify_dir_path().nulltoken2011-01-111-0/+77
| | | | | | | | | | | | | | | | | | | | 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.
* | Revised platform types to use 'best supported' size.Alex Budovski2011-01-111-3/+3
|/ | | | | This will allow graceful migration to 64 bit file sizes and timestamps should git's binary interface be extended to allow this.
* Merge branch 'repo-init' of https://github.com/nulltoken/libgit2 into ↵Vicent Marti2011-01-031-14/+40
|\ | | | | | | nulltoken-repo-init
| * Fixed placement of pointer argument.nulltoken2010-12-261-1/+1
| |
| * Merge branch 'master' into repo-initnulltoken2010-12-231-10/+10
| |\ | |/ |/|
| * Made is_windows_rooted_path() able to cope with awkward but valid relative ↵nulltoken2010-12-211-1/+1
| | | | | | | | | | | | 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:.
| * Wrapped the detection of a Windows rooted path within a conditional ↵nulltoken2010-12-211-3/+19
| | | | | | | | compilation directive.
| * Made gitfo_mkdir_recurs() skip creation of the root of the path if it looks ↵nulltoken2010-12-201-0/+5
| | | | | | | | like a Windows drive.
| * Made gitfo_mkdir_recurs() gracefully recover when a given directory already ↵nulltoken2010-12-201-1/+6
| | | | | | | | exists.
* | Remove git_errnoVicent Marti2010-12-231-10/+10
|/ | | | | | | | | 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>
* Fix issues in repository initializationVicent Marti2010-12-191-6/+23
| | | | | | | Implemented recursive directory creation Fix style issues Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Added a comment reminding that the gitfo_mkdir_recurs() is far from being ↵nulltoken2010-12-171-0/+1
| | | | fully implemented.
* Made gitfo_mkdir_recurs() more tolerant.nulltoken2010-12-171-1/+8
| | | | Doesn't err any more when the directory already exists.
* Added gitfo_mkdir_recurs() placeholder.nulltoken2010-12-171-0/+5
|
* Fix initialization & freeing of inexistent reposVicent Marti2010-12-131-2/+7
| | | | Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Small source code readability improvements.nulltoken2010-12-051-3/+3
| | | | Replaced magic number "0" with GIT_SUCCESS constant wherever it made sense.
* Fix gitfo_isdir() in Win32 systemsVicent Marti2010-11-241-1/+19
| | | | | | Because adhering to the POSIX standards is overrated. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Change git_repository initialization to use a pathVicent Marti2010-11-021-0/+7
| | | | | | | | | | | | 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>
* Add some more (macro) file operation wrappersRamsay Jones2010-04-301-1/+1
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* msvc: Fix some -W4 warningsRamsay Jones2010-01-201-1/+0
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Save the git_file in the gitfo_cache when enabling cachingRamsay Jones2010-01-201-0/+1
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* win32: Use an 64-bit file offset typeRamsay Jones2010-01-201-3/+9
| | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
* Improve the portability of the gitfo_cache code (to 64-bit systems)Ramsay Jones2009-06-051-1/+1
| | | | | | | | | 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>
* Add the git_move_file() functionRamsay Jones2009-06-051-0/+13
| | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
* gitfo_exists: replace call to stat() with access()Ramsay Jones2009-06-051-2/+1
| | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Andreas Ericsson <ae@op5.se>
* win32: Add routines to abstract memory-mapped file functionsRamsay Jones2009-03-201-6/+4
| | | | | | | | | | 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>
* win32: Open or create files in binary modeRamsay Jones2009-03-171-2/+2
| | | | | | | | | | | | 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>
* win32: fixup some headers to improve win32 compilationRamsay Jones2009-03-171-1/+0
| | | | | Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* Fix some (digital-mars) compiler warningsRamsay Jones2009-03-171-1/+1
| | | | | | | | | | | 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>