]> git.proxmox.com Git - libgit2.git/log
libgit2.git
13 years agoFix git__strntolower
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>
13 years agoFix const char ** warning
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>
13 years agoconfig: export git_config_[sg]et_long
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>
13 years agoconfig: allow uppercase number suffixes
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>
13 years agoconfig: add tests for number suffix
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>
13 years agoUse internal strtol
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>
13 years agoFix number suffix detection
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>
13 years agoMerge upstream/development
Carlos Martín Nieto [Mon, 11 Apr 2011 15:41:21 +0000 (17:41 +0200)]
Merge upstream/development

13 years agoFix path normalization tests
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/`.

13 years agoUse Z_BEST_SPEED for filebuf deflating
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.

13 years agoImport 'with' from __future__ in the build script
Vicent Marti [Sun, 10 Apr 2011 00:45:38 +0000 (17:45 -0700)]
Import 'with' from __future__ in the build script

13 years agoFix `time_t` conversion on Win32
Vicent Marti [Sat, 9 Apr 2011 23:16:09 +0000 (16:16 -0700)]
Fix `time_t` conversion on Win32

13 years agoFix `gmtime` issues in Win32
Vicent Marti [Sat, 9 Apr 2011 23:06:17 +0000 (16:06 -0700)]
Fix `gmtime` issues in Win32

13 years agoRename `git_signature_new_now`
Vicent Marti [Sat, 9 Apr 2011 22:31:12 +0000 (15:31 -0700)]
Rename `git_signature_new_now`

The new name is more cool.

13 years agoAdd API git_signature_new_now
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>
13 years agoFix the signature documentation
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>
13 years agoAdd a few malloc checks
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>
13 years agoAdd two new accessors to the repository
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.

13 years agoProperly check `strtol` for errors
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.

13 years agoDo not declare variables in the middle of a func
Vicent Marti [Fri, 8 Apr 2011 22:35:25 +0000 (15:35 -0700)]
Do not declare variables in the middle of a func

13 years agoAdd new method `git_repository_is_empty`
Vicent Marti [Fri, 8 Apr 2011 19:42:18 +0000 (12:42 -0700)]
Add new method `git_repository_is_empty`

13 years agoRemove unused variables from test files
Vicent Marti [Fri, 8 Apr 2011 19:41:17 +0000 (12:41 -0700)]
Remove unused variables from test files

13 years agorefs: Fix issue when packing weak tags
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.

13 years agotag: don't check twice if an object exists
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>
13 years agotag: don't allow tags to non-existent objects
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>
13 years agotag: discover the target type if needed
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>
13 years agoindex.h: Add IDXENTRY flags needed for index operations
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.

13 years agoAdded git_commit_tree_oid and git_commit_parent_oid.
Sam [Wed, 6 Apr 2011 00:48:31 +0000 (10:48 +1000)]
Added git_commit_tree_oid and git_commit_parent_oid.

13 years agofix git_treebuilder_insert probrem.
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`.

13 years agoDo not assert error codes on Hiredis backend
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>
13 years agoredis backend
Dmitry Kovega [Sun, 3 Apr 2011 17:43:51 +0000 (21:43 +0400)]
redis backend

13 years agoAdd getting and setting of long int variables
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>
13 years agoSimplify error path in config_set
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>
13 years agoconfig: make cvar_free behave more like other free functions
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>
13 years agoconfig: use and implement list macros
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.

13 years agoconfig: use snprintf instead of sprintf
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>
13 years agoconfig: free the file buffer earlier
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>
13 years agoMerge remote-tracking branch 'upstream/development' into config
Carlos Martín Nieto [Wed, 6 Apr 2011 13:49:29 +0000 (15:49 +0200)]
Merge remote-tracking branch 'upstream/development' into config

13 years agoconfig: move str(n)tolower to the git__ namespace
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>
13 years agoconfig: coding style fixes
Carlos Martín Nieto [Wed, 6 Apr 2011 13:27:12 +0000 (15:27 +0200)]
config: coding style fixes

13 years agoconfig: really compare the variable name case-insensitively
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>
13 years agoBuild & write custom trees in memory
Vicent Marti [Mon, 4 Apr 2011 16:24:19 +0000 (19:24 +0300)]
Build & write custom trees in memory

13 years agoconfig: test for a variable on its own
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>
13 years agoconfig: variable name on its own means true
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>
13 years agoconfig: add tests
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>
13 years agoconfig: check for EOF before newline
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>
13 years agoconfig: support multiline values
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>
13 years agoconfig: don't mix buffer reading methods
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>
13 years agoconfig: also free the file buffer on error
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>
13 years agoconfig: Fix typo and remove debug statement
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>
13 years agoMake reinitializing a repository return GIT_ENOTIMPLEMENTED instead of GIT_SUCCESS
nulltoken [Sun, 3 Apr 2011 16:31:45 +0000 (18:31 +0200)]
Make reinitializing a repository return GIT_ENOTIMPLEMENTED instead of GIT_SUCCESS

