summaryrefslogtreecommitdiff
path: root/src/fileops.c
Commit message (Collapse)AuthorAgeFilesLines
...
* 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>
* | Move code to find msysgit path using registry to own methodSven Strickroth2012-09-291-8/+14
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | Find git installations based on %PATH%Sven Strickroth2012-09-291-0/+100
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | Implemented the full msysgit fallback chainSven Strickroth2012-09-251-5/+14
| | | | | | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | Automatically detect msysgit installation pathSven Strickroth2012-09-241-3/+27
| | | | | | | | | | | | | | | | Do not hardcode the installation path of msysgit, but read installation path from registry. Also "%PROGRAMFILES%\Git\etc" won't work on x64 systems with 64-bit libgit2, because msysgit is x86 only and located in "%ProgramFiles(x86)%\Git\etc". Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | Calculate the Windows user profile directory the same way as msysgitSven Strickroth2012-09-241-1/+1
| | | | | | | | | | | | | | | | On most systems %USERPROFILE% is the same as %HOMEDRIVE%\%HOMEPATH%, however, for windows machines in an AD or domain environment this might be different and %HOMEDRIVE%\%HOMEPATH% seems to be better. Signed-off-by: Sven Strickroth <email@cs-ware.de>
* | Honor %HOME% on windowsSven Strickroth2012-09-241-2/+11
|/ | | | | | | Use %HOME% before trying to figure out the windows user directory. Users might set this as they are used on *nix systems. Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Properly handle p_readsVicent Marti2012-09-111-1/+1
|
* Fix diff binary file detectionRussell Belfer2012-09-111-23/+9
| | | | | | | | | | | In the process of adding tests for the max file size threshold (which treats files over a certain size as binary) there seem to be a number of problems in the new code with detecting binaries. This should fix those up, as well as add a test for the file size threshold stuff. Also, this un-deprecates `GIT_DIFF_LINE_ADD_EOFNL`, since I finally found a legitimate situation where it would be returned.
* Implement filters for status/diff blobsRussell Belfer2012-09-061-22/+40
| | | | | | | | | | | | | This adds support to diff and status for running filters (a la crlf) on blobs in the workdir before computing SHAs and before generating text diffs. This ended up being a bit more code change than I had thought since I had to reorganize some of the diff logic to minimize peak memory use when filtering blobs in a diff. This also adds a cap on the maximum size of data that will be loaded to diff. I set it at 512Mb which should match core git. Right now it is a #define in src/diff.h but it could be moved into the public API if desired.
* Add bounds checking to UTF-8 conversionutf8-winVicent Marti2012-08-281-4/+5
|
* windows: Keep UTF-8 on the stack yoVicent Marti2012-08-281-21/+10
|
* Fix memory leak in cp_rRussell Belfer2012-08-241-0/+1
|
* Fix errors on Win32 with new repo initRussell Belfer2012-08-241-1/+1
|
* Some cleanup suggested during reviewRussell Belfer2012-08-221-17/+10
| | | | | | | | | | This cleans up a number of items suggested during code review with @vmg, including: * renaming "outside repo" config API to `git_config_open_default` * killing the `git_config_open_global` API * removing the `git_` prefix from the static functions in fileops * removing some unnecessary functionality from the "cp" command
* fix missing validation and type cast warningRussell Belfer2012-08-221-1/+4
|
* Add template dir and set gid to repo initRussell Belfer2012-08-221-68/+270
| | | | | | | | | | | | | | | | | This extends git_repository_init_ext further with support for initializing the repository from an external template directory and with support for the "create shared" type flags that make a set GID repository directory. This also adds tests for much of the new functionality to the existing `repo/init.c` test suite. Also, this adds a bunch of new utility functions including a very general purpose `git_futils_mkdir` (with the ability to make paths and to chmod the paths post-creation) and a file tree copying function `git_futils_cp_r`. Also, this includes some new path functions that were useful to keep the code simple.
* Add git_repository_init_ext for power inittersRussell Belfer2012-08-221-0/+10
| | | | | | | The extended version of repository init adds support for many of the things that you can do with `git init` and sets up structures that will make it easier to extend further in the future.
* Merge pull request #778 from ben/cloneVicent Martí2012-08-191-0/+11
|\ | | | | Clone
| * Checkout: obey core.symlinks.Ben Straub2012-07-171-0/+11
| |
* | config: set the error code if we can't find the global/system configCarlos Martín Nieto2012-07-231-0/+4
|/
* refs: deep unfound ref returns ENOTFOUNDnulltoken2012-07-071-1/+1
|
* Make errors for system and global files consistentRussell Belfer2012-05-251-4/+16
| | | | | | | The error codes from failed lookups of system and global files on Windows were not consistent with the codes returned on other platforms. This makes the error detection patterns match and adds a unit test for the various errors.
* Clean up system file finding tests on Win32env-expansionRussell Belfer2012-05-241-1/+1
|
* windows: Properly expand all environment variablesVicent Martí2012-05-241-103/+51
|
* Merge pull request #726 from arrbee/utf16-home-dirRussell Belfer2012-05-241-3/+42
|\ | | | | Get user's home dir in UTF-16 clean manner
| * Get user's home dir in UTF-16 clean mannerRussell Belfer2012-05-241-3/+42
| | | | | | | | | | | | | | On Windows, we are having problems with home directories that have non-ascii characters in them. This rewrites the relevant code to fetch environment variables as UTF-16 and then explicitly map then into UTF-8 for our internal usage.
* | fileops: Make git_futils_mkdir_r() able to cope with Windows network pathsnulltoken2012-05-231-7/+15
|/ | | | Partially fix libgit2/libgit2sharp#153
* Merge pull request #681 from scottjg/solaris-fixesVicent Martí2012-05-141-1/+1
|\ | | | | Fix build/runtime issues on Solaris
| * Fix rmdir() usage on SolarisScott J. Goldman2012-05-101-1/+1
| | | | | | | | | | On Solaris, rmdir() throws EEXIST if the folder is not empty, so just add one more case to check for that, alongside ENOTEMPTY.
* | Add cache busting to attribute cacheRussell Belfer2012-05-101-3/+0
|/ | | | | | | | | | | This makes the git attributes and git ignores cache check stat information before using the file contents from the cache. For cached files from the index, it checks the SHA of the file instead. This should reduce the need to ever call `git_attr_cache_flush()` in most situations. This commit also fixes the `git_status_should_ignore` API to use the libgit2 standard parameter ordering.