Commit Graph

7815 Commits

Author SHA1 Message Date
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
094cfc2904 cherrypick, revert: drop unnecessary SAFE_CREATE 2015-02-27 13:47:30 -05:00
Carlos Martín Nieto
366e53d3da Merge pull request #2921 from libgit2/ntk/macosx_build_cherrypicked
Fix MAX 32 bit build problem described in libgit2/libgit2#2917
2015-02-20 19:40:45 +01:00
Jeff Hostetler
c92987d157 Fix MAX 32 bit build problem described in libgit2/libgit2#2917 2015-02-20 18:59:43 +01:00
Carlos Martín Nieto
5091aff782 Merge pull request #2907 from jasonhaslam/git_packfile_unpack_race
Fix race in git_packfile_unpack.
2015-02-20 08:40:40 +01:00
Carlos Martín Nieto
d15884ce84 Merge pull request #2911 from ethomson/streaming_filters
Streaming filters
2015-02-19 20:39:20 +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
9c9aa1bad3 filter: take temp_buf in git_filter_options 2015-02-19 11:45:46 -05:00
Edward Thomson
d05218b06f filter: add git_filter_list__load_ext
Refactor `git_filter_list__load_with_attr_reader` into
`git_filter_list__load_ext`, which takes a `git_filter_options`.
2015-02-19 11:25:26 -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
d4cf167515 buffer: introduce git_buf_attach_notowned
Provide a convenience function that creates a buffer that can be provided
to callers but will not be freed via `git_buf_free`, so the buffer
creator maintains the allocation lifecycle of the buffer's contents.
2015-02-19 10:05:33 -05:00
Carlos Martín Nieto
818302c853 Merge pull request #2820 from leoyanggit/mac_build
Fix Mac build without OpenSSL
2015-02-19 11:19:17 +01:00
Edward Thomson
b49edddcd0 checkout: let the stream writer close the fd 2015-02-18 10:24:43 -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
Edward Thomson
646364e780 checkout: maintain temporary buffer for filters
Let the filters use the checkout data's temporary buffer, instead
of having to allocate new buffers each time.
2015-02-17 16:03:45 -05:00
Edward Thomson
e78f5c9f42 checkout: stream the blob into the filters
Use the new streaming filter API during checkout.
2015-02-17 15:57:10 -05:00
Edward Thomson
5555696f8a filters: stream internally
Migrate the `git_filter_list_apply_*` functions over to using the
new filter streams.
2015-02-17 15:57:04 -05:00
Leo Yang
2d2aa1ff6e Fix Mac build without OpenSSL
If OpenSSL is disabled on Mac the SHA1 implementation goes
to the CommonCrypto from the system. In this case we should
not include the generic hash impl. Otherwise there would be
duplicated impls which fail the build.
2015-02-17 12:03:25 -05:00
Edward Thomson
fbdc9db364 filters: introduce streaming filters
Add structures and preliminary functions to take a buffer, file or
blob and write the contents in chunks through an arbitrary number
of chained filters, finally writing into a user-provided function
accept the contents.
2015-02-17 02:19:05 -05:00
Carlos Martín Nieto
437ba9ad65 Merge pull request #2909 from stewid/remove_extra_semicolon
Remove extra semicolon outside of a function
2015-02-16 03:14:32 +01: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
Jason Haslam
8588cb0cbf Fix race in git_packfile_unpack.
Increment refcount of newly added cache entries just like existing
entries looked up from the cache. Otherwise the new entry can be
evicted from the cache and destroyed while it's still in use.
2015-02-14 23:43:26 -07: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
Carlos Martín Nieto
b23c206e59 Merge pull request #2903 from ethomson/rebase
Fixups for rebase
2015-02-15 05:03:51 +01:00
Edward Thomson
41fae48df2 indexwriter: an indexwriter for repo operations
Provide git_indexwriter_init_for_operation for the common locking
pattern in merge, rebase, revert and cherry-pick.
2015-02-14 09:25:36 -05:00
Edward Thomson
be8404a768 merge-like operations: lock index while working 2015-02-14 09:25:35 -05: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
ffbd51edc8 rebase: CHECKOUT_SAFE instead of FORCE
Switch to a standard branch-switching pattern of a `SAFE` checkout,
then updating `HEAD`.
2015-02-13 11:38:00 -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
Carlos Martín Nieto
57f45e7f4d Merge pull request #2901 from ethomson/win32_mode_bits
win32: limit the mode to `_wopen`/`_waccess`
2015-02-13 15:58:39 +01:00
Edward Thomson
0f07d54b44 pack-objects: unlock the cache on integer overflow 2015-02-13 09:35:20 -05:00
Edward Thomson
d97d9559e3 buf test: cleanup memory leak 2015-02-13 09:28:12 -05:00
Edward Thomson
16942c6fda integer overflow: use compiler intrinsics if supported
gcc and clang support __builtin_add_overflow, use it whenever
possible, falling back to our naive routines.
2015-02-13 09:28:09 -05:00
Edward Thomson
8aab36a301 filebuf: use an int for return check 2015-02-13 09:28:05 -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
Edward Thomson
527ed59ad8 win32: limit the mode to _wopen/_waccess
Win32 generally ignores Unix-like mode bits that don't make any
sense on the platform (eg `0644` makes no sense to Windows).  But
WINE complains loudly when presented with POSIXy bits.  Remove them.

(Thanks @phkelley)
2015-02-13 09:18:49 -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
Carlos Martín Nieto
3ca91107fc Merge pull request #2897 from leoyanggit/fix_fileop_warning
Fix build warning on Android
2015-02-13 08:30:21 +01:00
Edward Thomson
650e45f691 Update khash.h to pull request 42
https://github.com/attractivechaos/klib/pull/42/files introduces
`kreallocarray`.  Hook that up as our `git__reallocarray`.
2015-02-12 22:54:48 -05:00
Edward Thomson
1ad48c8a08 khash: update to klib f28c067 2015-02-12 22:54:47 -05:00
Edward Thomson
190b76a698 Introduce git__add_sizet_overflow and friends
Add some helper functions to check for overflow in a type-specific
manner.
2015-02-12 22:54:47 -05:00
Edward Thomson
8d534b4758 p_read: ensure requested len is ssize_t
Ensure that the given length to `p_read` is of ssize_t and ensure
that callers test the return as if it were an `ssize_t`.
2015-02-12 22:54:47 -05:00