Commit Graph

1171 Commits

Author SHA1 Message Date
Kirill A. Shutemov
6f2b0a3ae2 examples/general: fix misc warnings
examples/general.c:393:25: warning: unused variable ‘reftarget’ [-Wunused-variable]
examples/general.c:357:19: warning: unused variable ‘e’ [-Wunused-variable]
examples/general.c:444:1: warning: control reaches end of non-void function [-Wreturn-type]

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-05 14:20:10 +03:00
Kirill A. Shutemov
d6d877d20f examples/general: fix warnings on not handled reference type in switch
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_INVALID’ not handled in switch [-Wswitch]
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_PACKED’ not handled in switch [-Wswitch]
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_HAS_PEEL’ not handled in switch [-Wswitch]
examples/general.c:402:5: warning: enumeration value ‘GIT_REF_LISTALL’ not handled in switch [-Wswitch]

Signe-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-05 14:20:10 +03:00
Kirill A. Shutemov
51cc50a37d examples/general: fix git_commit_create_v() arguments type
general.c:208: warning: passing argument 7 of 'git_commit_create_v' from incompatible pointer type

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-05 14:20:10 +03:00
Carlos Martín Nieto
7d69f78897 Add variable writing tests
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-05 02:32:18 +02:00
Carlos Martín Nieto
156af801e6 Add test for section header at end of file
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-05 02:32:18 +02:00
Carlos Martín Nieto
f58c53ce66 Correctly detect truncated input in header parsing
If the section header is the last line in the file,
parse_section_header would incorrectly decide that the input had been
truncated.

Fix this by checking whether the actual input line is correctly
formatted.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-05 02:32:17 +02:00
Carlos Martín Nieto
86b5ab162c git_config_add_file should rethrow
Otherwise, the information about why there was an error gets lost.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-05 02:32:17 +02:00
Carlos Martín Nieto
2601fcfc1e Add tests for deleting a config var
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-05 02:32:17 +02:00
Carlos Martín Nieto
6d4b609718 Add git_config_del to delete a variable
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-07-05 02:31:26 +02:00
Vicent Marti
9f86ec52fa signature: Fix warnings
Add extra braces to avoid ambiguous if-else.

Also, free() doesn't need a check.
2011-07-05 02:28:18 +02:00
nulltoken
a01acc47bb signature: straighten the creation of a signature
- Fails on empty name and/or email
 - Trims leading and trailing spaces of name and email
2011-07-05 02:21:26 +02:00
nulltoken
42a1b5e1ad signature: enhance relaxed parsing of bogus signatures
Final fix for issue #278
2011-07-05 02:21:26 +02:00
schu
60caf02465 t04-commit: add tests for git_signature__parse
git_signature__parse used to be very strict about what's a well-formed
signature. Add tests checking git_signature__parse can stick with
"unexpected" signatures (IOW no author name and / or no email, etc).

Signed-off-by: schu <schu-github@schulog.org>
2011-07-05 02:21:26 +02:00
schu
8b2c913acb git_signature__parse: make parsing less strict
git_signature__parse used to be very strict about what's a well-formed
signature. Since git_signature__parse is used only when reading already
existing signatures, we should not care about if it's a valid signature
too much but rather show what we got.

Reported-by: nulltoken <emeric.fermas@gmail.com>
Signed-off-by: schu <schu-github@schulog.org>
2011-07-05 02:21:25 +02:00
Vicent Marti
1bc83ff14f repository: Cleanup initialization 2011-07-05 02:09:10 +02:00
Vicent Marti
eec3fe394a fileutils: Finish dropping the old prettify_path 2011-07-05 02:09:05 +02:00
Vicent Marti
19ac1ed702 fileops: Fix stat() on directories for W32
The `stat` methods were having issues when called with a trailing slash
in Windows platforms.

We now use GetFileAttributes() where possible, which doesn't have this
restriction.
2011-07-05 02:08:09 +02:00
Vicent Marti
5ad739e832 fileops: Drop git_fileops_prettify_path
The old `git_fileops_prettify_path` has been replaced with
`git_path_prettify`. This is a much simpler method that uses the OS's
`realpath` call to obtain the full path for directories and resolve
symlinks.

The `realpath` syscall is the original POSIX call in Unix system and
an emulated version under Windows using the Windows API.
2011-07-05 02:06:26 +02:00
Vicent Marti
f79026b491 fileops: Cleanup
Cleaned up the structure of the whole OS-abstraction layer.

fileops.c now contains a set of utility methods for file management used
by the library. These are abstractions on top of the original POSIX
calls.

There's a new file called `posix.c` that contains
emulations/reimplementations of all the POSIX calls the library uses.
These are prefixed with `p_`. There's a specific posix file for each
platform (win32 and unix).

