Commit Graph

1291 Commits

Author SHA1 Message Date
Jeff Hostetler
f096fbf4d6 Cleanup formatting of clar trace messages. 2015-03-02 08:34:02 -05:00
Jeff Hostetler
6b5c0886b6 Provide mechanism to let CLAR globally setup git_trace() 2015-03-02 08:20:27 -05:00
Edward Thomson
496b76d415 checkout tests: just use SAFE where appropriate 2015-02-27 13:50:48 -05:00
Edward Thomson
96b82b11c6 checkout: remove GIT_CHECKOUT_SAFE_CREATE as a strategy 2015-02-27 13:50:44 -05:00
Edward Thomson
6c9e86adaf clone: drop now unnecessary SAFE_CREATE 2015-02-27 13:50:36 -05:00
Edward Thomson
e6da3e4496 checkout: upgrade to SAFE_CREATE when no index file
When the repository does not contain an index, emulate git's behavior
and upgrade to `SAFE_CREATE`.  This allows us to check out repositories
created with `git clone --no-checkout`.
2015-02-27 13:50:32 -05:00
Edward Thomson
5cbe950fb8 merge perf test: drop unnecessary SAFE_CREATE 2015-02-27 13:47:34 -05:00
Edward Thomson
cfcb346d94 Update to clar 2b73f5e 2015-02-27 00:30:50 -05:00
Edward Thomson
4196dd8e8f repository: Introduce "reserved names"
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.
2015-02-27 04:36:47 +00:00
Damien PROFETA
a275fbc0f7 Add API to add a memory buffer to an index
git_index_add_frombuffer enables now to store a memory buffer in the odb
and to store an entry in the index directly if the index is attached to a
repository.
2015-02-25 10:24:13 +01:00
Edward Thomson
feb0e02286 tests: separate INVASIVE filesystem tests
Introduce GITTEST_INVASIVE_FS_STRUCTURE for things that are invasive
to your filesystem structure (like creating folders at your filesystem
root) and GITTEST_INVASIVE_FS_SIZE for things that write lots of data.
2015-02-19 12:14:06 -05:00
Edward Thomson
795eaccd66 git_filter_opt_t -> git_filter_flag_t
For consistency with the rest of the library, where an opt is an
options *structure*.
2015-02-19 11:09:54 -05:00
Edward Thomson
09866d6f84 stash: correctly stash wd modified/index deleted 2015-02-18 11:26:03 -05:00
Edward Thomson
f7c0125f47 filter streams: base -> parent 2015-02-18 10:24:34 -05:00
Edward Thomson
b75f15aaf1 git_writestream: from git_filter_stream 2015-02-18 10:24:23 -05:00
Edward Thomson
8c2dfb38db filter: test a large file through the stream
Test pushing a file on-disk into a streaming filter that compresses
it into the ODB, and inflates it back into the working directory.
2015-02-17 17:00:57 -05:00
Stefan Widgren
c8e02b8776 Remove extra semicolon outside of a function
Without this change, compiling with gcc and pedantic generates warning:
ISO C does not allow extra ‘;’ outside of a function.
2015-02-15 21:07:05 +01:00
Carlos Martín Nieto
a291790a8d Merge pull request #2831 from ethomson/merge_lock
merge: lock index during the merge (not just checkout)
2015-02-15 05:18:01 +01:00
Carlos Martín Nieto
a7fa970f8b Merge pull request #2895 from ethomson/alloc_overflow
allocations: test for overflow of requested size
2015-02-15 05:13:50 +01:00
Edward Thomson
8b0ddd5dd9 merge: lock the index at the start of the merge
Always lock the index when we begin the merge, before we write
any of the metdata files.  This prevents a race where another
client may run a commit after we have written the MERGE_HEAD but
before we have updated the index, which will produce a merge
commit that is treesame to one parent.  The merge will finish and
update the index and the resultant commit would not be a merge at
all.
2015-02-14 09:25:35 -05:00
Edward Thomson
8639ea5f98 checkout: introduce GIT_CHECKOUT_DONT_WRITE_INDEX 2015-02-14 09:25:35 -05:00
Edward Thomson
55798fd153 git_indexwriter: lock then write the index
Introduce `git_indexwriter`, to allow us to lock the index while
performing additional operations, then complete the write (or abort,
unlocking the index).
2015-02-14 09:25:35 -05:00
Edward Thomson
42f98a26a5 merge test: test an actual failure, not conflict
Correct the merge failed cleanup test.  Merge data should not be
cleaned up on conflicts, only on actual failure.  And ORIG_HEAD
should not be removed at all.
2015-02-13 11:44:34 -05:00
Edward Thomson
49b8293c75 rebase: allow NULL branch to indicate HEAD
Don't require the branch to rebase, if given `NULL`, simply look up
`HEAD`.
2015-02-13 11:20:32 -05:00
Edward Thomson
92e87dd749 rebase: provide NULL exec on non-EXEC operations
Users may want to try to pay attention to the `exec` field on all
rebase operations.
2015-02-13 10:44:19 -05:00
Edward Thomson
d97d9559e3 buf test: cleanup memory leak 2015-02-13 09:28:12 -05:00
Edward Thomson
f1453c59b2 Make our overflow check look more like gcc/clang's
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.
2015-02-13 09:27:33 -05:00
Carlos Martín Nieto
0b2ee7c07c Merge pull request #2883 from urkud/reget-reader-pointer
Reinit `reader` pointer after reading included config file
2015-02-13 08:56:01 +01:00
Edward Thomson
2884cc42de overflow checking: don't make callers set oom
Have the ALLOC_OVERFLOW testing macros also simply set_oom in the
case where a computation would overflow, so that callers don't
need to.
2015-02-12 22:54:47 -05:00
Edward Thomson
4aa664ae39 git_buf_grow_by: increase buf asize incrementally
Introduce `git_buf_grow_by` to incrementally increase the size of a
`git_buf`, performing an overflow calculation on the growth.
2015-02-12 22:54:47 -05:00
Edward Thomson
392702ee2c allocations: test for overflow of requested size
Introduce some helper macros to test integer overflow from arithmetic
and set error message appropriately.
2015-02-12 22:54:46 -05:00
Yury G. Kudryashov
3ea78f241f Add test for include.path inside included config
It fails at least on my computer, though it may depend on some unpredictable
factors (say, will realloc() extend the memory segment in place, or it will
allocate new memory).
2015-02-13 00:15:16 +03:00
Carlos Martín Nieto
d24a5312d8 Merge pull request #2866 from ethomson/checkout_perf2
Checkout performance
2015-02-12 02:34:58 +01:00
Carlos Martín Nieto
8e29ae7310 Merge pull request #2862 from jeffhostetler/jeffhostetler/bug/branch_create_after_namespace
Remove stale reflog namespace directory before branch creation
2015-02-12 00:43:01 +01:00
Carlos Martín Nieto
e07c1e1a15 Merge pull request #2880 from ethomson/mkdir_root
Ensure we can make a repo at the root of the filesystem
2015-02-12 00:40:12 +01:00
Carlos Martín Nieto
6dbbced2b1 Merge pull request #2889 from jeffhostetler/jeffhostetler/merge_performance
Large merge perf test.
2015-02-12 00:27:17 +01:00
Jeff Hostetler
d97ba7f674 Large merge perf test. 2015-02-06 15:45:59 -05:00
Edward Thomson
83276dccbe Update clar to d17c7f6 2015-02-05 13:24:38 -05:00
Edward Thomson
3c68bfcd08 stat: don't remove trailing '/' from root on win32
`p_stat` calls `git_win32_path_from_utf8`, which canonicalizes the
path.  Do not further try to modify the path, else we trim the
trailing slash from a root directory and try to access `C:` instead
of `C:/`.
2015-02-05 12:27:16 -05:00
Edward Thomson
865baaf928 repo: ensure we can create repo at filesystem root
Test to ensure that we can create a repository at the filesystem
root.  Introduces a new test environment variable,
`GITTEST_INVASIVE_FILESYSTEM` for tests that do terrible things like
escaping the clar sandbox and writing to the root directory.  It is
expected that the CI builds will enable this but that normal people
would not want this.
2015-02-05 11:59:03 -05:00
Edward Thomson
9bf5bd7cd8 Merge pull request #2867 from ethomson/8dot3
Handle 8dot3 filenames being disabled on Win32
2015-02-05 09:19:46 -05:00
Edward Thomson
fa89ff20cd remove some unused warnings 2015-02-04 14:15:13 +00:00
Edward Thomson
f45f9b6dbc structinit test: use %PRIuZ instead of %d for size_t 2015-02-04 03:52:34 +00:00
Edward Thomson
07c989e98d win32: further cleanups for 8.3 disabling 2015-02-03 20:01:24 -05:00
Edward Thomson
5f28ec84a1 win32: cleanup 8.3 disabled tests 2015-02-03 12:23:04 -05:00
Jeff Hostetler
1589a93aa6 Fix branch creation when branch name matches namespace of previously deleted branch 2015-02-03 10:33:04 -05:00
Edward Thomson
60561d5446 tests: update for new test data 2015-02-02 22:46:43 -05:00
Edward Thomson
2fbce0bfac checkout test: ensure .gitattributes lifecycle
The .gitattributes cache should not reload .gitattributes in the
middle of checking out, only between checkout operations.  Otherwise,
we'll spend all our time stat'ing and read'ing the gitattributes.
2015-02-02 22:46:39 -05:00
Edward Thomson
f83c19c87d Merge pull request #2832 from ethomson/appveyor_badge
64-bit Appveyor Builds
2015-01-30 14:16:45 -05:00
Linquize
9dcc4a36f7 Fix test failures when 8.3 is disabled 2015-01-31 00:09:31 +08:00
Edward Thomson
1ac5acdc69 Merge pull request #2819 from libgit2/cmn/config-get-path
config: add parsing and getter for paths
2015-01-26 11:28:59 -06:00
Edward Thomson
7c48508b28 structinit test: only run on DEBUG builds
The structinit tests don't make sense unless structure padding
is uniformly initialized, which is unlikely to happen on release
builds.  Only enable them for DEBUG builds.  Further, rename them
to core::structinit.
2015-01-21 12:55:17 -06:00
Edward Thomson
0ad5c845d2 structinit test: show which byte differs 2015-01-21 11:53:20 -06:00
Edward Thomson
e0902fbce7 checkout tests: cleanup realpath impl on Win32 2015-01-20 17:13:52 -06:00
Edward Thomson
53eb139dcb checkout tests: emulate p_realpath poorly on Win32 2015-01-20 17:13:41 -06:00
Edward Thomson
e74340b000 checkout: remove files before writing new ones
On case insensitive filesystems, we may have files in the working
directory that case fold to a name we want to write.  Remove those
files (by default) so that we will not end up with a filename that
has the unexpected case.
2015-01-20 17:13:31 -06:00
Edward Thomson
232bc89598 checkout tests: nasty symlinks
Symbolic links that abuse case insensitivity to write into .git.
2015-01-20 17:13:09 -06:00
Edward Thomson
1fbfcdfcd0 git_path_join_unrooted: return base len
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.
2015-01-20 17:12:35 -06:00
Edward Thomson
1d50b3649d checkout: introduce git_checkout_perfdata
Checkout can now provide performance data about the number of (some)
syscalls performed using an optional callback.
2015-01-20 17:12:23 -06:00
Linquize
b4c6a9da93 Add files and tests with many UTF-8 chars and few UTF-8 chars 2015-01-20 16:17:48 -06:00
Sven Strickroth
0161e096a3 Make binary detection work similar to vanilla git
Main change: Don't treat chars > 128 as non-printable (common in UTF-8 files)

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2015-01-20 16:17:37 -06:00
Carlos Martín Nieto
eac773d92b config: add parsing and getter for paths 2015-01-14 19:36:50 +01:00
Edward Thomson
85880693d5 Merge branch 'pr/2740' 2015-01-14 10:19:28 -06:00
Pierre-Olivier Latour
36fc549781 Added GIT_HASHSIG_ALLOW_SMALL_FILES to allow computing signatures for small files
The implementation of the hashsig API disallows computing a signature on
small files containing only a few lines. This new flag disables this
behavior.

