summaryrefslogtreecommitdiff
path: root/src/path.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #3307 from libgit2/cmn/submodule-backslashEdward Thomson2015-07-241-0/+16
|\ | | | | Normalize submodule urls before looking at them
| * submodule, path: extract slash conversioncmn/submodule-backslashCarlos Martín Nieto2015-07-131-0/+16
| | | | | | | | Extract the backslash-to-slash conversion into a helper function.
* | Make libgit2 work on Windows Vista againSven Strickroth2015-07-221-3/+8
|/ | | | | | (fixes issue #3316) Signed-off-by: Sven Strickroth <email@cs-ware.de>
* buffer: don't allow growing borrowed buffersCarlos Martín Nieto2015-06-241-2/+2
| | | | | | | | | | When we don't own a buffer (asize=0) we currently allow the usage of grow to copy the memory into a buffer we do own. This muddles the meaning of grow, and lets us be a bit cavalier with ownership semantics. Don't allow this any more. Usage of grow should be restricted to buffers which we know own their own memory. If unsure, we must not attempt to modify it.
* Fixed Xcode 6.1 build warningsPierre-Olivier Latour2015-06-171-1/+1
|
* Fixed Xcode 6.1 build warningsPierre-Olivier Latour2015-06-151-2/+2
|
* path: remove unnecessary readdir_r usagecmn/readdirCarlos Martín Nieto2015-06-151-4/+3
| | | | | | Arguably all uses of readdir_r are unnecessary, but in this case especially so, as the directory handle only exists within this function, so we don't race with anybody.
* Fix memory leak on windows in diriter.Jeff Hostetler2015-06-121-0/+2
|
* Merge pull request #3165 from ethomson/downcaseCarlos Martín Nieto2015-06-081-1/+1
|\ | | | | Downcase
| * git__tolower: a tolower() that isn't dumbEdward Thomson2015-05-291-1/+1
| | | | | | | | | | | | | | | | Some brain damaged tolower() implementations appear to want to take the locale into account, and this may require taking some insanely aggressive lock on the locale and slowing down what should be the most trivial of trivial calls for people who just want to downcase ASCII.
* | path: error out if the callback returns an errorcmn/foreach-cancel-looseCarlos Martín Nieto2015-06-061-2/+4
|/ | | | | | | When the callback returns an error, we should stop immediately. This broke when trying to make sure we pass specific errors up the chain. This broke cancelling out of the loose backend's foreach.
* path: don't let direach overwrite the callback's error messageCarlos Martín Nieto2015-05-151-1/+3
| | | | | | | | | | This function deals with functions doing IO which means the amount of errors that can happen is quit large. It does not help if it always ovewrites the underlying error message with a less understandable version of "something went wrong". Instead, only use this generic message if there was no error set by the callback.
* diriter: actually use iconv on macEdward Thomson2015-05-011-2/+3
|
* git_buf_put_w: introduce utf16->utf8 conversionEdward Thomson2015-05-011-23/+4
|
* git_path_diriter: use FindFirstFile in win32Edward Thomson2015-05-011-2/+186
| | | | | | | Using FindFirstFile and FindNextFile in win32 allows us to use the directory information that is returned, instead of us having to get the file attributes all over again, which is a distinct cost savings on win32.
* git_path_diriter: next shouldn't take path ptrEdward Thomson2015-05-011-12/+15
| | | | | | | | The _next method shouldn't take a path pointer (and a path_len pointer) as 100% of current users use the full path and ignore the filename. Plus let's add some docs and a unit test.
* git_path_dirload_with_stat: moved to fs_iteratorEdward Thomson2015-05-011-127/+0
|
* git_path_dirload_with_stat: use git_path_diriterEdward Thomson2015-05-011-123/+51
|
* git_path_dirload: use git_path_diriterEdward Thomson2015-05-011-75/+112
|
* git_path: introduce 'git_path_diriter'Edward Thomson2015-05-011-0/+130
| | | | | Introduce a new `git_path_diriter` that can iterate directories efficiently for each platform.
* ISO C90 forbids mixed declarations and codeJozef Matula2015-04-081-4/+4
| | | | | GIT_UNUSED() macro generates code therefore it should be used after variable declarations.
* repository: Introduce "reserved names"Edward Thomson2015-02-271-19/+20
| | | | | | | A repository can have multiple "reserved names" now, not just a single "short name" for the repository folder itself. Refactor to include a git_repository__reserved_names that returns all the reserved names for a repository.
* Make our overflow check look more like gcc/clang'sEdward Thomson2015-02-131-25/+18
| | | | | | | | | Make our overflow checking look more like gcc and clang's, so that we can substitute it out with the compiler instrinsics on platforms that support it. This means dropping the ability to pass `NULL` as an out parameter. As a result, the macros also get updated to reflect this as well.
* allocations: test for overflow of requested sizeEdward Thomson2015-02-121-14/+50
| | | | | Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.
* git_path_join_unrooted: return base lenEdward Thomson2015-01-201-11/+16
| | | | | | | The documentation for `git_path_join_unrooted` states that the base length will be returned, so that consumers like checkout know where to start creating directories instead of always creating directories at the directory root.
* COM0 is a valid path, although Windows Explorer does not allow to create thisLinquize2014-12-191-1/+1
|
* Introduce core.protectHFS and core.protectNTFSEdward Thomson2014-12-171-31/+82
| | | | | | Validate HFS ignored char ".git" paths when `core.protectHFS` is specified. Validate NTFS invalid ".git" paths when `core.protectNTFS` is specified.
* path: Use UTF8 iteration for HFS charsVicent Marti2014-12-161-81/+45
|
* checkout: disallow bad paths on HFSEdward Thomson2014-12-161-0/+93
| | | | | | | | HFS filesystems ignore some characters like U+200C. When these characters are included in a path, they will be ignored for the purposes of comparison with other paths. Thus, if you have a ".git" folder, a folder of ".git<U+200C>" will also match. Protect our ".git" folder by ensuring that ".git<U+200C>" and friends do not match it.
* checkout: disallow bad paths on win32Edward Thomson2014-12-161-0/+148
| | | | | | | | | | | | | | | Disallow: 1. paths with trailing dot 2. paths with trailing space 3. paths with trailing colon 4. paths that are 8.3 short names of .git folders ("GIT~1") 5. paths that are reserved path names (COM1, LPT1, etc). 6. paths with reserved DOS characters (colons, asterisks, etc) These paths would (without \\?\ syntax) be elided to other paths - for example, ".git." would be written as ".git". As a result, writing these paths literally (using \\?\ syntax) makes them hard to operate with from the shell, Windows Explorer or other tools. Disallow these.
* 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.