All the path-related methods have been moved from `utils.c` to `path.c`
and have their own prefix.
2011-07-05 02:04:03 +02:00
Vicent Marti
678e9e045b build: Move OS-specific compat to their own folders 2011-07-03 13:33:43 +02:00
Kirill A. Shutemov
932d1baf29 cleanup: remove trailing spaces
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-01 18:02:56 +02:00
Tim Harder
1f4f4d1704 cmake: Use system zlib if found on non-Windows systems 2011-07-01 17:41:46 +02:00
Vicent Marti
ec62685345 zlib: Declare preprocessor directives at build time 2011-07-01 17:34:27 +02:00
Vicent Marti
17d523041d build: Simplify build structure
This will make libgit2 more suitable for embedding.
2011-07-01 17:26:23 +02:00
Vicent Marti
b2cef77ccf common: Force 64 bit fileops at compile time 2011-06-30 22:28:19 +02:00
Vicent Marti
8a0620030c zlib: No visualization attributes.
The visibility attribute is a headache on many platforms like Solaris,
and not even supported on Windows.
2011-06-30 22:28:19 +02:00
Vicent Marti
637edc9c42 refs: Remove bogus assertion
The assertion in line 360 was there to check that only loose refs were
being written as loose, but there are times when we need to re-write a
packed reference as loose.
2011-06-30 22:28:19 +02:00
Vicent Marti
e0fc39da9a config: Fix unmatched parameters in docs 2011-06-30 22:28:19 +02:00
Vicent Martí
1f61e301be Merge pull request #287 from kiryl/development
filebuf: fix endless loop on writing buf > WRITE_BUFFER_SIZE
2011-06-30 07:12:42 -07:00
Vicent Martí
02bc2d2f27 Merge pull request #288 from nulltoken/patch-4
GIT_EXTERN'd  head_detached() and head_orphan()
2011-06-30 07:11:04 -07:00
nulltoken
408d733b1f repository: Make head_detached() and head_orphan() convenience methods accessible to bindings 2011-06-30 06:56:58 -07:00
Kirill A. Shutemov
fe5babacd6 filebuf: fix endless loop on writing buf > WRITE_BUFFER_SIZE
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-06-30 16:19:19 +03:00
Vicent Martí
2dfc08875a Merge pull request #284 from nulltoken/topic/hide-git-dir
Hide ".git" directory on Windows upon creation of a non bare repository
2011-06-29 12:14:29 -07:00
nulltoken
6ac91dfe52 Hide ".git" directory on Windows upon creation of a non bare repository
Directory which name starts with a dot are hidden on Linux platforms. This patch makes libgit2 behaves similarly on Windows.
2011-06-29 19:22:24 +02:00
Vicent Marti
cfef5fb779 config: foreach now returns variable values too 2011-06-29 15:09:21 +02:00
Vicent Marti
7376ad9927 refs: Remove duplicate rename method
`git_reference_rename` now takes a `force` flag
2011-06-29 11:01:35 +02:00
Carlos Martín Nieto
5f25149e46 sig: allow empty names
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-06-28 22:04:27 +02:00
Vicent Marti
0f489fb211 repo: Fix git_repository_is_empty 2011-06-28 21:30:38 +02:00
Vicent Marti
ab7941b5d9 test: Properly show error messages 2011-06-28 21:10:51 +02:00
Vicent Marti
5cf1f909e4 test: Print last error message properly 2011-06-28 21:10:49 +02:00
Vicent Marti
c682886e8e repo: Rename HEAD-related methods 2011-06-28 21:10:44 +02:00
Vicent Marti
e053c911cf commit: Allow spaces inside email addresses
Core Git doesn't care when people use spaces in the email address, even
though this kind of foolery receives the capital punishment in several
states of the USA.

We must obey.
2011-06-28 19:52:41 +02:00
Vicent Martí
ccd59372d4 Merge pull request #279 from carlosmn/detached-orphan
Add detached and orphan convenience functions
2011-06-28 10:44:19 -07:00
Vicent Marti
9525e47df9 refs: Remove unused declarations 2011-06-28 19:43:36 +02:00
Vicent Martí
2fb520f19a Merge pull request #277 from schu/sign-compare
Fix warning: signed and unsigned type in cond expr
2011-06-28 10:39:07 -07:00
Vicent Marti
d5afc0390c Remove redundant methods from the API
A bunch of redundant methods have been removed from the external API.

- All the reference/tag creation methods with `_f` are gone. The force
flag is now passed as an argument to the normal create methods.

- All the different commit creation methods are gone; commit creation
now always requires a `git_commit` pointer for parents and a `git_tree`
pointer for tree, to ensure that corrupted commits cannot be generated.

- All the different tag creation methods are gone; tag creation now
always requires a `git_object` pointer to ensure that tags are not
created to inexisting objects.
2011-06-28 19:36:27 +02:00
Carlos Martín Nieto
f5e09d6080 Add tests for detached and orphan
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-28 16:59:51 +02:00
Carlos Martín Nieto
35502d2ec4 Add git_repository_is_detached, git_repository_is_orphan
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-28 16:59:51 +02:00
schu
7b608b3b96 git_blob_create_fromfile: remove old code
Remove call of gitfo_size, since we call gitfo_lstat anyway; remove some
old workaround code for gitfo_read, which is obsolete now.

Signed-off-by: schu <schu-github@schulog.org>
2011-06-27 12:37:46 +02:00
Vicent Martí
0b10c9ea6e Merge pull request #276 from carlosmn/development
Bring back GCC flags
2011-06-26 08:33:11 -07:00