|
c0335005
|
2011-05-06T12:42:47
|
|
Move config to a backend structure
Configuration options can come from different sources. Currently,
there is only support for reading them from a flat file, but it might
make sense to read it from a database at some point.
Move the parsing code into src/config_file.c and create an include
file include/git2/config_backend.h to allow for other backends to be
developed.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
ca8d2dfc
|
2011-05-05T16:22:06
|
|
Merge remote-tracking branch 'upstream/development' into config
|
|
094aaaae
|
2011-05-05T15:16:15
|
|
config: store the section name separately
The section and variable names use different rules, so store them as
two different variables internally.
This will simplify the configuration-writing code as well later on,
but even with parsing, the code is simpler.
Take this opportunity to add a variable to the list directly when
parsing instead of passing through config_set.
|
|
cc3b82e3
|
2011-05-02T15:29:50
|
|
Merge pull request #151 from carlosmn/root-commit.
Support root commits
|
|
fde97669
|
2011-05-02T15:26:16
|
|
Merge pull request #146 from nordsturm/fix_subtrees.
Fix tree-entry attribute convertion (fix corrupted trees)
|
|
1648fbd3
|
2011-05-02T01:12:53
|
|
Re-apply missing patches
|
|
d4ad0771
|
2011-05-01T14:59:50
|
|
Merge pull request #145 from schu/fix-unused-warnings.
Fix -Wunused-but-set-variable warnings
|
|
273c8bc0
|
2011-05-01T14:59:11
|
|
Merge pull request #147 from nordsturm/fix_pack_backend_leak.
Fix memory leak in pack_backend__free
|
|
c7b79af3
|
2011-05-01T21:31:58
|
|
pack-odb: Check `mtime` instead of folder size
Do not check the folder's size to detect new packfiles at runtime. This
doesn't work on Win32.
|
|
8381238e
|
2011-04-27T14:59:59
|
|
commit: support a root commits
A root commit is a commit whose branch (usually what HEAD points to)
doesn't exist (yet). This situation can happen when the commit is the
first after 1) a repository is initialized or 2) a orphan checkout has
been performed.
Take this opportunity to remove the symbolic link check, as
git_reference_resolve works on OID refs as well.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
68a146c1
|
2011-04-29T11:45:42
|
|
refs: don't loose info on resolve error
Typical use is git_reference_resolve(&ref, ref). Currently, if there is
an error, ref will point to NULL, causing the user to lose that
reference.
Always update resolved_ref instead of just on finding an OID ref,
storing the last valid reference in it.
This change helps simplify the code for allowing root commits.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
ed6c462c
|
2011-04-27T17:30:45
|
|
Fix memory leak in pack_backend__free
|
|
0130d818
|
2011-04-27T11:20:38
|
|
Fix git__strntolower
Obviously, the whole string should be lower-cased and not just the
last char.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
555ce568
|
2011-04-26T13:22:45
|
|
Fix tree-entry attribute convertion (fix corrupted trees)
Magic constant replaced by direct to-string covertion because of:
1) with value length 6 (040000 - subtree) final tree will be corrupted;
2) for wrong values length <6 final tree will be corrupted too.
|
|
402a47a7
|
2011-04-26T11:29:05
|
|
Fix -Wunused-but-set-variable warnings
As of gcc 4.6 -Wall includes -Wunused-but-set-variable. Use GIT_UNUSED
or remove actually unused variables to prevent those warnings.
|
|
7df49e9e
|
2011-04-23T14:36:01
|
|
Merged pull request #139 from jpfender/merge-head-file.
refs: Allow MERGE_HEAD in normalize_name()
|
|
f7a5058a
|
2011-04-24T00:31:43
|
|
index: Refactor add/replace methods
Removed the optional `replace` argument, we now have 4 add methods:
`git_index_add`: add or update from path
`git_index_add2`: add or update from struct
`git_index_append`: add without replacing from path
`git_index_append2`: add without replacing from struct
Yes, this breaks the bindings.
|
|
f16c0a9d
|
2011-04-23T14:08:17
|
|
Merged pull request #140 from jpfender/insert-replace.
index: Allow user to toggle whether to replace an index entry
|
|
5ba7c4cb
|
2011-04-23T14:01:01
|
|
Merged pull request #143 from nordsturm/fix_loop.
Fix going into infinite loop in read_header_loose()
|
|
1d008781
|
2011-04-23T23:59:38
|
|
Fix conversion warning in MSVC
|
|
a3ced637
|
2011-04-22T17:36:28
|
|
Fix going into infinite loop in read_header_loose()
read_header_loose causes infinite loop on this file:
$ cat ../libcppgit/bin/sample-repo/test_mailbox/.git/objects/8f/e274605cbc740a2a957f44b2722a8a73915a09 | base64
eAErKUpNVTAzYzA0MDAzMVHISUxKzSlmWLgkuyN5+rxr6juMPR2EmN8s7Vl9D6oiN7UkkcHJdLbl
7Z3N/oxfE0W8wrSbuFRkAwDFfBn1
|
|
729b6f49
|
2011-04-21T10:40:54
|
|
index: Allow user to toggle whether to replace an index entry
When in the middle of a merge, the index needs to contain several files
with the same name. git_index_insert() used to prevent this by not adding a new entry if an entry with the same name already existed.
|
|
df30eac1
|
2011-04-21T10:38:37
|
|
refs: Allow MERGE_HEAD in normalize_name()
Do not return with EINVALIDREFNAME when trying to normalize MERGE_HEAD's
name.
|
|
a68cf94b
|
2011-04-19T16:40:52
|
|
Fix const char ** warning
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
a99264bf
|
2011-04-19T16:34:22
|
|
config: allow uppercase number suffixes
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
2571cc3c
|
2011-04-15T20:32:31
|
|
Close file descriptor when writing a blob
|
|
90d743cd
|
2011-04-15T15:12:37
|
|
Refresh the list of packfiles on each ODB query
Fixes the issue where object lookups were failing right after a pull on
an open repository.
|
|
1bfa053e
|
2011-04-13T21:57:35
|
|
Close an object in packed_find_peel
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
def3fef1
|
2011-04-12T15:52:34
|
|
Add `git_tag_list`
Lists all the tag references in a repository using a custom callback.
Includes unit tests courtesy of Emeric Fermas <3
|
|
52ca4f8a
|
2011-04-11T17:51:05
|
|
Use internal strtol
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
631752aa
|
2011-04-11T17:49:47
|
|
Fix number suffix detection
Allow a number not to have a suffix. This broke when adding the
suffixes.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
55c197cd
|
2011-04-11T17:41:21
|
|
Merge upstream/development
|
|
1eb0f68e
|
2011-04-11T12:38:50
|
|
merge branch development
|
|
a6359408
|
2011-04-10T12:23:55
|
|
Use Z_BEST_SPEED for filebuf deflating
This is what Git uses by default for all deflating.
|
|
53b7560b
|
2011-04-09T16:16:09
|
|
Fix `time_t` conversion on Win32
|
|
14eb94ee
|
2011-04-09T16:06:17
|
|
Fix `gmtime` issues in Win32
|
|
8416c9ad
|
2011-04-09T15:31:12
|
|
Rename `git_signature_new_now`
The new name is more cool.
|
|
9e9e6ae1
|
2011-04-05T16:15:54
|
|
Add API git_signature_new_now
Most tags will have a timestamp of whenever the code is running and
dealing with time and timezones is error-prone. Optimize for this case
by adding a function which causes the signature to be created with a
current timestamp.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
076141a1
|
2011-04-07T14:38:03
|
|
Add a few malloc checks
Add checks to see if malloc failed when allocating the tag members and
signature members.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
4a34b3a9
|
2011-04-09T15:49:44
|
|
Add two new accessors to the repository
git_repository_path() and git_repository_workdir() respectively return the path to the git repository and the working directory. Those paths are absolute and normalized.
|
|
c6e65aca
|
2011-04-09T15:22:11
|
|
Properly check `strtol` for errors
We are now using a custom `strtol` implementation to make sure we're not
missing any overflow errors.
|
|
41233c40
|
2011-04-08T12:42:18
|
|
Add new method `git_repository_is_empty`
|
|
d79f1da6
|
2011-04-08T12:14:33
|
|
refs: Fix issue when packing weak tags
Weak tags (e.g. tags that point directly to a normal object instead of a
tag object) were failing to be packed.
|
|
7bc66a79
|
2011-04-06T10:58:14
|
|
tag: don't allow tags to non-existent objects
These indicate an inconsistency in the repository which we've created,
so don't allow them.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
81234673
|
2011-04-05T16:53:32
|
|
tag: discover the target type if needed
Don't blindly pass the target type to git_tag_type2string as it will
give an empty string on GIT_OBJ_ANY which would cause us to create an
invalid tag object.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
6ac247b3
|
2011-04-06T11:59:40
|
|
tag: don't check twice if an object exists
Remove the check in git_tag_create_frombuffer as it's done by
tag_create already.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
5924b282
|
2011-04-06T10:48:31
|
|
Added git_commit_tree_oid and git_commit_parent_oid.
|
|
98ac6780
|
2011-04-06T02:22:24
|
|
fix git_treebuilder_insert probrem.
couldn't add new entry when inserting new one with `git_treebuilder_insert`.
|
|
5868cd02
|
2011-04-08T03:28:38
|
|
Do not assert error codes on Hiredis backend
We cannot assume that Redis is never going to return an error code; when
Reddit fails, we cannot crash our library, we need to handle the crash
gracefully.
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
8a64bc29
|
2011-04-03T21:43:51
|
|
redis backend
|
|
b075b991
|
2011-04-07T16:54:10
|
|
Add getting and setting of long int variables
long int is a safer type than int unless the user knows that the
variable is going to be quite small.
The code has been reworked to use strtol instead of the more
complicated sscanf.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
7a4dfd60
|
2011-04-07T11:30:02
|
|
Simplify error path in config_set
Many error paths freed their local data althought it is freed later on
when the end of the function notices that there was an error. This can
cause double frees and invalid memory access.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
493384e3
|
2011-04-07T11:24:16
|
|
config: make cvar_free behave more like other free functions
Make cvar_free return void instad of the next element, as it was
mostly a hack to make cvar_list_free shorter but it's now using the
list macros.
Also check if the input is NULL and return immediately in that case.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
6b45cb8a
|
2011-04-06T18:27:31
|
|
config: use and implement list macros
Use list macros instead of manually changing the head and/or tail of
the variable list.
|
|
fd279b26
|
2011-04-07T16:58:42
|
|
index.c: Correctly check whether index contains extended entries
Although write_index() supports writing extended header versions for
index, this was never done as there was no check for extended index
entries.
Introduce function is_index_extended() that checks whether an index
contains extended entries and check whether an index is extended before
writing it to disk, adjusting its version number if necessary.
|
|
0d280ea4
|
2011-04-06T16:31:06
|
|
config: use snprintf instead of sprintf
Due to the preconditions, there should never be an error, but it pays
to be paranoid.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
956ad0ed
|
2011-04-06T15:51:10
|
|
config: free the file buffer earlier
There is no need to keep config file in memory until the the
configuration is freed. Free the buffer immediately after the
configuration has been parsed.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
8bd6c0ab
|
2011-04-06T15:49:29
|
|
Merge remote-tracking branch 'upstream/development' into config
|
|
acab3bc4
|
2011-04-06T15:31:42
|
|
config: move str(n)tolower to the git__ namespace
Non-static functions in a library should always have a prefix
namespace.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
aa793424
|
2011-04-06T15:27:12
|
|
config: coding style fixes
|
|
6776fd51
|
2011-04-06T15:17:06
|
|
config: really compare the variable name case-insensitively
Make cvar_name_match really compare the last part of the variable
ignoring the case.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
0ad6efa1
|
2011-04-04T19:24:19
|
|
Build & write custom trees in memory
|
|
2470be13
|
2011-04-04T17:06:31
|
|
config: variable name on its own means true
If a variable name appears on its own in a line, it's assumed the
value is true. Store the variable name as NULL in that case.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
9b7a6a99
|
2011-04-04T16:17:39
|
|
config: check for EOF before newline
If a line ends at EOF there is no need to check for the newline
character and doing so will cause us to read memory beyond the
allocatd memory as we check for the Windows-style new-line, which is
two bytes long.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
72946881
|
2011-04-04T15:26:43
|
|
config: support multiline values
If a variable value has the traditional continuation character (\) as
the last non-space character in the line, then we continue reading the
value on the next line.
Using more than two lines is also supported.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
2454ce78
|
2011-04-04T11:25:55
|
|
config: don't mix buffer reading methods
Make header and variable parse functions use their own buffers instead
of giving them the line they need to read as a parameter which they
mostly ignore.
This is in preparation for multiline configuration variables.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
9f1b54d6
|
2011-04-04T15:07:47
|
|
config: also free the file buffer on error
On error, the buffer containing the file contents also needs to be
freed.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
fe116e26
|
2011-04-04T15:33:14
|
|
config: Fix typo and remove debug statement
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
b153589b
|
2011-04-03T18:31:45
|
|
Make reinitializing a repository return GIT_ENOTIMPLEMENTED instead of GIT_SUCCESS
|
|
d69d0185
|
2011-04-04T13:05:20
|
|
Add a fake wstream to the ODB
Streaming writes will no longer fail when writing to a backend that
doesn't support streaming writes but supports direct ones.
Now we create a fake stream on memory and then write it as a single
block using the backend `write` callback.
|
|
29e1789b
|
2011-04-04T12:14:03
|
|
Fix the git_tree_write implementation
|
|
47d8ec56
|
2011-04-03T17:18:56
|
|
New external API method: `git_tree_create`
Creates a tree by scanning the index file. The method handles recursive
creation of trees for subdirectories and adds them to the parent tree.
|
|
3e3e4631
|
2011-04-02T12:49:14
|
|
Merge branch 'tagging' of https://github.com/nulltoken/libgit2 into development
Conflicts:
include/git2/tag.h
src/tag.c
|
|
720d5472
|
2011-04-02T12:42:04
|
|
Change `parse` methods to const buffer
Signed-off-by: Vicent Marti <tanoku@gmail.com>
|
|
d8ad64d3
|
2011-04-02T12:28:35
|
|
Merge branch 'parse-tag-buffer' of https://github.com/carlosmn/libgit2 into development
|
|
f026f2b9
|
2011-03-31T15:29:13
|
|
Merge upstream/development
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
11d0e705
|
2011-03-31T10:50:11
|
|
Add support for subsections
A variable name is stored internally with its section the way it
appeared in the configuration file in order to have the information
about what parts are case-sensitive inline.
Really implement parse_section_header_ext and move the assignment of
variables to config_parse.
The variable name matching is now done in a case-away way by
cvar_name_match and cvar_section_match. Before the user sees it, it's
normalized to the two- or three-dot version.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
6482929b
|
2011-03-30T18:51:02
|
|
move build_varname above parse_section
|
|
d7354d70
|
2011-03-30T16:22:31
|
|
build_varname: lowercase the variable name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
0bbaf9aa
|
2011-03-30T16:11:55
|
|
config_parse: no need to check if current_section is non-null
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
923fe455
|
2011-03-30T16:02:57
|
|
Add strtolower and strntolower functions
As parts of variable names are case-sensitive, we need these functions.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
df22949a
|
2011-03-31T12:51:17
|
|
config_set: really replace the value on overwrite
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
ac26e245
|
2011-03-30T23:46:54
|
|
Rename git_tag_create_o_f() to git_tag_create_fo()
|
|
9e680bcc
|
2011-03-30T23:26:36
|
|
Add git_tag_delete()
|
|
a50c1458
|
2011-03-30T23:16:30
|
|
Add git_tag_create_o_f() and git_tag_create_f() which overwrite existing tag reference, if any
|
|
bf4c39f9
|
2011-03-30T22:30:55
|
|
Prevent tag_create() from creating a conflicting reference
|
|
8ecc5ae5
|
2011-03-30T16:48:14
|
|
git_config_set_int: use the right buffer
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
e21881d1
|
2011-03-30T15:16:25
|
|
git_config: reorder fields according to use
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
dadc0158
|
2011-03-30T15:05:15
|
|
config: use a singly-linked list instead of a hash table
Such a list preserves the order the variables were first read in which
will be useful later for merging different data-sets. Furthermore,
reading and writing out the same configuration should not reorganize
the variables, which could happen when iterating through all the items
in a hash table.
A hash table is overkill for this small a data-set anyway.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
d28830c2
|
2011-03-30T13:40:19
|
|
Store the parsed variables
Store the key-value pair as strings.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
934fcf78
|
2011-03-30T11:32:08
|
|
Initialise the config reader in config_parse
git_config_open shouldn't have to initialise variables that are only
used inside config_parse and its callees.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
2974aa94
|
2011-03-30T11:30:40
|
|
Determine variable type at runtime
Config variables should be interpreted at run-time, as we don't know if a
zero means false or zero, or if yes means true or "yes".
As a variable has no intrinsic type, git_cvtype is gone and the public
API takes care of enforcing a few rules.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
2e445cac
|
2011-03-30T11:07:09
|
|
build_varname: allocate memory
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
83c95128
|
2011-03-24T14:15:00
|
|
normalize_name: allow more references under refs/
Allow any well-formed reference name to live under refs/ removing the
condition that they be under refs/{heads,tags,remotes}/ as was the
design of git.
An exception is made for HEAD which is allowed to contain an OID
reference in detached HEAD state.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
9a53df7e
|
2011-03-29T19:40:02
|
|
refs: Don't allow references to inexistent OIDs
|
|
95cde17c
|
2011-03-29T19:22:21
|
|
Enforce coding conventions in refs.c
Internal methods are static and without the git prefix.
'Force' methods have a `_f` prefix to match the other 'force' methods.
|
|
dad4a4d5
|
2011-03-29T10:47:48
|
|
rename: don't return early if the target ref exists
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
fa204962
|
2011-03-28T12:00:50
|
|
Allow forcing the creation or renaming of references
Add internal reference create and rename functions which take a force
parameter, telling them to overwrite an existing reference if it
exists.
These functions try to update the reference if it's of the same type
as the one it's going to be replaced by. Otherwise the old reference
becomes invalid.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
baad182c
|
2011-03-28T11:31:58
|
|
Add GIT_EEXISTS error code
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|
|
9a3c5e55
|
2011-03-29T17:44:10
|
|
Expose config API for setters, getters and foreach
These functions can be used to query or modify the variables in a
given configuration. No sanity checking is done on the variable names.
This is mostly meant as an API preview.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
|