summaryrefslogtreecommitdiff
path: root/src/fileops.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Merge pull request #251 from nulltoken/fix/msvc-warningsVicent Martí2011-06-151-2/+3
|\ | | | | Fix compilation warnings in MSVC
| * Add mode_t definition in MSVC compat layernulltoken2011-06-151-1/+1
| |
| * Fix compilation warnings in MSVCnulltoken2011-06-121-2/+3
| |
* | blob: Fix git_blob_create_fromfile()nulltoken2011-06-151-1/+1
|/
* Use "__inline" instead of "inline" with MSVCSebastian Schuberth2011-06-101-1/+1
| | | | MSVC supports "inline" only in C++ code, not in C code.
* Prefer to use S_IFLNK instead of _S_IFLNK for consistencySebastian Schuberth2011-06-101-1/+1
|
* windows: Fix Symlink issuesVicent Marti2011-06-081-8/+131
| | | | | | | | 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.
* Merge pull request #243 from jpfender/symlinks2Vicent Martí2011-06-071-0/+8
|\ | | | | Symlinks NEW
| * fileops: Allow differentiation between deep and shallow exists()Jakob Pfender2011-06-071-0/+6
| | | | | | | | | | | | | | | | | | | | 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.
| * index/fileops: Correctly process symbolic linksJakob Pfender2011-06-071-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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().
* | Merge pull request #242 from schu/fix-unused-2Vicent Martí2011-06-071-7/+12
|\ \ | |/ |/| fileops.c: fix unused warning v2
| * fileops.c: fix unused warningschu2011-06-061-7/+12
| | | | | | | | Signed-off-by: schu <schu-github@schulog.org>
* | Fileops: Fixed gitfo_mkdir_recurs so that it proprely works with a path ↵Romain Geissler2011-06-051-2/+5
|/ | | | | | without trailing slash. It used to discard the last directory if the path didn't have a trailing slash.
* Repository: Added some util functions that we'll need to discover repository ↵Romain Geissler2011-06-041-3/+3
| | | | | | | | 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).
* Filebuf: Fixed a TODO in filebuf (real lock in lock_file)Romain Geissler2011-06-031-0/+14
| | | | Added gitfo_creat_locked and gitfo_creat_locked_force
* Fileops: Added gitfo_isfile.Romain Geissler2011-06-031-1/+20
| | | | | | Conflicts: src/fileops.c
* Fileops: Added a fourth argument to the path prettifying functions to use an ↵unknown2011-06-031-8/+18
| | | | | | alternate basepath. Fixed a Windows TO-DO in the prettifying functions.
* Fileops:retrieve_path_root_offset is now named ↵Romain Geissler2011-06-031-15/+15
| | | | gitfo_retrieve_path_root_offset (like other public functions). Added platform specific directory separator definition.
* gitfo_isdir: fix error messageschu2011-05-291-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* fileops: CleanupVicent Marti2011-05-231-93/+2
|
* 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.