Commit Graph

77 Commits

Author SHA1 Message Date
Mohammed Bilal
e579e0f707 New upstream version 1.4.3+dfsg.1 2022-05-05 10:45:21 +00:00
Pirate Praveen
c25aa7cd82 New upstream version 1.3.0+dfsg.1 2021-12-10 16:42:08 +05:30
Utkarsh Gupta
22a2d3d5ef New upstream version 1.1.0+dfsg.1 2020-12-07 04:06:37 +05:30
Jongmin Kim
ac3d33df5d New upstream version 0.28.1+dfsg.1 2019-05-12 00:29:21 +09:00
Pirate Praveen
eae0bfdcd8 New upstream version 0.27.0+dfsg.1 2018-04-26 18:06:07 +05:30
Etienne Samson
7414acf5f9 parameter 'id' not found in the function declaration 2017-01-23 13:32:34 +01:00
Michael Tesch
87aaefe20b write_tree: use shared buffer for writing trees
The function to write trees allocates a new buffer for each tree.
This causes problems with performance when performing a lot
of actions involving writing trees, e.g. when doing many merges.
Fix the issue by instead handing in a shared buffer, which is then
re-used across the calls without having to re-allocate between
calls.
2016-12-12 10:46:05 -05:00
Carlos Martín Nieto
9464f9ebc1 Introduce a function to create a tree based on a different one
Instead of going through the usual steps of reading a tree recursively
into an index, modifying it and writing it back out as a tree, introduce
a function to perform simple updates more efficiently.

`git_tree_create_updated` avoids reading trees which are not modified
and supports upsert and delete operations. It is not as versatile as
modifying the index, but it makes some common operations much more
efficient.
2016-05-17 17:41:05 +02:00
Edward Thomson
f0224772ee git_object_dup: introduce typesafe versions 2016-03-23 17:08:37 -04: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
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
Carlos Martín Nieto
978fbb4c34 treebuilder: don't keep removed entries around
If the user wants to keep a copy for themselves, they should make a
copy. It adds unnecessary complexity to make sure the returned entries
are valid until the builder is cleared.
2014-06-10 15:14:13 +02:00
Carlos Martín Nieto
4d3f1f9740 treebuilder: use a map instead of vector to store the entries
Finding a filename in a vector means we need to resort it every time we
want to read from it, which includes every time we want to write to it
as well, as we want to find duplicate keys.

A hash-map fits what we want to do much more accurately, as we do not
care about sorting, but just the particular filename.

We still keep removed entries around, as the interface let you assume
they were going to be around until the treebuilder is cleared or freed,
but in this case that involves an append to a vector in the filter case,
which can now fail.

The only time we care about sorting is when we write out the tree, so
let's make that the only time we do any sorting.
2014-06-10 15:14:13 +02:00
Michael Anderson
31b0cb518f Fixed miscellaneous documentation errors. 2014-05-23 15:57:20 +08:00
Carlos Martín Nieto
f000ee4e5b tree: remove legacy 'oid' naming
Rename git_tree_entry_byoid() to _byid() as per the convention.
2014-01-25 08:15:44 +01:00
Arthur Schreiber
529f342aba Align git_tree_entry_dup. 2014-01-14 21:33:59 +01:00
Russell Belfer
452c7de668 Add git_treebuilder_insert test and clarify doc
This wasn't being tested and since it has a callback, I fixed it
even though the return value of this callback is not treated like
any of the other callbacks in the API.
2013-12-12 14:16:40 -08:00
Carlos Martín Nieto
13f670a5d9 tree: allow retrieval of raw attributes
When a tool needs to recreate the tree object (for example an
interface to another VCS), it needs to use the raw attributes,
forgoing any normalization.
2013-10-08 10:07:31 +02:00
Andy Lindeman
51b0397a66 Small grammar fix in docs 2013-07-15 23:40:57 -04:00
Andreas Linde
e196716457 Fixed most documentation header bugs
Fixed a few header @param and @return typos with the help of -Wdocumentation in Xcode.

The following warnings have not been fixed:
common.h:213 - Not sure how the documentation format is for '...'
notes.h:102 - Correct @param name but empty text
notes.h:111 - Correct @param name but empty text
pack.h:140 - @return missing text
pack.h:148 - @return missing text
2013-06-24 15:33:41 +02:00
Russell Belfer
58206c9ae7 Add cat-file example and increase const use in API
This adds an example implementation that emulates git cat-file.
It is a convenient and relatively simple example of getting data
out of a repository.

Implementing this also revealed that there are a number of APIs
that are still not using const pointers to objects that really
ought to be.  The main cause of this is that `git_vector_bsearch`
may need to call `git_vector_sort` before doing the search, so a
const pointer to the vector is not allowed.  However, for tree
objects, with a little care, we can ensure that the vector of
tree entries is always sorted and allow lookups to take a const
pointer.  Also, the missing const in commit objects just looks
like an oversight.
2013-05-16 10:38:27 -07:00
Russell Belfer
d77611022c Standardize cast versions of git_object accessors
This removes the GIT_INLINE versions of the simple git_object
accessors and standardizes them with a helper macro in src/object.h
to build the function bodies.
2013-04-29 14:22:06 -07:00
John Wiegley
5fb9820664 Added git_treebuilder_entrycount
Conflicts:
	src/tree.c
