Commit Graph

33 Commits

Author SHA1 Message Date
Alessandro Ghedini
758f2f1022 posix: Solaris doesn't have strnlen either 2013-11-27 14:31:22 +01:00
Linquize
1b57699a3a Fix typo in documentation 2013-09-22 09:38:51 +08:00
Edward Thomson
86967cc579 Use time(2) to get the time
We didn't use the added precision in gettimeofday, so remove it.
This prevents us from having an unnecessary reimplementation on
win32.
2013-08-19 16:44:17 -05:00
Edward Thomson
57f31f058c Fixes to safely reading the index
Avoid wrapping around extension size when reading, avoid walking off
the end of the buffer when reading names.
2013-08-08 12:32:23 -05:00
Russell Belfer
3d3ea4dc56 Add O_CLOEXEC to open calls 2013-06-22 20:58:32 -07:00
Russell Belfer
e40f1c2d23 Make tree iterator handle icase equivalence
There is a serious bug in the previous tree iterator implementation.
If case insensitivity resulted in member elements being equivalent
to one another, and those member elements were trees, then the
children of the colliding elements would be processed in sequence
instead of in a single flattened list.  This meant that the tree
iterator was not truly acting like a case-insensitive list.

This completely reworks the tree iterator to manage lists with
case insensitive equivalence classes and advance through the items
in a unified manner in a single sorted frame.

It is possible that at a future date we might want to update this
to separate the case insensitive and case sensitive tree iterators
so that the case sensitive one could be a minimal amount of code
and the insensitive one would always know what it needed to do
without checking flags.

But there would be so much shared code between the two, that I'm
not sure it that's a win.  For now, this gets what we need.

More tests are needed, though.
2013-03-08 16:39:57 -08:00
Edward Thomson
359fc2d241 update copyrights 2013-01-08 17:31:27 -06:00
Russell Belfer
824d5e4d26 Always use internal fnmatch, not system 2012-10-15 12:54:46 -07:00
Russell Belfer
ca1b6e5409 Add template dir and set gid to repo init
This extends git_repository_init_ext further with support for
initializing the repository from an external template directory
and with support for the "create shared" type flags that make a
set GID repository directory.

This also adds tests for much of the new functionality to the
existing `repo/init.c` test suite.

Also, this adds a bunch of new utility functions including a
very general purpose `git_futils_mkdir` (with the ability to
make paths and to chmod the paths post-creation) and a file
tree copying function `git_futils_cp_r`.  Also, this includes
some new path functions that were useful to keep the code
simple.
2012-08-22 16:07:19 -07:00
Vicent Marti
60029f499e amigaos: Add missing include 2012-06-24 16:56:32 +02:00
Vicent Marti
798e4d53dc amigaos: Cleanup 2012-06-22 21:25:17 +02:00
Chris Young
d043013fea More changes resulting from pull request 2012-06-14 19:09:42 +01:00
Chris Young
a8df98c6fb Updates from comments on OS4 compatibility pull request http://github.com/libgit2/libgit2/pull/766 2012-06-14 18:57:24 +01:00
Chris Young
a21bb1aa33 Merge remote-tracking branch 'source/development' into development 2012-06-13 23:28:51 +01:00
Chris Young
96ef3d8462 Make this more generic and mergeable.
Needs AmigaOS.cmake now from CMake package at OS4Depot, or contents below:
--8<--
SET(AMIGA 1)
SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
--8<--
2012-06-13 23:16:14 +01:00
Ben Straub
0284a21983 Fix mingw32 (Travis) build. 2012-06-11 12:55:36 -07:00
Chris Young
aa5a92d121 OS4 compatibility 2012-06-08 18:57:35 +01:00
Ben Straub
9ecf860d48 Rename posix wrappers with 'p_' prefix. 2012-06-06 13:24:25 -07:00
nulltoken
3191ae89c6 compat: make p_open able to accept optional mode when passing the O_CREAT flag
This has the nice side effect of making test_attr_repo__staging_properly_normalizes_line_endings_according_to_gitattributes_directives() test pass again on Windows. This test started to fail after commit 674a198 was applied.
2012-05-07 12:18:54 +02:00
Russell Belfer
44ef8b1b30 Fix warnings on 64-bit windows builds
This fixes all the warnings on win64 except those in deps, which
come from the regex code.
2012-04-17 10:47:39 -07:00
Russell Belfer
74fa4bfae3 Update diff to use iterators
This is a major reorganization of the diff code.  This changes
the diff functions to use the iterators for traversing the
content.  This allowed a lot of code to be simplified.  Also,
this moved the functions relating to outputting a diff into a
new file (diff_output.c).