git_diff_find_similar() sets this flag by default which means that rename
/ copy detection of small files will now work. This in turn affects the
behavior of the git_status and git_blame APIs which will now detect rename
of small files assuming the right options are passed.
2015-01-14 10:17:56 -06:00
Carlos Martín Nieto
d4b2410126 Merge commit '4b1018d24f980273528743c27c47ceb96cb720bd'
Fix crash in free() when git_buf_grow() fails.
2015-01-09 16:47:48 +01:00
Jeff Hostetler
4b1018d24f Fix crash in free() when git_buf_grow() fails. 2015-01-09 16:46:44 +01:00
Carlos Martín Nieto
fe8399fe9b Fix warning 2015-01-09 16:29:08 +01:00
Carlos Martín Nieto
788c5f1ca8 Merge pull request #2810 from ethomson/remove_symlinks
Remove symlinks from the repository
2015-01-09 10:23:08 +01:00
Edward Thomson
365d367238 submodule::init tests: free some leaks 2015-01-08 22:31:15 +00:00
Edward Thomson
3b40ed897f repo::init test: create hook symlink
Remove the hook symlink from the test resources, so that we can
have a source tree that is easy to zip up and copy around on systems
that don't support symlinks.  Create it dynamically at test execution
instead.
2015-01-08 19:23:37 +00:00
Edward Thomson
1646412d8f Merge pull request #2802 from calavera/remote_create_prune_config
Load prune configuration when a remote is created.
2015-01-08 11:20:44 -06:00
David Calavera
de4a75f977 Fix more indentation. 2015-01-07 09:26:36 -08:00
David Calavera
c868981f0e Add extern function to initialize submodule update options. 2015-01-07 09:04:49 -06:00
David Calavera
66b71ea5f5 Fix intentation. 2015-01-05 13:33:36 -08:00
David Calavera
1ef3f0cebb Load prune configuration when a remote is created. 2015-01-05 13:24:11 -08:00
Carlos Martín Nieto
0c6012293a Merge commit 'refs/pull/2632/head' of github.com:libgit2/libgit2 2015-01-05 20:10:43 +00:00
Carlos Martín Nieto
c4a2fd5c1d Plug a couple of leaks 2015-01-04 17:39:43 +00:00
Edward Thomson
a3ef70bb40 Merge pull request #2761 from libgit2/cmn/fetch-prune
Remote-tracking branch prunning
2014-12-30 11:53:55 -06:00
Edward Thomson
c4c47fc286 Merge pull request #2762 from libgit2/cmn/hide-push
remote: remove git_push from the public API
2014-12-30 11:53:45 -06:00
Carlos Martín Nieto
fe794b2ea7 remote: remove git_push from the public API
Instead we provide git_remote_upload() and git_remote_update_tips() in
order to have a parallel API for fetching and pushing.
2014-12-30 17:02:50 +00:00
Carlos Martín Nieto
208a2c8aef treebuilder: rename _create() to _new()
This function is a constructor, so let's name it like one and leave
_create() for the reference functions, which do create/write the
reference.
2014-12-27 12:09:11 +00:00
Edward Thomson
40d791545a Always checkout with case sensitive iterator
On a case-insensitive filesystem, we need to deal with case-changing
renames (eg, foo -> FOO) by removing the old and adding the new,
exactly as if we were on a case-sensitive filesystem.

