summaryrefslogtreecommitdiff
path: root/src/fileops.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | Discriminate path-specific and general UTF-X conversionsBen Straub2013-08-081-1/+1
| |
* | Rename git_win_str_utf* to git_win32_path_utf*Ben Straub2013-08-071-1/+1
| |
* | Add typedefs for win32 utf-8 and utf-16 buffersBen Straub2013-08-071-2/+2
| | | | | | | | ...and normalize the signatures of the two conversion functions.
* | Split UTF-16 and UTF-8 buffer sizes for win32Ben Straub2013-08-051-2/+2
|/ | | | | Also fixed up call-sites to use the correct buffer sizes, especially when converting to utf-8.
* Fix possible double closeSven Strickroth2013-07-271-0/+1
| | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Fix warning message about mismatched typesRussell Belfer2013-07-221-5/+3
|
* preload configuration pathsEdward Thomson2013-07-111-0/+14
|
* Revert "Work around reparse point stat issues"Sven Strickroth2013-06-251-2/+1
| | | | This reverts commit 32c12ea6a9cafd76a746af2e2be9366c95752f5b.
* Merge pull request #1670 from arrbee/open-cloexecVicent Martí2013-06-241-2/+4
|\ | | | | Add O_CLOEXEC to open calls
| * Add O_CLOEXEC to open callsRussell Belfer2013-06-221-2/+4
| |
* | Work around reparse point stat issuesRussell Belfer2013-06-241-1/+2
|/ | | | | | | | | In theory, p_stat should never return an S_ISLNK result, but due to the current implementation on Windows with mount points it is possible that it will. For now, work around that by allowing a link in the path to a directory being created. If it is really a problem, then the issue will be caught on the next iteration of the loop, but typically this will be the right thing to do.
* fileops: fix invalid readyorah2013-06-141-1/+1
|
* Make mkdir early exit cases clearerRussell Belfer2013-06-051-35/+30
| | | | | | | | | | | | There are two places where git_futils_mkdir should exit early or at least do less. The first is when using GIT_MKDIR_SKIP_LAST and having that flag leave no directory left to create; it was being handled previously, but the behavior was subtle. Now I put in a clear explicit check that exits early in that case. The second is when there is no directory to create, but there is a valid path that should be verified. I shifted the logic a bit so we'll be better about not entering the loop than that happens.
* Simplify git_futils_mkdirRussell Belfer2013-06-051-46/+36
| | | | | This routine was (is) pretty complicated, but given the recent changes, it seemed like it could be simplified a bit.
* I'm a dickVicent Marti2013-06-051-7/+7
|
* Ensure git_futils_mkdir won't mkdir rootRussell Belfer2013-06-051-13/+14
| | | | | | | This makes sure that git_futils_mkdir always skips over the root directory at a minimum, even on platforms where the root is not simply '/'. Also, this removes the GIT_WIN32 ifdef in favor of making EACCES as a potentially recoverable error on all platforms.
* Allow creation of directories under the volume root in Win32Jameson Miller2013-06-051-5/+13
| | | | | | | | | | | We ran into an issue where cloning a repository to a folder directly underneath the root of a volume (e.g. 'd:\libgit2') would fail with an access denied error. This was traced down to a call to make a directory that is the root (e.g. 'd:') could return an error indicated access denied instead of an error indicating the path already exists. This change now handles the access denied error on Win32 and checks for the existence of the folder.
* Add more diff rename detection testsRussell Belfer2013-05-201-0/+26
| | | | | | | | | | This adds a bunch more rename detection tests including checks vs the working directory, the new exact match options, some more whitespace variants, etc. This also adds a git_futils_writebuffer helper function and uses it in checkout. This is mainly added because I wanted an easy way to write out a git_buf to disk inside my test code.
* Merge pull request #1526 from arrbee/cleanup-error-return-without-msgVicent Martí2013-05-061-1/+3
|\ | | | | Make sure error messages are set for most error returns
| * Report stat error when checking if file modifiedRussell Belfer2013-05-011-1/+3
| |
* | allow checkout to proceed when a dir to be removed is in use (win32)Edward Thomson2013-05-031-2/+2
|/
* Merge pull request #1417 from arrbee/opts-for-pathsVicent Martí2013-03-181-49/+160
|\ | | | | Implement opts interface for global/system file search paths
| * Fixes and cleanupsRussell Belfer2013-03-181-3/+3
| | | | | | | | | | Get rid of some dead code, tighten things up a bit, and fix a bug with core::env test.
| * Switch search paths to classic delimited stringsRussell Belfer2013-03-181-38/+88
| | | | | | | | | | | | | | | | | | | | | | | | This switches the APIs for setting and getting the global/system search paths from using git_strarray to using a simple string with GIT_PATH_LIST_SEPARATOR delimited paths, just as the environment PATH variable would contain. This makes it simpler to get and set the value. I also added code to expand "$PATH" when setting a new value to embed the old value of the path. This means that I no longer require separate actions to PREPEND to the value.
| * Implement global/system file search pathsRussell Belfer2013-03-151-50/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal of this work is to expose the search logic for "global", "system", and "xdg" files through the git_libgit2_opts() interface. Behind the scenes, I changed the logic for finding files to have a notion of a git_strarray that represents a search path and to store a separate search path for each of the three tiers of config file. For each tier, I implemented a function to initialize it to default values (generally based on environment variables), and then general interfaces to get it, set it, reset it, and prepend new directories to it. Next, I exposed these interfaces through the git_libgit2_opts interface, reusing the GIT_CONFIG_LEVEL_SYSTEM, etc., constants for the user to control which search path they were modifying. There are alternative designs for the opts interface / argument ordering, so I'm putting this phase out for discussion. Additionally, I ended up doing a little bit of clean up regarding attr.h and attr_file.h, adding a new attrcache.h so the other two files wouldn't have to be included in so many places.
* | Several warnings detected by static code analyzer fixedArkadiy Shapkin2013-03-181-1/+1
|/ | | | | | | Implicit type conversion argument of function to size_t type Suspicious sequence of types castings: size_t -> int -> size_t Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)' Unsigned type is never < 0
* Merge pull request #1369 from arrbee/repo-init-template-hooksVicent Martí2013-03-051-42/+80
|\ | | | | More tests (and fixes) for initializing repo from template
| * Make mode handling during init more like gitRussell Belfer2013-02-271-13/+6
| | | | | | | | | | | | | | | | | | | | | | When creating files, instead of actually using GIT_FILEMODE_BLOB and the other various constants that happen to correspond to mode values, apparently I should be just using 0666 and 0777, and relying on the umask to clear bits and make the value sane. This fixes the rules for copying a template directory and fixes the checks to match that new behavior. (Further changes to the checkout logic to follow separately.)
| * Fix initialization of repo directoriesRussell Belfer2013-02-261-39/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When PR #1359 removed the hooks from the test resources/template directory, it made me realize that the tests for git_repository_init_ext using templates must be pretty shabby because we could not have been testing if the hooks were getting created correctly. So, this started with me recreating a couple of hooks, including a sample and symlink, and adding tests that they got created correctly in the various circumstances, including with the SHARED modes, etc. Unfortunately this uncovered some issues with how directories and symlinks were copied and chmod'ed. Also, there was a FIXME in the code related to the chmod behavior as well. Going back over the directory creation logic for setting up a repository, I found it was a little difficult to read and could result in creating and/or chmod'ing directories that the user almost certainly didn't intend. So that let to this work which makes repo initialization much more careful (and hopefully easier to follow). It required a couple of extensions / changes to core fileops utilities, but I also think those are for the better, at least for git_futils_cp_r in terms of being careful about what actions it takes.
* | Clone should not delete directories it did not createJameson Miller2013-03-011-0/+35
|/
* Portability fixes for SolarisPhilip Kelley2013-02-221-10/+28
|
* Try harder to find global config fileJameson Miller2013-02-011-6/+0
|
* Resolve crash with diff against empty fileRussell Belfer2013-01-081-1/+1
| | | | | | | | | | | It is not legal inside our `p_mmap` function to mmap a zero length file. This adds a test that exercises that case inside diff and fixes the code path where we would try to do that. The fix turns out not to be a lot of code since our default file content is already initialized to "" which works in this case. Fixes #1210
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* More checkout improvementsRussell Belfer2013-01-041-6/+12
| | | | | | | This flips checkout back to be driven off the changes between the baseline and the target trees. This reinstates the complex code for tracking the contents of the working directory, but overall, I think the resulting logic is easier to follow.
* Add POSIX compat lstat() variant for win32Russell Belfer2012-11-141-2/+2
| | | | | | | | | | The existing p_lstat implementation on win32 is not quite POSIX compliant when setting errno to ENOTDIR. This adds an option to make is be compliant so that code (such as checkout) that cares to have separate behavior for ENOTDIR can use it portably. This also contains a couple of other minor cleanups in the posix_w32.c implementations to avoid unnecessary work.
* Rework checkout with new strategy optionsRussell Belfer2012-11-091-3/+45
| | | | | | | | | | | | | | | | | | This is a major reworking of checkout strategy options. The checkout code is now sensitive to the contents of the HEAD tree and the new options allow you to update the working tree so that it will match the index content only when it previously matched the contents of the HEAD. This allows you to, for example, to distinguish between removing files that are in the HEAD but not in the index, vs just removing all untracked files. Because of various corner cases that arise, etc., this required some additional capabilities in rmdir and other utility functions. This includes the beginnings of an implementation of code to read a partial tree into the index based on a pathspec, but that is not enabled because of the possibility of creating conflicting index entries.
* Extensions to rmdir and mkdir utilitiesRussell Belfer2012-11-091-36/+100
| | | | | | | | | | | * Rework GIT_DIRREMOVAL values to GIT_RMDIR flags, allowing combinations of flags * Add GIT_RMDIR_EMPTY_PARENTS flag to remove parent dirs that are left empty after removal * Add GIT_MKDIR_VERIFY_DIR to give an error if item is a file, not a dir (previously an EEXISTS error was ignored, even for files) and enable this flag for git_futils_mkpath2file call * Improve accuracy of error messages from git_futils_mkdir
* I LIKE THESE NAMESVicent Marti2012-10-311-4/+4
|
* Better naming for file timestamp/size checkerRussell Belfer2012-10-311-10/+20
|
* Add git_config_refresh() API to reload configRussell Belfer2012-10-301-5/+40
| | | | | | | | | | | | | | | | | | | | This adds a new API that allows users to reload the config if the file has changed on disk. A new config callback function to refresh the config was added. The modified time and file size are used to test if the file needs to be reloaded (and are now stored in the disk backend object). In writing tests, just using mtime was a problem / race, so I wanted to check file size as well. To support that, I extended `git_futils_readbuffer_updated` to optionally check file size in addition to mtime, and I added a new function `git_filebuf_stats` to fetch the mtime and size for an open filebuf (so that the config could be easily refreshed after a write). Lastly, I moved some similar file checking code for attributes into filebuf. It is still only being used for attrs, but it seems potentially reusable, so I thought I'd move it over.
* Fix env variable tests with new Win32 path rulesRussell Belfer2012-10-191-30/+25
| | | | | | | | The new Win32 global path search was not working with the environment variable tests. But when I fixed the test, the new codes use of getenv() was causing more failures (presumably because of caching on Windows ???). This fixes the global file lookup to always go directly to the Win32 API in a predictable way.
* Merge pull request #968 from arrbee/diff-support-typechangeRussell Belfer2012-10-171-10/+15
|\ | | | | Support TYPECHANGE records in status and adjust checkout accordingly
| * Add complex checkout test and then fix checkoutRussell Belfer2012-10-091-10/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This started as a complex new test for checkout going through the "typechanges" test repository, but that revealed numerous issues with checkout, including: * complete failure with submodules * failure to create blobs with exec bits * problems when replacing a tree with a blob because the tree "example/" sorts after the blob "example" so the delete was being processed after the single file blob was created This fixes most of those problems and includes a number of other minor changes that made it easier to do that, including improving the TYPECHANGE support in diff/status, etc.
* | test: Don't be so picky with failed lookupsVicent Marti2012-10-161-3/+3
| | | | | | | | Not found means not found, and the other way around.
* | Move win32 specific stuff to win32/findfile.cSven Strickroth2012-10-021-145/+3
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | Optimized win32_nextpathSven Strickroth2012-10-021-42/+10
| | | | | | | | | | | | | | Based on a suggestion by Russell Belfer. Signed-off-by: Sven Strickroth <email@cs-ware.de> Signed-off-by: Russell Belfer <rb@github.com>
* | Silence MinGW warningsSven Strickroth2012-09-291-2/+2
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | Added win32_ prefix for Win32-only methodsSven Strickroth2012-09-291-6/+6
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | Make it compile with MinGW on WindowsSven Strickroth2012-09-291-19/+7
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>