This includes a number of other changes - adding utility
functions, extending iterators, etc. plus more tests for the
diff code.  This also takes the example diff.c program much
further in terms of emulating git-diff command line options.
2012-03-02 15:49:29 -08:00
schu
5e0de32818 Update Copyright header
Signed-off-by: schu <schu-github@schulog.org>
2012-02-13 17:11:09 +01:00
Carlos Martín Nieto
0c49ec2d3b Implement p_rename
Move the callers of git_futils_mv_atomic to use p_rename.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-11-07 20:34:27 +01:00
Brodie Rao
ce8cd006ce fileops/repository: create (most) directories with 0777 permissions
To further match how Git behaves, this change makes most of the
directories libgit2 creates in a git repo have a file mode of
0777. Specifically:

- Intermediate directories created with git_futils_mkpath2file() have
  0777 permissions. This affects odb_loose, reflog, and refs.

- The top level folder for bare repos is created with 0777
  permissions.

- The top level folder for non-bare repos is created with 0755
  permissions.

- /objects/info/, /objects/pack/, /refs/heads/, and /refs/tags/ are
  created with 0777 permissions.

Additionally, the following changes have been made:

- fileops functions that create intermediate directories have grown a
  new dirmode parameter. The only exception to this is filebuf's
  lock_file(), which unconditionally creates intermediate directories
  with 0777 permissions when GIT_FILEBUF_FORCE is set.

- The test runner now sets the umask to 0 before running any
  tests. This ensurses all file mode checks are consistent across
  systems.

- t09-tree.c now does a directory permissions check. I've avoided
  adding this check to other tests that might reuse existing
  directories from the prefabricated test repos. Because they're
  checked into the repo, they have 0755 permissions.

- Other assorted directories created by tests have 0777 permissions.
2011-10-14 16:04:34 -07:00
Brodie Rao
33127043b3 fileops/posix: replace usage of "int mode" with "mode_t mode"
Note: Functions exported from fileops take const mode_t, while the
underlying POSIX wrappers take mode_t.
2011-10-14 15:57:15 -07:00
Vicent Marti
01d7fded1b Revert "Rewrite getenv to use Win32 version on Windows"
This reverts commit e1b8644467.
2011-09-27 14:33:18 +02:00
Carlos Martín Nieto
dd44887ac6 Implment p_access and use it in git_fileutils_exists
Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-23 00:00:05 +02:00
Paul Betts
e1b8644467 Rewrite getenv to use Win32 version on Windows 2011-09-21 12:00:34 -07:00
Paul Betts
7998ae5ab1 Rewrite p_* functions to use Unicode and marshal to UTF8 internally 2011-09-19 13:14:04 -07:00
Vicent Marti
bb742ede3d Cleanup legal data
1. The license header is technically not valid if it doesn't have a
copyright signature.

2. The COPYING file has been updated with the different licenses used in
the project.

3. The full GPLv2 header in each file annoys me.
2011-09-19 01:54:32 +03:00
Vicent Marti
2fcf9c8273 posix: Fix undeclared prototype 2011-08-30 11:32:33 -07:00
Kirill A. Shutemov
2ba222c5c5 posix: declare 'buf' argument of p_write() as const
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-25 21:12:46 +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