summaryrefslogtreecommitdiff
path: root/src/fileops.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | 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.
* Typedefs don't have enum in frontCarlos Martín Nieto2012-04-111-2/+2
|
* fileops: Make git_futils_mkdir_r() able to skip non-empty directoriesnulltoken2012-04-101-6/+17
|
* reference: Fix creation of references with extended ASCII characters in ↵nulltoken2012-04-011-1/+12
| | | | their name
* Migrate index, oid, and utils to new errorsRussell Belfer2012-03-191-2/+2
| | | | | | | | | | | | This includes a few cleanups that came up while converting these files. This commit introduces a could new git error classes, including the catchall class: GITERR_INVALID which I'm using as the class for invalid and out of range values which are detected at too low a level of library to use a higher level classification. For example, an overflow error in parsing an integer or a bad letter in parsing an OID string would generate an error in this class.
* Convert attr, ignore, mwindow, status to new errorsRussell Belfer2012-03-161-2/+8
| | | | | Also cleaned up some previously converted code that still had little things to polish.
* Continue error conversionRussell Belfer2012-03-141-27/+56
| | | | | | | This converts blob.c, fileops.c, and all of the win32 files. Also, various minor cleanups throughout the code. Plus, in testing the win32 build, I cleaned up a bunch (although not all) of the warnings with the 64-bit build.
* Migrate ODB files to new error handlingRussell Belfer2012-03-121-5/+5
| | | | | | | | | | | | | | This migrates odb.c, odb_loose.c, odb_pack.c and pack.c to the new style of error handling. Also got the unix and win32 versions of map.c. There are some minor changes to other files but no others were completely converted. This also contains an update to filebuf so that a zeroed out filebuf will not think that the fd (== 0) is actually open (and inadvertently call close() on fd 0 if cleaned up). Lastly, this was built and tested on win32 and contains a bunch of fixes for the win32 build which was pretty broken.
* Merge pull request #590 from arrbee/new-error-handlingRussell Belfer2012-03-071-11/+6
|\ | | | | Migrating diff to new error handling
| * Migrating diff to new error handlingRussell Belfer2012-03-061-11/+6
| | | | | | | | | | | | Ended up migrating a bunch of upstream functions as well including vector, attr_file, and odb in order to get this to work right.
* | error-handling: ConfigVicent Martí2012-03-071-7/+8
|/
* error-handling: RepositoryVicent Martí2012-03-071-18/+20
| | | | | | | | This also includes droping `git_buf_lasterror` because it makes no sense in the new system. Note that in most of the places were it has been dropped, the code needs cleanup. I.e. GIT_ENOMEM is going away, so instead it should return a generic `-1` and obviously not throw anything.
* error-handling: ReferencesVicent Martí2012-03-061-29/+44
| | | | | Yes, this is error handling solely for `refs.c`, but some of the abstractions leak all ofer the code base.
* Fix a win32 warning messageRussell Belfer2012-03-021-2/+5
|
* Update diff to use iteratorsRussell Belfer2012-03-021-4/+9
| | | | | | | | | | | | | This is a major reorganization of the diff code. This changes the diff functions to use the iterators for traversing the content. This allowed a lot of code to be simplified. Also, this moved the functions relating to outputting a diff into a new file (diff_output.c). This includes a number of other changes - adding utility functions, extending iterators, etc. plus more tests for the diff code. This also takes the example diff.c program much further in terms of emulating git-diff command line options.
* buffer: Unify `git_fbuffer` and `git_buf`Vicent Martí2012-02-271-42/+32
| | | | | | | | | | | | | | This makes so much sense that I can't believe it hasn't been done before. Kill the old `git_fbuffer` and read files straight into `git_buf` objects. Also: In order to fully support 4GB files in 32-bit systems, the `git_buf` implementation has been changed from using `ssize_t` for storage and storing negative values on allocation failure, to using `size_t` and changing the buffer pointer to a magical pointer on allocation failure. Hopefully this won't break anything.
* Uniform iterators for trees, index, and workdirRussell Belfer2012-02-211-0/+18
| | | | | | | | | | | | | | | This create a new git_iterator type of object that provides a uniform interface for iterating over the index, an arbitrary tree, or the working directory of a repository. As part of this, git ignore support was extended to support push and pop of directory-based ignore files as the working directory is being traversed (so the array of ignores does not have to be recreated at each directory during traveral). There are a number of other small utility functions in buffer, path, vector, and fileops that are included in this patch that made the iterator implementation cleaner.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* Move path related functions from fileops to pathRussell Belfer2012-01-171-175/+6
| | | | | | | | | | | This takes all of the functions that look up simple data about paths (such as `git_futils_isdir`) and moves them over to path.h (becoming `git_path_isdir`). This leaves fileops.h just with functions that actually manipulate the filesystem or look at the file contents in some way. As part of this, the dir.h header which is really just for win32 support was moved into win32 (with some minor changes).
* Fix bug in dir_for_pathRussell Belfer2012-01-111-1/+2
| | | | | The last checkin accidentally broke dir_for_path by propogating the dirname return code even when there was no error.
* Allow ignores (and attribs) for nonexistent filesRussell Belfer2012-01-111-6/+18
| | | | | | This fixes issue 532 that attributes (and gitignores) could not be checked for files that don't exist. It should be possible to query such things regardless of the existence of the file.