Commit Graph

2112 Commits

Author SHA1 Message Date
Russell Belfer
5d3cd4e309 Convert status assert to skip file
When status encounters a submodule, right now it is asserting.
This changes it to just skip the file that it can't deal with.
2012-01-31 13:09:39 -08:00
Carlos Martín Nieto
279afd2a51 refspec: a ref name includes the refs/ prefix
git_refspec_transform_r assumed that the reference name passed would
be only a branch or tag name. This is not the case, and we need to
take into consideration what's in the refspec's source to know how
much of the prefix to ignore.
2012-01-31 17:29:53 +01:00
nulltoken
1e53b52eb9 threads: Make the old test suite TLS aware 2012-01-29 15:11:09 +01:00
Vicent Martí
f25cc58d5c clar: Remove pregenerated files
Those were re-added on the move. Ops!
2012-01-27 18:29:03 -08:00
Vicent Martí
e4b4da1406 cache: Simplify locking mechanics
The object cache is mostly IO-bound, so it makes no sense to have a lock
per node.
2012-01-27 18:28:02 -08:00
Vicent Martí
7a6f51de6d win32: Use the Windows Atomic API on MinGW too 2012-01-26 18:03:14 -08:00
Vicent Martí
a53420e4b0 msvc: Move ssize_t typedef to MSVC-only
This is a MSVC-only issue. All other compilers we support work properly.
2012-01-26 17:53:46 -08:00
Vicent Martí
99a07f0f4d Merge pull request #541 from nulltoken/topic/repo-reinit
Repository re-initialization
2012-01-25 16:45:46 -08:00
nulltoken
5663e61a06 repository: add minimal reinitialization of repository
This currently only ensures that the version of the repository format isn't greater than zero.
2012-01-25 23:05:06 +01:00
nulltoken
9b84447a80 clay: migrate a test initializing a repository which path escapes the current working directory
A non migrated yet test has been removed as well as it's mostly redundant.
2012-01-25 23:02:08 +01:00
Vicent Martí
911ff94eb9 Merge pull request #540 from libgit2/clay-rename
Rename the Clay test suite to Clar
2012-01-25 13:58:40 -08:00
Vicent Martí
32dc20b5af gitignore: Add clar data 2012-01-25 13:57:31 -08:00
Vicent Martí
3fd1520cd4 Rename the Clay test suite to Clar
Clay is the name of a programming language on the makings, and we want
to avoid confusions. Sorry for the huge diff!
2012-01-24 20:35:15 -08:00
Carlos Martín Nieto
a9fe8ae0ee config: don't use 'section "subsection"' internal form on config_set
This had been left over from a time when I believed what the git
documentation had to say about case-sensitivity. The rest of the code
doesn't recognize this form and we hadn't noticed because most tests
don't try to get a recently-set variable but free and reload the
configuration, causing the right format to be used.
2012-01-23 22:14:04 +01:00
nulltoken
19313a76b6 remote: add test which creates a basic remote entry in the repository configuration then loads the remote 2012-01-23 21:27:29 +01:00
Russell Belfer
63ab73bec0 Merge branch 'fix-subdir-attr-paths' into development
This resolves issue #535 and issue #533.
2012-01-20 11:13:17 -08:00
Carlos Martín Nieto
9269ccce14 diff-index: fix leak
The buffer wasn't getting freed if the last difference was a deletion.
2012-01-19 23:47:15 +01:00
Carlos Martín Nieto
860de00459 http: use PRIuZ
MSVC doesn't think %zd is a valid specifier.
2012-01-19 23:36:27 +01:00
Vicent Martí
881e3da012 Merge pull request #538 from carlosmn/ref-noleak
Don't leak when deleting or removing refs
2012-01-19 11:38:09 -08:00
Carlos Martín Nieto
20c50b9e16 refs: don't leak the packref when deleting/renaming
When we remove the ref from the hashtable, we need to free the
packref.
2012-01-19 19:09:47 +01:00
Carlos Martín Nieto
3f2bf4d659 hashtable: add remove2 to retrieve the value that was removed 2012-01-19 19:06:15 +01:00
Carlos Martín Nieto
d0ec3fb8f0 indexer: save the pack index with the right name
Truncate at the slash; otherwise we get ppack-*.idx filenames.
2012-01-19 17:07:49 +01:00
Carlos Martín Nieto
585a2eb75a remote: don't try to free the ref on error
On error, the pointer could be pointing anywhere.
2012-01-19 17:05:16 +01:00
Vicent Martí
43c6dd6fb0 Merge pull request #537 from nulltoken/fix/download-segfault
Fix download segfault
2012-01-18 15:29:51 -08:00
nulltoken
c3ec2ec262 transport: prevent git_remote_download() from segfaulting when being passed a lightweight remote built with git_remote_new() 2012-01-19 00:09:47 +01:00
Russell Belfer
1744fafec0 Move path related functions from fileops to path
This takes all of the functions that look up simple data about
paths (such as `git_futils_isdir`) and moves them over to path.h
(becoming `git_path_isdir`).  This leaves fileops.h just with
functions that actually manipulate the filesystem or look at
the file contents in some way.

