Commit Graph

22 Commits

Author SHA1 Message Date
Edward Thomson
359fc2d241 update copyrights 2013-01-08 17:31:27 -06:00
Russell Belfer
7bf87ab698 Consolidate text buffer functions
There are many scattered functions that look into the contents of
buffers to do various text manipulations (such as escaping or
unescaping data, calculating text stats, guessing if content is
binary, etc).  This groups all those functions together into a
new file and converts the code to use that.

This has two enhancements to existing functionality.  The old
text stats function is significantly rewritten and the BOM
detection code was extended (although largely we can't deal with
anything other than a UTF8 BOM).
2012-11-28 09:58:48 -08:00
Jameson Miller
c902f5a0ff Update of text stats calculation
Do not interpret 0x85 as Next Line (NEL)
char when gathering statistics for a text file.
2012-11-01 12:26:56 -04:00
nulltoken
5e4cb4f4da checkout : reduce memory usage when not filtering 2012-09-17 10:48:36 +02:00
nulltoken
3aa443a951 checkout: introduce git_checkout_tree() 2012-09-17 10:48:26 +02:00
Ben Straub
7cae2bcdf9 filter: fix memory leak 2012-07-21 20:11:37 -07:00
Ben Straub
9587895f57 Migrate code to git_filter_blob_contents.
Also removes the unnecessary check for filter 
length, since git_filters_apply does the right 
thing when there are none, and it's more efficient
than this.
2012-07-16 12:06:23 -07:00
Ben Straub
f2d42eea34 Checkout: add structure for CRLF. 2012-07-09 20:21:22 -07:00
Vicent Martí
e172cf082e errors: Rename the generic return codes 2012-05-18 01:26:26 +02:00
Vicent Martí
3fbcac89c4 Remove old and unused error codes 2012-05-02 19:56:38 -07:00
Vicent Martí
b88021463f Merge remote-tracking branch 'carlosmn/remaining-errors' into new-error-handling
Conflicts:
	src/refspec.c
2012-05-01 19:16:14 -07:00
nulltoken
fa6420f73e buf: deploy git_buf_len() 2012-04-30 07:12:37 +02:00
Carlos Martín Nieto
3aa351ea0f error handling: move the missing parts over to the new error handling 2012-04-26 15:38:42 +02:00
Russell Belfer
2bc8fa0227 Implement git_pool paged memory allocator
This adds a `git_pool` object that can do simple paged memory
allocation with free for the entire pool at once.  Using this,
you can replace many small allocations with large blocks that
can then cheaply be doled out in small pieces.  This is best
used when you plan to free the small blocks all at once - for
example, if they represent the parsed state from a file or data
stream that are either all kept or all discarded.

There are two real patterns of usage for `git_pools`: either
for "string" allocation, where the item size is a single byte
and you end up just packing the allocations in together, or for
"fixed size" allocation where you are allocating a large object
(e.g. a `git_oid`) and you generally just allocation single
objects that can be tightly packed.  Of course, you can use it
for other things, but those two cases are the easiest.
2012-04-25 10:42:37 -07:00
Russell Belfer
ce49c7a8a9 Add filter tests and fix some bugs
This adds some initial unit tests for file filtering and fixes
some simple bugs in filter application.
2012-03-02 15:09:40 -08:00
Vicent Martí
f2c25d1893 config: Implement a proper cvar cache 2012-03-02 20:08:00 +01:00
Vicent Martí
47a899ffed filter: Beautiful refactoring
Comments soothe my soul.
2012-03-01 21:19:51 +01:00
Vicent Martí
788430c8e3 filter: Properly cache filter settings 2012-03-01 05:06:47 +01:00
Vicent Martí
c5266ebac5 filter: Precache the filter config options on load 2012-03-01 01:16:50 +01:00
Vicent Martí
27950fa3f4 filter: Add write-to CRLF filter 2012-02-29 01:35:47 +01:00
Vicent Martí
450b40cab3 filter: Load attributes for file 2012-02-28 01:13:32 +01:00
Vicent Martí
44b1ff4c12 filter: Apply filters before writing a file to the ODB
Initial implementation. The relevant code is in `blob.c`: the blob write
function has been split into smaller functions.

	- Directly write a file to the ODB in streaming mode

	- Directly write a symlink to the ODB in direct mode

	- Apply a filter, and write a file to the ODB in direct mode

When trying to write a file, we first call `git_filter__load_for_file`,
which populates a filters array with the required filters based on the
filename.

If no filters are resolved to the filename, we can write to the ODB in
streaming mode straight from disk. Otherwise, we load the whole file in
memory and use double-buffering to apply the filter chain. We finish
by writing the file as a whole to the ODB.
2012-02-27 05:30:07 +01:00