]>
git.proxmox.com Git - libgit2.git/log
Carlos Martín Nieto [Wed, 27 Apr 2011 09:20:38 +0000 (11:20 +0200)]
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>
Carlos Martín Nieto [Tue, 19 Apr 2011 14:40:52 +0000 (16:40 +0200)]
Fix const char ** warning
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Tue, 19 Apr 2011 14:38:52 +0000 (16:38 +0200)]
config: export git_config_[sg]et_long
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Tue, 19 Apr 2011 14:34:22 +0000 (16:34 +0200)]
config: allow uppercase number suffixes
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Mon, 11 Apr 2011 16:01:01 +0000 (18:01 +0200)]
config: add tests for number suffix
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Mon, 11 Apr 2011 15:51:05 +0000 (17:51 +0200)]
Use internal strtol
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Mon, 11 Apr 2011 15:49:47 +0000 (17:49 +0200)]
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>
Carlos Martín Nieto [Mon, 11 Apr 2011 15:41:21 +0000 (17:41 +0200)]
Merge upstream/development
Vicent Marti [Sun, 10 Apr 2011 22:25:41 +0000 (15:25 -0700)]
Fix path normalization tests
They were backtracking too deep into the filesystem on Linux, where the
tests were running directly on `tmp/`.
Vicent Marti [Sun, 10 Apr 2011 19:23:55 +0000 (12:23 -0700)]
Use Z_BEST_SPEED for filebuf deflating
This is what Git uses by default for all deflating.
Vicent Marti [Sun, 10 Apr 2011 00:45:38 +0000 (17:45 -0700)]
Import 'with' from __future__ in the build script
Vicent Marti [Sat, 9 Apr 2011 23:16:09 +0000 (16:16 -0700)]
Fix `time_t` conversion on Win32
Vicent Marti [Sat, 9 Apr 2011 23:06:17 +0000 (16:06 -0700)]
Fix `gmtime` issues in Win32
Vicent Marti [Sat, 9 Apr 2011 22:31:12 +0000 (15:31 -0700)]
Rename `git_signature_new_now`
The new name is more cool.
Carlos Martín Nieto [Tue, 5 Apr 2011 14:15:54 +0000 (16:15 +0200)]
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>
Carlos Martín Nieto [Thu, 7 Apr 2011 11:27:34 +0000 (13:27 +0200)]
Fix the signature documentation
The parameters are given by '@param name' and not '@name'.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Thu, 7 Apr 2011 12:38:03 +0000 (14:38 +0200)]
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>
nulltoken [Sat, 9 Apr 2011 13:49:44 +0000 (15:49 +0200)]
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.
Vicent Marti [Sat, 9 Apr 2011 22:22:11 +0000 (15:22 -0700)]
Properly check `strtol` for errors
We are now using a custom `strtol` implementation to make sure we're not
missing any overflow errors.
Vicent Marti [Fri, 8 Apr 2011 22:35:25 +0000 (15:35 -0700)]
Do not declare variables in the middle of a func
Vicent Marti [Fri, 8 Apr 2011 19:42:18 +0000 (12:42 -0700)]
Add new method `git_repository_is_empty`
Vicent Marti [Fri, 8 Apr 2011 19:41:17 +0000 (12:41 -0700)]
Remove unused variables from test files
Vicent Marti [Fri, 8 Apr 2011 19:14:33 +0000 (12:14 -0700)]
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.
Carlos Martín Nieto [Wed, 6 Apr 2011 09:59:40 +0000 (11:59 +0200)]
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>
Carlos Martín Nieto [Wed, 6 Apr 2011 08:58:14 +0000 (10:58 +0200)]
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>
Carlos Martín Nieto [Tue, 5 Apr 2011 14:53:32 +0000 (16:53 +0200)]
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>
Jakob Pfender [Mon, 4 Apr 2011 14:20:09 +0000 (16:20 +0200)]
index.h: Add IDXENTRY flags needed for index operations
Add several IDXENTRY flags that need to be checked in
order to properly implement update-index --refresh.
Sam [Wed, 6 Apr 2011 00:48:31 +0000 (10:48 +1000)]
Added git_commit_tree_oid and git_commit_parent_oid.
Shuhei Tanuma [Tue, 5 Apr 2011 17:22:24 +0000 (02:22 +0900)]
fix git_treebuilder_insert probrem.
couldn't add new entry when inserting new one with `git_treebuilder_insert`.
Vicent Marti [Fri, 8 Apr 2011 00:28:38 +0000 (03:28 +0300)]
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>
Dmitry Kovega [Sun, 3 Apr 2011 17:43:51 +0000 (21:43 +0400)]
redis backend
Carlos Martín Nieto [Thu, 7 Apr 2011 14:54:10 +0000 (16:54 +0200)]
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>
Carlos Martín Nieto [Thu, 7 Apr 2011 09:30:02 +0000 (11:30 +0200)]
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>
Carlos Martín Nieto [Thu, 7 Apr 2011 09:24:16 +0000 (11:24 +0200)]
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>
Carlos Martín Nieto [Wed, 6 Apr 2011 16:27:31 +0000 (18:27 +0200)]
config: use and implement list macros
Use list macros instead of manually changing the head and/or tail of
the variable list.
Carlos Martín Nieto [Wed, 6 Apr 2011 14:31:06 +0000 (16:31 +0200)]
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>
Carlos Martín Nieto [Wed, 6 Apr 2011 13:51:10 +0000 (15:51 +0200)]
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>
Carlos Martín Nieto [Wed, 6 Apr 2011 13:49:29 +0000 (15:49 +0200)]
Merge remote-tracking branch 'upstream/development' into config
Carlos Martín Nieto [Wed, 6 Apr 2011 13:31:42 +0000 (15:31 +0200)]
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>
Carlos Martín Nieto [Wed, 6 Apr 2011 13:27:12 +0000 (15:27 +0200)]
config: coding style fixes
Carlos Martín Nieto [Wed, 6 Apr 2011 13:17:06 +0000 (15:17 +0200)]
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>
Vicent Marti [Mon, 4 Apr 2011 16:24:19 +0000 (19:24 +0300)]
Build & write custom trees in memory
Carlos Martín Nieto [Mon, 4 Apr 2011 15:07:47 +0000 (17:07 +0200)]
config: test for a variable on its own
If a variable is on its own, truth should be assumed. Check this is
true in our code.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Mon, 4 Apr 2011 15:06:31 +0000 (17:06 +0200)]
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>
Carlos Martín Nieto [Mon, 4 Apr 2011 14:44:23 +0000 (16:44 +0200)]
config: add tests
These tests are basic, but they should tell us when we've broken
something.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Mon, 4 Apr 2011 14:17:39 +0000 (16:17 +0200)]
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>
Carlos Martín Nieto [Mon, 4 Apr 2011 13:26:43 +0000 (15:26 +0200)]
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>
Carlos Martín Nieto [Mon, 4 Apr 2011 09:25:55 +0000 (11:25 +0200)]
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>
Carlos Martín Nieto [Mon, 4 Apr 2011 13:07:47 +0000 (15:07 +0200)]
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>
Carlos Martín Nieto [Mon, 4 Apr 2011 13:33:14 +0000 (15:33 +0200)]
config: Fix typo and remove debug statement
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
nulltoken [Sun, 3 Apr 2011 16:31:45 +0000 (18:31 +0200)]
Make reinitializing a repository return GIT_ENOTIMPLEMENTED instead of GIT_SUCCESS
nulltoken [Sun, 3 Apr 2011 11:50:09 +0000 (13:50 +0200)]
Fix tag reference name in testrepo.git
The git test repository was holding a wrongly named tag reference ("very-simple") pointing at a tag named "
e90810b ".
This mistake (mine :-/ ) originates back to https://github.com/libgit2/libgit2/commit/
9282e92
Whole credit goes to @tclem for having spotted this.
Vicent Marti [Mon, 4 Apr 2011 10:05:20 +0000 (13:05 +0300)]
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.
Vicent Marti [Mon, 4 Apr 2011 09:14:03 +0000 (12:14 +0300)]
Fix the git_tree_write implementation
Sarath Lakshman [Sun, 3 Apr 2011 11:48:56 +0000 (17:18 +0530)]
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.
Vicent Marti [Sat, 2 Apr 2011 09:49:14 +0000 (12:49 +0300)]
Merge branch 'tagging' of https://github.com/nulltoken/libgit2 into development
Conflicts:
include/git2/tag.h
src/tag.c
Vicent Marti [Sat, 2 Apr 2011 09:42:04 +0000 (12:42 +0300)]
Change `parse` methods to const buffer
Signed-off-by: Vicent Marti <tanoku@gmail.com>
Vicent Marti [Sat, 2 Apr 2011 09:28:35 +0000 (12:28 +0300)]
Merge branch 'parse-tag-buffer' of https://github.com/carlosmn/libgit2 into development
Olivier Ramonat [Wed, 30 Mar 2011 17:47:12 +0000 (19:47 +0200)]
Update README after sqlite option change
To build libgit2 with sqlite support, waf configure should be run
with --with-sqlite
Carlos Martín Nieto [Thu, 31 Mar 2011 13:29:13 +0000 (15:29 +0200)]
Merge upstream/development
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Thu, 31 Mar 2011 08:50:11 +0000 (10:50 +0200)]
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>
Carlos Martín Nieto [Wed, 30 Mar 2011 16:51:02 +0000 (18:51 +0200)]
move build_varname above parse_section
Carlos Martín Nieto [Wed, 30 Mar 2011 14:22:31 +0000 (16:22 +0200)]
build_varname: lowercase the variable name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Wed, 30 Mar 2011 14:11:55 +0000 (16:11 +0200)]
config_parse: no need to check if current_section is non-null
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Wed, 30 Mar 2011 14:02:57 +0000 (16:02 +0200)]
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>
Carlos Martín Nieto [Thu, 31 Mar 2011 10:51:17 +0000 (12:51 +0200)]
config_set: really replace the value on overwrite
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Thu, 31 Mar 2011 13:02:23 +0000 (15:02 +0200)]
wscript: Use -O0 on debug
If we want debugging symbols, we most likely want them to point to the
right place. With -O2, gdb or valgrind may give wrong information.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
nulltoken [Wed, 30 Mar 2011 21:46:54 +0000 (23:46 +0200)]
Rename git_tag_create_o_f() to git_tag_create_fo()
nulltoken [Wed, 30 Mar 2011 21:26:36 +0000 (23:26 +0200)]
Add git_tag_delete()
nulltoken [Wed, 30 Mar 2011 21:16:30 +0000 (23:16 +0200)]
Add git_tag_create_o_f() and git_tag_create_f() which overwrite existing tag reference, if any
nulltoken [Wed, 30 Mar 2011 20:46:52 +0000 (22:46 +0200)]
Fix memory leak in tag releated tests
nulltoken [Wed, 30 Mar 2011 20:30:55 +0000 (22:30 +0200)]
Prevent tag_create() from creating a conflicting reference
nulltoken [Wed, 30 Mar 2011 19:57:20 +0000 (21:57 +0200)]
Add test demonstrating that one can create a tag pointing at a non existent target
nulltoken [Wed, 30 Mar 2011 19:46:19 +0000 (21:46 +0200)]
Enforce the testing of the correct creation of a tag
nulltoken [Wed, 30 Mar 2011 19:29:10 +0000 (21:29 +0200)]
Fix misleading comments
Carlos Martín Nieto [Wed, 30 Mar 2011 14:48:14 +0000 (16:48 +0200)]
git_config_set_int: use the right buffer
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Wed, 30 Mar 2011 13:16:25 +0000 (15:16 +0200)]
git_config: reorder fields according to use
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Wed, 30 Mar 2011 13:05:15 +0000 (15:05 +0200)]
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>
Carlos Martín Nieto [Wed, 30 Mar 2011 11:40:19 +0000 (13:40 +0200)]
Store the parsed variables
Store the key-value pair as strings.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Wed, 30 Mar 2011 09:32:08 +0000 (11:32 +0200)]
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>
Carlos Martín Nieto [Wed, 30 Mar 2011 09:30:40 +0000 (11:30 +0200)]
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>
Carlos Martín Nieto [Wed, 30 Mar 2011 09:07:09 +0000 (11:07 +0200)]
build_varname: allocate memory
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
nulltoken [Tue, 29 Mar 2011 19:29:30 +0000 (21:29 +0200)]
Add test ensuring one can not create an oid reference which targets at an unknown id
nulltoken [Tue, 29 Mar 2011 19:21:47 +0000 (21:21 +0200)]
Replace gitfo_unlink() calls with git_reference_delete() in refs related tests
Olivier Ramonat [Tue, 29 Mar 2011 12:19:40 +0000 (14:19 +0200)]
Fix help message for waf configure --with-sqlite
Carlos Martín Nieto [Tue, 29 Mar 2011 09:43:31 +0000 (11:43 +0200)]
Check for looser reference names
res/dummy/a and refs/stash must pass. The other rules are already
tested by the rest of the checks.
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Thu, 24 Mar 2011 13:15:00 +0000 (14:15 +0100)]
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>
Vicent Marti [Tue, 29 Mar 2011 16:40:02 +0000 (19:40 +0300)]
refs: Don't allow references to inexistent OIDs
Vicent Marti [Tue, 29 Mar 2011 16:22:21 +0000 (19:22 +0300)]
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.
Carlos Martín Nieto [Tue, 29 Mar 2011 09:30:09 +0000 (11:30 +0200)]
Make overwrite test more comprehensive
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Tue, 29 Mar 2011 08:52:29 +0000 (10:52 +0200)]
force-rename test: check for the right name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Tue, 29 Mar 2011 08:47:48 +0000 (10:47 +0200)]
rename: don't return early if the target ref exists
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Mon, 28 Mar 2011 16:40:58 +0000 (18:40 +0200)]
Add tests covering overwriting references
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Mon, 28 Mar 2011 13:05:02 +0000 (15:05 +0200)]
Fix documentation copy error
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Mon, 28 Mar 2011 12:53:52 +0000 (14:53 +0200)]
Match the comment with the error string
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Mon, 28 Mar 2011 10:00:50 +0000 (12:00 +0200)]
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>
Carlos Martín Nieto [Mon, 28 Mar 2011 09:31:58 +0000 (11:31 +0200)]
Add GIT_EEXISTS error code
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Tue, 29 Mar 2011 15:44:10 +0000 (17:44 +0200)]
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>
Carlos Martín Nieto [Tue, 29 Mar 2011 15:59:13 +0000 (17:59 +0200)]
Add build_varname to make a full var name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Carlos Martín Nieto [Tue, 29 Mar 2011 15:37:03 +0000 (17:37 +0200)]
cvar_free: also free the config var's name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>