|
aa993f76
|
2021-09-13T11:40:38
|
|
buf: introduce `git_buf_truncate_at`
|
|
d2316d57
|
2021-08-29T13:10:44
|
|
buf: deprecate public git_buf writing functions
A `git_buf` is now a read-only structure as far as callers are
concerned. This is a mechanism that we can return data to callers
using memory that is owned by the library and can be cleaned up by
callers (using `git_buf_dispose`).
A `git_buf` can no longer be allocated by callers or provided to the
library.
|
|
14f6950b
|
2021-05-10T23:14:17
|
|
buf: bom enum is in the buf namespace
Instead of a `git_bom_t` that a `git_buf` function returns, let's keep
it `git_buf_bom_t`.
|
|
d525e063
|
2021-05-10T23:04:59
|
|
buf: remove internal `git_buf_text` namespace
The `git_buf_text` namespace is unnecessary and strange. Remove it,
just keep the functions prefixed with `git_buf`.
|
|
e0f3c33d
|
2020-04-05T11:22:19
|
|
buffer: git_buf_copy_cstr should return a value
`git_buf_copy_cstr` is called with user-input, and wants to sanity-check
that input. Allow it to return a value if the input was malformed in a
way that we cannot cope.
|
|
cb4bfbc9
|
2020-04-05T11:07:54
|
|
buffer: git_buf_sanitize should return a value
`git_buf_sanitize` is called with user-input, and wants to sanity-check
that input. Allow it to return a value if the input was malformed in a
way that we cannot cope.
|
|
d68f2b1a
|
2019-12-06T18:22:58
|
|
buf: add consume_bytes
Allow users to consume a buffer by the number of bytes, not just to an
ending pointer.
|
|
b5818dda
|
2018-06-18T13:05:08
|
|
Fix last references to deprecated git_buf_free
Signed-off-by: Sven Strickroth <email@cs-ware.de>
|
|
8070a357
|
2018-03-03T18:47:35
|
|
Introduce `git_buf_decode_percent`
Introduce a function to take a percent-encoded string (URI encoded,
described by RFC 1738) and decode it into a `git_buf`.
|
|
4796c916
|
2017-06-07T09:56:31
|
|
buffer: return errors for `git_buf_init` and `git_buf_attach`
Both the `git_buf_init` and `git_buf_attach` functions may call
`git_buf_grow` in case they were given an allocation length as
parameter. As such, it is possible for these functions to fail when we
run out of memory. While it won't probably be used anytime soon, it does
indeed make sense to also record this fact by returning an error code
from both functions. As they belong to the internal API only, this
change does not break our interface.
|
|
cdb2c2a0
|
2017-02-13T13:31:37
|
|
buffer: clarify how `git_buf_sanitize` handles non-NULL input
When `git_buf_sanitize` gets called, it converts a buffer with NULL
content to be correctly initialized. This is done by pointing it to
`git_buf__initbuf`. While the method's documentation states this
clearly, it may also lead to the conclusion that it will do the same to
buffers which do _not_ have NULL contents.
Clarify behavior when passing a buffer with non-NULL contents, where
`git_buf_sanitize` will ensure that the contents are `\0`-terminated.
|
|
d3d95d5a
|
2015-09-23T16:30:48
|
|
git_buf_quote: quote ugly characters
|
|
5b78dbdb
|
2015-07-09T13:04:10
|
|
git_buf: decode base85 inputs
|
|
d34f6826
|
2014-04-08T17:18:47
|
|
Patch parsing from patch files
|
|
caab22c0
|
2015-06-23T15:41:58
|
|
buffer: don't allow growing borrowed buffers
When we don't own a buffer (asize=0) we currently allow the usage of
grow to copy the memory into a buffer we do own. This muddles the
meaning of grow, and lets us be a bit cavalier with ownership semantics.
Don't allow this any more. Usage of grow should be restricted to buffers
which we know own their own memory. If unsure, we must not attempt to
modify it.
|
|
d4cf1675
|
2015-02-19T10:05:33
|
|
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.
|
|
4aa664ae
|
2015-02-10T23:55:07
|
|
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.
|
|
e003f83a
|
2014-07-31T15:14:56
|
|
Introduce git_buf_decode_base64
Decode base64-encoded text into a git_buf
|
|
e349ed50
|
2014-04-22T14:58:33
|
|
patch: emit binary patches (optionally)
|
|
b3b36a68
|
2014-04-10T12:43:16
|
|
Introduce git_buf_putcn
Allows for inserting the same character n amount of times
|
|
18234b14
|
2014-02-21T09:14:16
|
|
Add efficient git_buf join3 API
There are a few places where we need to join three strings to
assemble a path. This adds a simple join3 function to avoid the
comparatively expensive join_n (which calls strlen on each string
twice).
|
|
4f46a98b
|
2014-02-24T23:32:25
|
|
Remove now-duplicated stdarg.h include
|
|
6adcaab7
|
2014-01-08T10:07:30
|
|
Handle git_buf's from users more liberally
|
|
5588f073
|
2013-12-09T10:25:36
|
|
Clean up warnings
|
|
a9f51e43
|
2013-09-11T22:00:36
|
|
Merge git_buf and git_buffer
This makes the git_buf struct that was used internally into an
externally available structure and eliminates the git_buffer.
As part of that, some of the special cases that arose with the
externally used git_buffer were blended into the git_buf, such as
being careful about git_buf objects that may have a NULL ptr and
allowing for bufs with a valid ptr and size but zero asize as a
way of referring to externally owned data.
|
|
2a7d224f
|
2013-09-10T16:33:32
|
|
Extend public filter api with filter lists
This moves the git_filter_list into the public API so that users
can create, apply, and dispose of filter lists. This allows more
granular application of filters to user data outside of libgit2
internals.
This also converts all the internal usage of filters to the public
APIs along with a few small tweaks to make it easier to use the
public git_buffer stuff alongside the internal git_buf.
|
|
85d54812
|
2013-08-28T16:44:04
|
|
Create public filter object and use it
This creates include/sys/filter.h with a basic definition of a
git_filter and then converts the internal code to use it. There
are related internal objects (git_filter_list) that we will want
to publish at some point, but this is a first step.
|
|
278ce746
|
2013-07-01T10:20:38
|
|
Add helpful buffer shorten function
|
|
ed4f95e5
|
2013-03-05T11:47:07
|
|
Add const to some buffer functions
|
|
f1e2735c
|
2013-01-30T11:10:39
|
|
Add helper for diff line stats
This adds a `git_diff_patch_line_stats()` API that gets the total
number of adds, deletes, and context lines in a patch. This will
make it a little easier to emulate `git diff --stat` and the like.
Right now, this relies on generating the `git_diff_patch` object,
which is a pretty heavyweight way to get stat information. At
some future point, it would probably be nice to be able to get
this information without allocating the entire `git_diff_patch`,
but that's a much larger project.
|
|
359fc2d2
|
2013-01-08T17:07:25
|
|
update copyrights
|
|
7bf87ab6
|
2012-11-28T09:58:48
|
|
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).
|
|
3a14d3e2
|
2012-10-01T11:58:15
|
|
buf: introduce git_buf_splice()
|
|
b46708aa
|
2012-10-11T23:04:08
|
|
Separated git_strarray from common.h. Added doxy comments.
|
|
2d3579be
|
2012-10-10T14:54:31
|
|
Add git_buf_put_base64 to buffer API
|
|
02a0d651
|
2012-07-12T16:31:59
|
|
Add git_buf_unescape and git__unescape to unescape all characters in a string (in-place)
|
|
039fc406
|
2012-07-10T15:10:14
|
|
Add a couple of useful git_buf utilities
* `git_buf_rfind` (with tests and tests for `git_buf_rfind_next`)
* `git_buf_puts_escaped` and `git_buf_puts_escaped_regex` (with tests)
to copy strings into a buffer while injecting an escape sequence
(e.g. '\') in front of particular characters.
|
|
a0d95962
|
2012-05-17T13:14:17
|
|
Other optimization and warning fixes
This fixes a warning left by the earlier optimization and
addresses one of the other hotspots identified by GProf.
|
|
b59c73d3
|
2012-05-17T13:06:20
|
|
Optimize away git_text_gather_stats in diff
GProf shows `git_text_gather_stats` as the most expensive call
in large diffs. The function calculates a lot of information
that is not actually used and does not do so in a optimal
order. This introduces a tuned `git_buf_is_binary` function
that executes the same algorithm in a fraction of the time.
|
|
2c833917
|
2012-05-15T16:33:05
|
|
Document git_buf_common_prefix
This function fills in a git_buf with the common prefix of
an array of strings, but let's make that a little more clear.
|
|
41a82592
|
2012-05-15T14:17:39
|
|
Ranged iterators and rewritten git_status_file
The goal of this work is to rewrite git_status_file to use the
same underlying code as git_status_foreach.
This is done in 3 phases:
1. Extend iterators to allow ranged iteration with start and
end prefixes for the range of file names to be covered.
2. Improve diff so that when there is a pathspec and there is
a common non-wildcard prefix of the pathspec, it will use
ranged iterators to minimize excess iteration.
3. Rewrite git_status_file to call git_status_foreach_ext
with a pathspec that covers just the one file being checked.
Since ranged iterators underlie the status & diff implementation,
this is actually fairly efficient. The workdir iterator does
end up loading the contents of all the directories down to the
single file, which should ideally be avoided, but it is pretty
good.
|
|
3972ca43
|
2012-05-05T22:14:02
|
|
compat: Add `stdarg.h` include
|
|
baaf1c47
|
2012-05-02T23:44:22
|
|
buffer: Add `git_buf_vprintf`
|
|
da3c187d
|
2012-04-29T19:08:48
|
|
buf: add git_buf_len() accessor to expose the current length of the buffer content
|
|
0d0fa7c3
|
2012-03-16T15:56:01
|
|
Convert attr, ignore, mwindow, status to new errors
Also cleaned up some previously converted code that still had
little things to polish.
|
|
deafee7b
|
2012-03-14T17:36:15
|
|
Continue error conversion
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.
|
|
cb8a7961
|
2012-03-07T00:02:55
|
|
error-handling: Repository
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.
|
|
ce49c7a8
|
2012-03-02T15:09:40
|
|
Add filter tests and fix some bugs
This adds some initial unit tests for file filtering and fixes
some simple bugs in filter application.
|
|
13224ea4
|
2012-02-27T04:28:31
|
|
buffer: Unify `git_fbuffer` and `git_buf`
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.
|
|
b6c93aef
|
2012-02-21T14:46:24
|
|
Uniform iterators for trees, index, and workdir
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.
|
|
5e0de328
|
2012-02-13T17:10:24
|
|
Update Copyright header
Signed-off-by: schu <schu-github@schulog.org>
|
|
df743c7d
|
2012-01-09T15:37:19
|
|
Initial implementation of gitignore support
Adds support for .gitignore files to git_status_foreach() and
git_status_file(). This includes refactoring the gitattributes
code to share logic where possible. The GIT_STATUS_IGNORED flag
will now be passed in for files that are ignored (provided they
are not already in the index or the head of repo).
|
|
bf6d2717
|
2011-12-14T03:27:53
|
|
buffer: inline `git_buf_cstr`
|
|
97769280
|
2011-11-30T11:27:15
|
|
Use git_buf for path storage instead of stack-based buffers
This converts virtually all of the places that allocate GIT_PATH_MAX
buffers on the stack for manipulating paths to use git_buf objects
instead. The patch is pretty careful not to touch the public API
for libgit2, so there are a few places that still use GIT_PATH_MAX.
This extends and changes some details of the git_buf implementation
to add a couple of extra functions and to make error handling easier.
This includes serious alterations to all the path.c functions, and
several of the fileops.c ones, too. Also, there are a number of new
functions that parallel existing ones except that use a git_buf
instead of a stack-based buffer (such as git_config_find_global_r
that exists alongsize git_config_find_global).
This also modifies the win32 version of p_realpath to allocate whatever
buffer size is needed to accommodate the realpath instead of hardcoding
a GIT_PATH_MAX limit, but that change needs to be tested still.
|
|
309113c9
|
2011-11-29T23:45:17
|
|
Make initial value of git_buf ptr always be a valid empty string.
Taking a page from core git's strbuf, this introduces git_buf_initbuf
which is an empty string that is used to initialize the git_buf ptr
value even for new buffers. Now the git_buf ptr will always point to
a valid NUL-terminated string.
This change required jumping through a few hoops for git_buf_grow
and git_buf_free to distinguish between a actual allocated buffer
and the global initial value. Also, this moves the allocation
related functions to be next to each other near the top of buffer.c.
|
|
c63728cd
|
2011-11-29T16:39:49
|
|
Make git_buf functions always maintain a valid cstr.
At a tiny cost of 1 extra byte per allocation, this makes
git_buf_cstr into basically a noop, which simplifies error
checking when trying to convert things to use dynamic allocation.
This patch also adds a new function (git_buf_copy_cstr) for copying
the cstr data directly into an external buffer.
|
|
3aa294fd
|
2011-11-28T10:42:57
|
|
Add two string git_buf_join and tweak input error checking.
This commit addresses two of the comments:
* renamed existing n-input git_buf_join to git_buf_join_n
* added new git_buf_join that always takes two inputs
* moved some parameter error checking to asserts
* extended unit tests to cover new version of git_buf_join
|
|
8c74d22e
|
2011-11-27T21:47:58
|
|
Extend git_buf with new utility functions and unit tests.
Add new functions to git_buf for:
* initializing a buffer from a string
* joining one or more strings onto a buffer with separators
* swapping two buffers in place
* extracting data from a git_buf (leaving it empty)
Also, make git_buf_free leave a git_buf back in its initted state,
and slightly tweak buffer allocation sizes and thresholds.
Finally, port unit tests to clay and extend with lots of new tests
for the various git_buf functions.
|
|
8114ee4c
|
2011-09-22T10:17:43
|
|
Merge pull request #405 from carlosmn/http-ls
Implement ls-remote over HTTP
|
|
bb742ede
|
2011-09-19T01:54:32
|
|
Cleanup legal data
1. The license header is technically not valid if it doesn't have a
copyright signature.
2. The COPYING file has been updated with the different licenses used in
the project.
3. The full GPLv2 header in each file annoys me.
|
|
c7c30513
|
2011-09-05T21:38:56
|
|
buffer: add git_buf_consume
Moves the content after 'end' to the beginning of the buffer
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
b87600cb
|
2011-09-05T02:33:02
|
|
buffer: add git_buf_clear
Set the size to zero so the memory that has already been allocated
can be reused
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
|
|
afeecf4f
|
2011-07-09T02:10:46
|
|
odb: Direct writes are back
DIRECT WRITES ARE BACK AND FASTER THAN EVER. The streaming writer to the
ODB was an overkill for the smaller objects like Commit and Tags; most
of the streaming logic was taking too long.
This commit makes Commits, Tags and Trees to be built-up in memory, and
then written to disk in 2 pushes (header + data), instead of streaming
everything.
This is *always* faster, even for big files (since the git_filebuf class
still does streaming writes when the memory cache overflows). This is
also a gazillion lines of code smaller, because we don't have to
precompute the final size of the object before starting the stream (this
was kind of defeating the point of streaming, anyway).
Blobs are still written with full streaming instead of loading them in
memory, since this is still the fastest way.
A new `git_buf` class has been added. It's missing some features, but
it'll get there.
|