Update the `checkout::tree::can_cancel_checkout_from_notify` test, now
that notifications are always sent case sensitively.
2014-12-23 10:14:04 -06:00
Edward Thomson
61ee5b0e57 Introduce test for checkout case-changing rename 2014-12-23 10:14:01 -06:00
Jameson Miller
9d1f97df10 Introduce a convenience function for submodule update
This introduces the functionality of submodule update in
'git_submodule_do_update'. The existing 'git_submodule_update' function is
renamed to 'git_submodule_update_strategy'. The 'git_submodule_update'
function now refers to functionality similar to `git submodule update`,
while `git_submodule_update_strategy` is used to get the configured value
of submodule.<name>.update.
2014-12-22 16:37:35 -05:00
Jameson Miller
b2ab887e11 submodule init should resolve relative url paths
Submodule init should handle relative paths in .gitmodules files
and resolve these urls when updating the git config file.
2014-12-22 16:35:45 -05:00
Edward Thomson
c7d9839f54 Merge pull request #2763 from libgit2/cmn/local-proto-progress
Show progress output on fetch for the local transport
2014-12-20 21:22:30 -06:00
Linquize
6987a580f7 Add more Windows reserved filenames 2014-12-19 23:54:42 +08:00
Linquize
6fd00266a8 COM0 is a valid path, although Windows Explorer does not allow to create this 2014-12-19 23:54:01 +08:00
Edward Thomson
2842831800 index tests: test capitalization before mkdir 2014-12-18 12:41:59 -06:00
Carlos Martín Nieto
c90ed5b558 Plug leaks 2014-12-18 02:11:06 +01:00
Carlos Martín Nieto
c679bf42f5 Create miscapitialised dirs for case-sensitive filesystems
We need these directories to exist so cl_git_mkfile() can create the
files we ask it to.
2014-12-18 02:07:36 +01:00
Edward Thomson
dce7b1a4e7 treebuilder: take a repository for path validation
Path validation may be influenced by `core.protectHFS` and
`core.protectNTFS` configuration settings, thus treebuilders
can take a repository to influence their configuration.
2014-12-17 13:05:27 -05:00
Edward Thomson
ec74b40cee Introduce core.protectHFS and core.protectNTFS
Validate HFS ignored char ".git" paths when `core.protectHFS` is
specified.  Validate NTFS invalid ".git" paths when `core.protectNTFS`
is specified.
2014-12-17 12:52:07 -05:00
Edward Thomson
11d67b754d checkout: disallow bad paths on HFS
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.
2014-12-16 10:08:59 -06:00
Edward Thomson
ee5da720e5 reference_create: validate loose names
Validate loose reference names on Win32.
2014-12-16 10:08:56 -06:00
Edward Thomson
a64119e396 checkout: disallow bad paths on win32
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.
2014-12-16 10:08:53 -06:00
Vicent Marti
0d388adc86 index: Check for valid paths before creating an index entry 2014-12-16 10:08:49 -06:00
Edward Thomson
cceae9a25d win32: use NT-prefixed "\\?\" paths
When turning UTF-8 paths into UCS-2 paths for Windows, always use
the \\?\-prefixed paths.  Because this bypasses the system's
path canonicalization, handle the canonicalization functions ourselves.

We must:
 1. always use a backslash as a directory separator
 2. only use a single backslash between directories
 3. not rely on the system to translate "." and ".." in paths
 4. remove trailing backslashes, except at the drive root (C:\)
2014-12-16 10:08:43 -06:00
Carlos Martín Nieto
3ded7f28c7 local: add failing test for sideband information
We do not currently generate any messages when we're counting the
objects, as might be expected from a local upload-pack. Assert that we
do call the function when working.
2014-12-16 10:05:49 +01:00
Carlos Martín Nieto
4adc64a81a fetch: plug leaks in the prune tests 2014-12-14 21:52:27 +01:00