Commit Graph

4488 Commits

Author SHA1 Message Date
Carlos Martín Nieto
0bbaf9aaef config_parse: no need to check if current_section is non-null
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-31 15:05:12 +02:00
Carlos Martín Nieto
923fe4557f 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>
2011-03-31 15:05:12 +02:00
Carlos Martín Nieto
df22949a35 config_set: really replace the value on overwrite
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-31 15:05:12 +02:00
Carlos Martín Nieto
ba84cad380 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>
2011-03-31 15:02:24 +02:00
nulltoken
ac26e2454e Rename git_tag_create_o_f() to git_tag_create_fo() 2011-03-30 23:46:54 +02:00
nulltoken
9e680bcc00 Add git_tag_delete() 2011-03-30 23:26:36 +02:00
nulltoken
a50c145855 Add git_tag_create_o_f() and git_tag_create_f() which overwrite existing tag reference, if any 2011-03-30 23:16:30 +02:00
nulltoken
74e50a2d3e Fix memory leak in tag releated tests 2011-03-30 22:46:52 +02:00
nulltoken
bf4c39f929 Prevent tag_create() from creating a conflicting reference 2011-03-30 22:30:55 +02:00
nulltoken
6d3160148b Add test demonstrating that one can create a tag pointing at a non existent target 2011-03-30 22:26:53 +02:00
nulltoken
8e9a3d4217 Enforce the testing of the correct creation of a tag 2011-03-30 21:46:19 +02:00
nulltoken
673de2cf59 Fix misleading comments 2011-03-30 21:29:10 +02:00
Carlos Martín Nieto
8ecc5ae5cb git_config_set_int: use the right buffer
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 16:50:28 +02:00
Carlos Martín Nieto
e21881d1db git_config: reorder fields according to use
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 15:44:23 +02:00
Carlos Martín Nieto
dadc0158fb 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>
2011-03-30 15:44:23 +02:00
Carlos Martín Nieto
d28830c255 Store the parsed variables
Store the key-value pair as strings.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 13:43:01 +02:00
Carlos Martín Nieto
934fcf78f2 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>
2011-03-30 13:42:25 +02:00
Carlos Martín Nieto
2974aa94c3 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>
2011-03-30 13:42:24 +02:00
Carlos Martín Nieto
2e445cacd2 build_varname: allocate memory
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-30 11:34:04 +02:00
nulltoken
2b9b99b6ed Add test ensuring one can not create an oid reference which targets at an unknown id 2011-03-29 21:29:30 +02:00
nulltoken
4d00dfd438 Replace gitfo_unlink() calls with git_reference_delete() in refs related tests 2011-03-29 21:21:47 +02:00
Olivier Ramonat
a796d24cf6 Fix help message for waf configure --with-sqlite 2011-03-29 20:16:17 +03:00
Carlos Martín Nieto
553fbd640f 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>
2011-03-29 19:58:19 +03:00
Carlos Martín Nieto
83c95128d9 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>
2011-03-29 19:58:19 +03:00
Vicent Marti
9a53df7e0a refs: Don't allow references to inexistent OIDs 2011-03-29 19:58:19 +03:00
Vicent Marti
95cde17ca4 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.
2011-03-29 19:58:19 +03:00
Carlos Martín Nieto
fc1eeb9dfc Make overwrite test more comprehensive
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:19 +03:00
Carlos Martín Nieto
ec99193655 force-rename test: check for the right name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:19 +03:00
Carlos Martín Nieto
dad4a4d582 rename: don't return early if the target ref exists
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:19 +03:00
Carlos Martín Nieto
591a9423f5 Add tests covering overwriting references
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:18 +03:00
Carlos Martín Nieto
4cd6ed7566 Fix documentation copy error
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:18 +03:00
Carlos Martín Nieto
c7db45e862 Match the comment with the error string
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:18 +03:00
Carlos Martín Nieto
fa20496200 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>
2011-03-29 19:58:18 +03:00
Carlos Martín Nieto
baad182cbc Add GIT_EEXISTS error code
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 19:58:18 +03:00
Carlos Martín Nieto
9a3c5e55fd 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>
2011-03-29 18:13:47 +02:00
Carlos Martín Nieto
26faa3668f Add build_varname to make a full var name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 18:13:47 +02:00
Carlos Martín Nieto
e15afc8e7c cvar_free: also free the config var's name
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 18:07:01 +02:00
Carlos Martín Nieto
6d7bb4e039 Move git_cvar_type to include/git2/config.h
Include it in src/config.h and fix the header name #define.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 17:35:02 +02:00
Carlos Martín Nieto
3d23b74af7 Free the config var hash contents in git_config_free
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 13:50:37 +02:00
Carlos Martín Nieto
238df5590c Rename git_config_{type,var} to git_cvar{_type,}
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 12:48:47 +02:00
Carlos Martín Nieto
05314b5bf4 Make GIT_EINVALIDTYPE available for use in config
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 12:25:46 +02:00
Carlos Martín Nieto
9f7f4122cf Don't leak if config parsing fails
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 12:19:53 +02:00
Carlos Martín Nieto
4e02504f52 Move config to support the new hash code
The hashes have been copied from the references code

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-29 12:17:29 +02:00
Vicent Marti
6dcb09b5b5 libgit2 version 0.11.0, "McSwifty"
Apologies for the massive changes in the external API (that's my fault),
and for the terrible codename for this release (that's @tclem's fault).

The detailed overview for the major API changes can be found in the
commit at 72a3fe42fb.

Major new features in this release:

	- Real caching and refcounting on parsed objects
	- Real caching and refcounting on objects read from the ODB
	- Streaming writes & reads from the ODB
	- Single-method writes for all object types
	- The external API is now partially thread-safe
	- Improved reference handling
	- New method to list references
	- ZLib is now built-in
	- Improvements to the Revision Walker
	- Tons of bug fixes

Thanks to all the contributors who make this possible.

Signed-off-by: Vicent Marti <tanoku@gmail.com>
2011-03-28 22:35:27 +03:00
Vicent Marti
483526ebec Update the SQLite backend 2011-03-28 22:23:44 +03:00
Carlos Martín Nieto
3b4835c25a Correctly parse the section header
If cfg_readline consumes the line, then parse_section_header will read
past it and if we read a character, parse_variable won't have the full
name.

This solution is a bit hackish, but it's the simplest way to get the
code to parse correctly.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-28 18:07:22 +02:00
schu
683581a3e9 index.c: Fix tiny typos 2011-03-28 17:59:13 +02:00
schu
9d80d74da5 signature.h: Fix tiny typo 2011-03-28 17:57:08 +02:00
Carlos Martín Nieto
908afb771a parse_section_header: save the name where it belongs
Save the location of the name in section_out instead of returning it
as an int. Use the return code to signal success or failure.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-28 17:53:04 +02:00
Carlos Martín Nieto
e4c796f1a2 Read and parse the confguration when openingt the config file
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-03-28 17:51:18 +02:00