As part of this, the dir.h header which is really just for win32
support was moved into win32 (with some minor changes).
2012-01-17 15:49:47 -08:00
Vicent Martí
d1317f1b69 Merge pull request #536 from nulltoken/fix/transport-segfault
Fix transport segfault
2012-01-17 11:01:04 -08:00
nulltoken
0b44c06599 repository: add the invalid repository path to the error message 2012-01-17 19:50:25 +01:00
nulltoken
86360ffdf7 transport: prevent the transport determination mechanism from segfaulting when being passed an url starting with an unknown prefix 2012-01-17 19:49:58 +01:00
nulltoken
fdc8a7dbea Fix MSVC compilation warning 2012-01-17 14:06:35 +01:00
Russell Belfer
83bfbdf593 Remove poor git__removechar function
Going back over this, the git__removechar function was not
needed (only invoked once) and is actually mislabeled.  As
implemented, it really only made sense for removing backslash
characters, since two of the "removed" characters in a row
would include the second one -- i.e. it really implements
stripping backslash-escaped strings where a backslash allows
internal whitespace in a word.
2012-01-16 18:00:18 -08:00
Russell Belfer
a51cd8e6f6 Fix handling of relative paths for attrs
Per issue #533, the handling of relative paths in attribute
and ignore files was not right.  Fixed this by pre-joining
the relative path of the attribute/ignore file onto the match
string when a full path match is required.

Unfortunately, fixing this required a bit more code than I
would have liked because I had to juggle things around so that
the fnmatch parser would have sufficient information to prepend
the relative path when it was needed.
2012-01-16 16:58:27 -08:00
Russell Belfer
6e03b12f57 Merge pull request #531 from arrbee/gitignore
Initial implementation of gitignore support

git_status_foreach() and git_status_file() will now be
gitignore aware.
2012-01-16 15:34:35 -08:00
Russell Belfer
cfbc880d8a Patch cleanup for merge
After reviewing the gitignore support with Vicent, we came up
with a list of minor cleanups to prepare for merge, including:

* checking git_repository_config error returns
* renaming git_ignore_is_ignored and moving to status.h
* fixing next_line skipping to include \r skips
* commenting on where ignores are and are not included
2012-01-16 15:16:44 -08:00
Carlos Martín Nieto
d9e5430e5a Windows: store all 64 bits of the size in the stat structure
We force stat to be a stat64 structure, so we can and should put all
64 bits of the size in st_size.
2012-01-16 11:46:49 +01:00
Vicent Martí
1af56d7d7e Fix #534: 64-bit issues in Windows
off_t is always 32 bits in Windows, which is beyond stupid, but we just
don't care anymore because we're using `git_off_t` which is assured to
be 64 bits on all platforms, regardless of compilation mode. Just
ensure that no casts to `off_t` are performed.

Also, the check for `off_t` overflows has been dropped, once again,
because the size of our offsets is always 64 bits on all platforms.

Fixes #534
2012-01-15 15:48:36 -08:00
Carlos Martín Nieto
c1c399cf27 config: handle EOF properly
In the main loop we peek to see what kind of line the next one is. If
there are multiple newlines before the end of the file, the eof marker
won't be set after we read the last line with data and we'll try to
peek again. This peek will return LF (as it pretends that we have a
newline at EOF so other function don't need any special handling).

Fix cfg_getchar so it doesn't try to read past the last character in
the file and config_parse so it considers LF as EOF on peek (as we're
ignoring spaces) and sets the reader's EOF flag to exit the parsing
loop.
2012-01-13 19:33:54 +01:00
Carlos Martín Nieto
2866c01685 examples: use git_repository_odb instead of _database 2012-01-13 18:20:13 +01:00
Russell Belfer
1dbcc9fc4e Fix several memory issues
This contains fixes for several issues discovered by MSVC and
by valgrind, including some bad data access, some memory
leakage (in where certain files were not being successfully
added to the cache), and some code simplification.
2012-01-11 23:21:46 -08:00
Russell Belfer
0cfcff5daa Convert git_path_walk_up to regular function
This gets rid of the crazy macro version of git_path_walk_up
and makes it into a normal function that takes a callback
parameter.  This turned out not to be too messy.
2012-01-11 20:41:55 -08:00
Russell Belfer
15debaf5da Fix bug in dir_for_path
The last checkin accidentally broke dir_for_path by propogating
the dirname return code even when there was no error.
2012-01-11 17:28:25 -08:00
Russell Belfer
6a67a812c2 Allow ignores (and attribs) for nonexistent files
This fixes issue 532 that attributes (and gitignores) could not
be checked for files that don't exist.  It should be possible to
query such things regardless of the existence of the file.
2012-01-11 16:01:48 -08:00
Russell Belfer
fdaa924037 Fix up status tests 2012-01-11 15:25:13 -08:00
Russell Belfer
df743c7d3a Initial implementation of gitignore support
Adds support for .gitignore files to git_status_foreach() and
git_status_file().  This includes refactoring the gitattributes
code to share logic where possible.  The GIT_STATUS_IGNORED flag
will now be passed in for files that are ignored (provided they
are not already in the index or the head of repo).
2012-01-11 14:39:51 -08:00
Russell Belfer
7e443f6960 Restore portability to git_path_prettify.
It turns out that passing NULL for the second parameter of realpath(3)
is not as portable as one might like.  Notably, Mac OS 10.5 and earlier
does not support it.  So this moves us back to a large buffer to get
the realpath info.
2012-01-09 15:46:06 -08:00
Vicent Martí
1d17507496 Merge pull request #528 from arrbee/valgrind-fixes-2
Valgrind fixes in smaller pieces
2012-01-05 17:46:06 -08:00
Carlos Martín Nieto
91d46f8df3 clay tests: free resources
Trees, indices and repos need to be freed
2012-01-06 01:13:08 +01:00
Russell Belfer
fa3cb0dae0 Fix memory leak in git_index_remove.
Missed freeing the entry.
2012-01-05 15:15:43 -08:00
Russell Belfer
2d8405025d Throw first error in chain, not rethrow.
This is the first time this error is throw, so use git__throw instead
of git__rethrow.
2012-01-05 15:03:42 -08:00
Russell Belfer
948431aa01 Remove repo open immediately after init in test
Calling git_repository_open immediately after git_repository_init
results in memory leaks.
2012-01-05 15:00:46 -08:00