2013-01-28 16:35:43 -06:00
Russell Belfer
98527b5b24 Add git_tree_entry_cmp and git_tree_entry_icmp
This adds a new external API git_tree_entry_cmp and a new internal
API git_tree_entry_icmp for sorting tree entries.  The case
insensitive one is internal only because general users should
never be seeing case-insensitively sorted trees.
2013-01-15 09:51:35 -08:00
Edward Thomson
359fc2d241 update copyrights 2013-01-08 17:31:27 -06:00
Russell Belfer
9950d27ab6 Clean up iterator APIs
This removes the need to explicitly pass the repo into iterators
where the repo is implied by the other parameters.  This moves
the repo to be owned by the parent struct.  Also, this has some
iterator related updates to the internal diff API to lay the
groundwork for checkout improvements.
2012-12-10 15:38:28 -08:00
Russell Belfer
16248ee2d1 Fix up some missing consts in tree & index
This fixes some missed places where we can apply const-ness to
various public APIs.

There are still some index and tree APIs that cannot take const
pointers because we sort our `git_vectors` lazily and so we can't
reliably bsearch the index and tree content without applying a
`git_vector_sort()` first.

This also fixes some missed places where size_t can be used and
where const can be applied to a couple internal functions.
2012-11-27 13:18:29 -08:00
Ben Straub
f45d51ff8e API updates for index.h 2012-11-27 13:18:28 -08:00
Russell Belfer
e120123e36 API review / update for tree.h 2012-11-27 13:18:28 -08:00
Vicent Marti
276ea401b3 index: Add git_index_write_tree 2012-11-01 20:17:10 +01:00
Russell Belfer
0d64bef941 Add complex checkout test and then fix checkout
This started as a complex new test for checkout going through the
"typechanges" test repository, but that revealed numerous issues
with checkout, including:

* complete failure with submodules
* failure to create blobs with exec bits
* problems when replacing a tree with a blob because the tree
  "example/" sorts after the blob "example" so the delete was
  being processed after the single file blob was created

This fixes most of those problems and includes a number of other
minor changes that made it easier to do that, including improving
the TYPECHANGE support in diff/status, etc.
2012-10-09 11:59:34 -07:00
nulltoken
9d7ac675d0 tree entry: rename git_tree_entry_attributes() into git_tree_entry_filemode() 2012-08-21 23:15:13 +02:00
nulltoken
a7dbac0b23 filemode: deploy enum usage 2012-08-21 23:15:10 +02:00
nulltoken
66439b0b1a treebuilder: enhance attributes handling on insertion 2012-08-19 14:11:59 +02:00
Carlos Martín Nieto
a6bf16878a tree: allow the user to skip an entry or cancel the walk
Returning a negative cancels the walk, and returning a positive one
causes us to skip an entry, which was previously done by a negative
value.

This allows us to stay consistent with the rest of the functions that
take a callback and keeps the skipping functionality.
2012-08-13 14:07:47 +02:00
Vicent Marti
51e1d80846 Merge remote-tracking branch 'arrbee/tree-walk-fixes' into development
Conflicts:
	src/notes.c
	src/transports/git.c
	src/transports/http.c
	src/transports/local.c
	tests-clar/odb/foreach.c
2012-08-06 12:41:08 +02:00
Russell Belfer
2031760c62 Fix git_tree_walk to return user error
This makes sure that an error code returned by the callback function
of `git_tree_walk` will stop the iteration and get propagated back
to the caller verbatim.

Also, this adds a minor helper function `git_tree_entry_byoid` that
searches a `git_tree` for an entry with the given OID.  This isn't
a fast function, but it's easier than writing the loop yourself as
an external user of the library.
2012-07-26 16:10:22 -07:00
nulltoken
b8457baae2 portability: Improve x86/amd64 compatibility 2012-07-24 16:10:12 +02:00
Vicent Marti
46ea40d995 tree: Rename entry_copy to entry_dup 2012-06-29 17:08:36 +02:00
Vicent Marti
0e2fcca850 tree: Bring back entry_bypath
Smaller, simpler, faster.
2012-06-29 02:21:12 +02:00
Bruce Mitchener
d73c94b21c Fix spelling errors. 2012-05-19 20:26:52 +07:00
Vicent Martí
904b67e69f errors: Rename error codes 2012-05-18 01:48:50 +02:00
Vicent Martí
e172cf082e errors: Rename the generic return codes 2012-05-18 01:26:26 +02:00
Vicent Martí
9d0011fd83 tree: Naming conventions 2012-05-16 19:24:35 +02:00
Vicent Martí
cedf9ca955 tree: Kill the git_tree_diff functions
These are deprecated and replaced with the diffing code in git2/diff.h
2012-05-16 19:24:35 +02:00
Sascha Cunz
0c9a5565f7 Add missing GIT_EXTERN declarations 2012-05-14 19:56:35 +02:00
Russell Belfer
e1bcc19110 Revert GIT_STATUS constants to avoid issues
This reverts the changes to the GIT_STATUS constants and adds a
new enumeration to describe the type of change in a git_diff_delta.
I don't love this solution, but it should prevent strange errors
from occurring for now.  Eventually, I would like to unify the
various status constants, but it needs a larger plan and I just
wanted to eliminate this breakage quickly.
2012-03-02 15:51:55 -08:00
Russell Belfer
3a4375901a Clean up diff implementation for review
This fixes several bugs, updates tests and docs, eliminates the
FILE* assumption in favor of printing callbacks for the diff patch
formatter helpers, and adds a "diff" example function that can
perform a diff from the command line.
2012-03-02 15:49:28 -08:00
Russell Belfer
65b09b1ded Implement diff lists and formatters
This reworks the diff API to separate the steps of producing
a diff descriptions from formatting the diff.  This will allow
us to share diff output code with the various diff creation
scenarios and will allow us to implement rename detection as
an optional pass that can be run on a diff list.
2012-03-02 15:49:28 -08:00
schu
5e0de32818 Update Copyright header
Signed-off-by: schu <schu-github@schulog.org>
2012-02-13 17:11:09 +01:00