summaryrefslogtreecommitdiff
path: root/src/path.c
Commit message (Collapse)AuthorAgeFilesLines
* iterator: free paths when skipping themEdward Thomson2014-10-261-1/+4
|
* is_empty_dir (wi32): cope with empty mount pointsEdward Thomson2014-10-131-16/+26
| | | | | | | | | | | | FindFirstFile will fail with INVALID_HANDLE_VALUE if there are no children to the given path, which can happen if the given path is a file (and obviously has no children) or if the given path is an empty mount point. (Most directories have at least directory entries '.' and '..', but ridiculously another volume mounted in another drive letter's path space do not, and thus have nothing to enumerate.) If FindFirstFile fails, check if this is a directory-like thing (a mount point).
* path: fix invalid accessErdur2014-09-301-1/+4
|
* Merge pull request #2571 from libgit2/vmg/walk-up-pathVicent Marti2014-09-171-2/+17
|\ | | | | Fix `git_path_walk_up` to work with non-rooted paths
| * path: Fix `git_path_walk_up` to work with non-rooted pathsThe rugged tests are fragile2014-09-171-2/+17
| |
* | Merge pull request #2572 from cirosantilli/factor-voidVicent Marti2014-09-171-2/+2
|\ \ | |/ |/| Replace void casts with GIT_UNUSED.
| * Replace void casts with GIT_UNUSED.Ciro Santilli2014-09-171-2/+2
| |
* | Clean up some leaks in the test suiteCarlos Martín Nieto2014-09-171-1/+3
|/
* Introduce git_path_make_relativeEdward Thomson2014-09-021-0/+55
|
* Don't report status on named pipesRussell Belfer2014-08-081-11/+12
| | | | | Git skips entries in directories that are not S_ISDIR, S_ISREG, or S_ISLNK, so let's make libgit2 do the same thing.
* Merge remote-tracking branch 'origin/master' into ↵Alan Rogers2014-07-221-29/+25
|\ | | | | | | fix-git-status-list-new-unreadable-folder
| * Handle local file:/// paths on WindowsEdward Thomson2014-07-111-29/+25
| | | | | | | | | | Windows can't handle a path like `/c:/foo`; when turning file:/// URIs into local paths, we must strip the leading slash.
* | Merge remote-tracking branch 'origin/development' into ↵Alan Rogers2014-06-041-0/+18
|\ \ | |/ | | | | | | | | | | fix-git-status-list-new-unreadable-folder Conflicts: include/git2/diff.h
| * clone: re-use the local transport's path resolutioncmn/path-to-pathCarlos Martín Nieto2014-06-031-0/+18
| | | | | | | | | | | | Whe already worked out the kinks with the function used in the local transport. Expose it and make use of it in the local clone method instead of trying to work it out again.
* | Clear out the struct.Alan Rogers2014-06-041-0/+1
| |
* | Return GIT_FILEMODE_UNREADABLE for files that fail to stat.Alan Rogers2014-05-211-2/+9
| |
* | Rename GIT_ENOACCESS -> GIT_EUNREADABLEAlan Rogers2014-05-201-7/+4
| |
* | Skip unreadable files for now.Alan Rogers2014-05-151-2/+1
| |
* | Return a specific error for EACCES.Alan Rogers2014-05-151-0/+4
|/
* Pass unconverted data when iconv doesn't like itRussell Belfer2014-05-081-1/+62
| | | | | | | | | | | | | | When using Iconv to convert unicode data and iconv doesn't like the source data (because it thinks that it's not actual UTF-8), instead of stopping the operation, just use the unconverted data. This will generally do the right thing on the filesystem, since that is the source of the non-UTF-8 path data anyhow. This adds some tests for creating and looking up branches with messy Unicode names. Also, this takes the helper function that was previously internal to `git_repository_init` and makes it into `git_path_does_fs_decompose_unicode` which is a useful in tests to understand what the expected results should be.
* React to feedback for UTF-8 <-> WCHAR and reparse workPhilip Kelley2014-04-231-1/+1
|
* Win32: UTF-8 <-> WCHAR conversion overhaulPhilip Kelley2014-04-191-25/+26
|
* Pop ignore only if whole relative path matchesRussell Belfer2014-04-181-1/+1
| | | | | | | | | | | When traversing the directory structure, the iterator pushes and pops ignore files using a vector. Some directories don't have ignore files, so it uses a path comparison to decide when it is right to actually pop the last ignore file. This was only comparing directory suffixes, though, so a subdirectory with the same name as a parent could result in the parent's .gitignore being popped off the list ignores too early. This changes the logic to compare the entire relative path of the ignore file.
* vmg is always rightRussell Belfer2014-04-071-1/+1
|
* Fix bug with multiple iconv conversions in one dirRussell Belfer2014-04-071-0/+2
| | | | | | | | The internal buffer in the `git_path_iconv_t` structure was not being reset before the calls to `iconv` were made to convert data, so if there were multiple decomposed Unicode paths in a single directory, paths after the first one were being appended to the first instead of treated as independent data.
* Update behavior for untracked sub-reposRussell Belfer2014-03-251-9/+2
| | | | | | | | | | | When a directory containing a .git directory (or even just a plain gitlink) was found, libgit2 was going out of its way to treat it specially. This seemed like it was necessary because the diff code was not originally emulating Git's behavior for untracked directories correctly (i.e. scanning for ignored vs untracked items inside). Now that libgit2 diff mimics Git's untracked directory behavior, the special handling for contained Git repos is actually incorrect and this commit rips it out.
* refdb: catch a directory disappearingCarlos Martín Nieto2014-03-051-0/+3
| | | | | | | | If a directory disappears between the time we look up the entries of its parent and the time when we go to look at it, we should ignore the error and move forward. This fixes #2046.
* Remove now-duplicated stdarg.h includeEdward Thomson2014-02-241-1/+0
|
* Fix up some valgrind leaks and warningsRussell Belfer2013-12-111-1/+1
|
* One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-2/+2
|
* Some callback error check style cleanupsRussell Belfer2013-12-111-4/+9
| | | | I find this easier to read...
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
* Improve GIT_EUSER handlingRussell Belfer2013-12-111-4/+7
| | | | | | | | | | | This adds giterr_user_cancel to return GIT_EUSER and clear any error message that is sitting around. As a result of using that in places, we need to be more thorough with capturing errors that happen inside a callback when used internally. To help with that, this also adds giterr_capture and giterr_restore so that when we internally use a foreach-type function that clears errors and converts them to GIT_EUSER, it is easier to restore not just the return value, but the actual error message text.
* iconv: Do not fake an API when iconv is not availableVicent Marti2013-11-011-2/+28
|
* More filemode cleanups for FAT on MacOSRussell Belfer2013-10-081-7/+26
| | | | | | | | | | | | | | | | | | | | | | This cleans up some additional issues. The main change is that on a filesystem that doesn't support mode bits, libgit2 will now create new blobs with GIT_FILEMODE_BLOB always instead of being at the mercy to the filesystem driver to report executable or not. This means that if "core.filemode" lies and claims that filemode is not supported, then we will ignore the executable bit from the filesystem. Previously we would have allowed it. This adds an option to the new git_repository_reset_filesystem to recurse through submodules if desired. There may be other types of APIs that would like a "recurse submodules" option, but this one is particularly useful. This also has a number of cleanups, etc., for related things including trying to give better error messages when problems come up from the filesystem. For example, the FAT filesystem driver on MacOS appears to return errno EINVAL if you attempt to write a filename with invalid UTF-8 in it. We try to capture that with a better error message now.
* Wrap iconv stuff and write testsRussell Belfer2013-10-031-58/+47
| | | | | | | | This adds a simple wrapper around the iconv APIs and uses it instead of the old code that was inlining the iconv stuff. This makes it possible for me to test the iconv logic in isolation. A "no iconv" version of the API was defined with macros so that I could have fewer ifdefs in the code itself.
* Simplify git_path_is_empty_dir implementationRussell Belfer2013-10-031-28/+23
| | | | | | | This simplifies git_path_is_empty_dir on both Windows (getting rid of git_buf allocation inside the function) and other platforms (by just using git_path_direach), and adds tests for the function, and uses the function to simplify some existing tests.
* Initial iconv hookup for precomposed unicodeRussell Belfer2013-10-031-47/+139
| | | | | | | | | | | | | | | | | | | | This hooks up git_path_direach and git_path_dirload so that they will take a flag indicating if directory entry names should be tested and converted from decomposed unicode to precomposed form. This code will only come into play on the Apple platform and even then, only when certain types of filesystems are used. This involved adding a flag to these functions which involved changing a lot of places in the code. This was an opportunity to do a bit of code cleanup here and there, for example, getting rid of the git_futils_cleanupdir_r function in favor of a simple flag to git_futils_rmdir_r to not remove the top level entry. That ended up adding depth tracking during rmdir_r which led to a safety check for infinite directory recursion. Yay. This hasn't actually been tested on the Mac filesystems where the issue occurs. I still need to get test environment for that.
* Put hooks in place for precompose in dirload fnRussell Belfer2013-10-031-3/+11
| | | | | | This doesn't actual do string precompose but it puts the hooks in place into the iterators and the git_path_dirload function so that the actual precompose work is ready to go.
* Ignore files that disappear while iteratingEdward Thomson2013-09-241-1/+9
| | | | | | On occasion, files can disappear while we're iterating the filesystem, between calls to readdir and stat. Let's pretend those didn't exist in the first place.
* Merge git_buf and git_bufferRussell Belfer2013-09-171-1/+1
| | | | | | | | | | | This makes the git_buf struct that was used internally into an externally available structure and eliminates the git_buffer. As part of that, some of the special cases that arose with the externally used git_buffer were blended into the git_buf, such as being careful about git_buf objects that may have a NULL ptr and allowing for bufs with a valid ptr and size but zero asize as a way of referring to externally owned data.
* path: Make direach() return EUSER on callback errornulltoken2013-09-101-2/+2
|
* Fix resolving relative windows network pathsRussell Belfer2013-09-031-2/+2
|
* path: properly resolve relative pathsNikolai Vladimirov2013-09-031-5/+26
|
* Merge pull request #1767 from libgit2/win32-bigger-utf8-bufferVicent Martí2013-08-131-3/+4
|\ | | | | Bigger buffer for utf-8 parsing in win32
| * Minor win32 fixes and improvementsRussell Belfer2013-08-131-0/+2
| | | | | | | | | | | | | | | | This is just a bunch of small fixes that I noticed while looking at the UTF8 and UTF16 path stuff. It fixes a slowdown in looking for an empty directory (not exiting loop asap), makes the dir name in the git__DIR structure be a GIT_FLEX_ARRAY to save an allocation, and fixes some slightly odd assumptions in the cl_getenv helper.
| * Rename git__win32_path fns to git_win32_pathRussell Belfer2013-08-131-1/+1
| |
| * windows: Require orderVicent Marti2013-08-131-1/+0
| |
| * windows: Path conversion with better semanticsVicent Marti2013-08-131-2/+2
| |
| * Discriminate path-specific and general UTF-X conversionsBen Straub2013-08-081-1/+1
| |