13 years agoFix tag reference name in testrepo.git
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.

13 years agoAdd a fake wstream to the ODB
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.

13 years agoFix the git_tree_write implementation
Vicent Marti [Mon, 4 Apr 2011 09:14:03 +0000 (12:14 +0300)]
Fix the git_tree_write implementation

13 years agoNew external API method: `git_tree_create`
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.

13 years agoMerge branch 'tagging' of https://github.com/nulltoken/libgit2 into development
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

13 years agoChange `parse` methods to const buffer
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>
13 years agoMerge branch 'parse-tag-buffer' of https://github.com/carlosmn/libgit2 into development
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

13 years agoUpdate README after sqlite option change
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

13 years agoMerge upstream/development
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>
13 years agoAdd support for subsections
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>
13 years agomove build_varname above parse_section
Carlos Martín Nieto [Wed, 30 Mar 2011 16:51:02 +0000 (18:51 +0200)]
move build_varname above parse_section

13 years agobuild_varname: lowercase the variable name
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>
13 years agoconfig_parse: no need to check if current_section is non-null
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>
13 years agoAdd strtolower and strntolower functions
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>
13 years agoconfig_set: really replace the value on overwrite
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>
13 years agowscript: Use -O0 on debug
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>
13 years agoRename git_tag_create_o_f() to git_tag_create_fo()
nulltoken [Wed, 30 Mar 2011 21:46:54 +0000 (23:46 +0200)]
Rename git_tag_create_o_f() to git_tag_create_fo()

13 years agoAdd git_tag_delete()
nulltoken [Wed, 30 Mar 2011 21:26:36 +0000 (23:26 +0200)]
Add git_tag_delete()

13 years agoAdd git_tag_create_o_f() and git_tag_create_f() which overwrite existing tag referenc...
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

13 years agoFix memory leak in tag releated tests
nulltoken [Wed, 30 Mar 2011 20:46:52 +0000 (22:46 +0200)]
Fix memory leak in tag releated tests

13 years agoPrevent tag_create() from creating a conflicting reference
nulltoken [Wed, 30 Mar 2011 20:30:55 +0000 (22:30 +0200)]
Prevent tag_create() from creating a conflicting reference

13 years agoAdd test demonstrating that one can create a tag pointing at a non existent target
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

13 years agoEnforce the testing of the correct creation of a tag
nulltoken [Wed, 30 Mar 2011 19:46:19 +0000 (21:46 +0200)]
Enforce the testing of the correct creation of a tag

13 years agoFix misleading comments
nulltoken [Wed, 30 Mar 2011 19:29:10 +0000 (21:29 +0200)]
Fix misleading comments

13 years agogit_config_set_int: use the right buffer
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>
13 years agogit_config: reorder fields according to use
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>
13 years agoconfig: use a singly-linked list instead of a hash table
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>
13 years agoStore the parsed variables
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>
13 years agoInitialise the config reader in config_parse
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>
13 years agoDetermine variable type at runtime
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>
13 years agobuild_varname: allocate memory
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>
13 years agoAdd test ensuring one can not create an oid reference which targets at an unknown id
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

13 years agoReplace gitfo_unlink() calls with git_reference_delete() in refs related tests
nulltoken [Tue, 29 Mar 2011 19:21:47 +0000 (21:21 +0200)]
Replace gitfo_unlink() calls with git_reference_delete() in refs related tests

13 years agoFix help message for waf configure --with-sqlite
Olivier Ramonat [Tue, 29 Mar 2011 12:19:40 +0000 (14:19 +0200)]
Fix help message for waf configure --with-sqlite

13 years agoCheck for looser reference names
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>
13 years agonormalize_name: allow more references under refs/
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>
13 years agorefs: Don't allow references to inexistent OIDs
Vicent Marti [Tue, 29 Mar 2011 16:40:02 +0000 (19:40 +0300)]
refs: Don't allow references to inexistent OIDs

13 years agoEnforce coding conventions in refs.c
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.

13 years agoMake overwrite test more comprehensive
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>
13 years agoforce-rename test: check for the right name
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>
13 years agorename: don't return early if the target ref exists
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>
13 years agoAdd tests covering overwriting references
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>
13 years agoFix documentation copy error
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>
13 years agoMatch the comment with the error string
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>
13 years agoAllow forcing the creation or renaming of references
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>
13 years agoAdd GIT_EEXISTS error code
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>
13 years agoExpose config API for setters, getters and foreach
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>
13 years agoAdd build_varname to make a full var name
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>
13 years agocvar_free: also free the config var's name
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>