Commit Graph

1028 Commits

Author SHA1 Message Date
Vicent Martí
4e1543ff6e Merge pull request #250 from pegonma/commit_short_message
Commit short message should be the same as git's
2011-06-08 08:09:54 -07:00
Vicent Marti
ae496955d2 windows: Fix Symlink issues
Handle Symlinks if they can be handled in Win32. This is not even
compiled. Needs review.

The lstat implementation is modified from core Git.
The readlink implementation is modified from PHP.
2011-06-08 17:03:41 +02:00
Vicent Martí
1071c56519 Merge pull request #246 from carlosmn/keep-lock
Keep the lockfile if we fail to lock it
2011-06-08 04:16:47 -07:00
Marc Pegon
858ef372a4 Changed commit short messages so that they match git log --oneline output.
In git, the short message of a commit is the part of the commit message before 2 consecutive line breaks. In the short message, line breaks are replaced by space characters.
2011-06-08 11:16:31 +02:00
Carlos Martín Nieto
bb9272dd7a filebuf cleanup: only unlink lockfile if we've opened it
Add a check for the file descriptor in git_filebuf_cleanup. Without
it, an existing lockfile would be deleted if we tried to acquire it
(but failed, as the lockfile already existed).

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-07 17:05:40 +02:00
Carlos Martín Nieto
8102a961b8 Add test for git_filebuf_open error code
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-07 17:02:33 +02:00
Vicent Martí
3a12891f53 Merge pull request #243 from jpfender/symlinks2
Symlinks NEW
2011-06-07 07:07:45 -07:00
Vicent Martí
a5aa5bd1d1 Merge pull request #245 from schu/use-normalized
rename-reference: use normalized path
2011-06-07 07:04:51 -07:00
Vicent Martí
e64124b410 Merge pull request #244 from carlosmn/config-bugfix
config: update the git_config_add_file documentation
2011-06-07 07:04:20 -07:00
Vicent Martí
b0a46745cc Merge pull request #241 from nulltoken/fix/msvc-warnings
Fix compilation warnings in MSVC
2011-06-07 07:03:37 -07:00
Vicent Martí
275c6a0b37 Merge pull request #242 from schu/fix-unused-2
fileops.c: fix unused warning v2
2011-06-07 07:03:14 -07:00
Carlos Martín Nieto
a2a305fcf4 config: explain the cfg and file relationship better
It's not clear how git_config and git_config_file relate to one
another. Be more explicit about their relationship in the function
documentation.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-07 15:39:40 +02:00
Carlos Martín Nieto
ce78f39e27 config: update the git_config_add_file documentation
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-07 14:18:22 +02:00
schu
52b188f6e8 rename-reference: use normalized path
Signed-off-by: schu <schu-github@schulog.org>
2011-06-07 14:18:20 +02:00
Jakob Pfender
27a1b382c1 Export gitfo_shallow_exists 2011-06-07 14:15:55 +02:00
Jakob Pfender
fdd1e04ce7 fileops: Allow differentiation between deep and shallow exists()
When calling gitfo_exists() on a symbolic link, sometimes we need to
simply check whether the link exists and sometimes we need to check
whether the file pointed to by the symlink exists.

Introduce a new function gitfo_shallow_exists that only checks if the
link exists and revert gitfo_exists to the original functionality of
checking whether the file pointed to by the link exists.
2011-06-07 14:10:06 +02:00
Jakob Pfender
ee4912bf79 Revert "common: Include stat.h in include/git2/common.h instead of src/common.h"
This reverts commit df1c98ab6d6171ed63729195bd190b54b67fe530.

As 8a27b6b reverts the exposition of struct stat to the external API, we
do not need - indeed, do not want - struct stat to be in the outer
include layer.
2011-06-07 12:54:43 +02:00
Jakob Pfender
b74c867a1a blob: Stat path inside git_blob_create_fromfile
00582bc introduced a change that required the caller of
git_blob_create_fromfile() to pass a struct stat with the stat
information for the file. Several developers pointed out that this would
make life hard for the bindings developers as struct stat isn't widely
supported by other languages.

Make git_blob_create_fromfile() stat the path itself, eliminating the
need for the file to be stat'ed by the caller. This makes
index_init_entry() more costly as the file will be stat'ed twice but
makes life easier for everyone else.
2011-06-07 12:54:43 +02:00
Jakob Pfender
cbf4f9f41f common: Include stat.h in include/git2/common.h instead of src/common.h
00582bcb introduced a change to git_blob_create_fromfile() that required
the caller to pass a stat struct. This means that we need to include
stat.h higher in the hierarchy of includes.
2011-06-07 12:54:38 +02:00
Jakob Pfender
c1a2a14e02 index: Correctly write entry mode
The entry mode flags for an entry created from a path name were not
correctly written if the entry was a symlink. The st_mode of a statted
symlink is 0120777, however git requires the mode to read 0120000,
because it does not care about permissions of symlinks.

Introduce index_create_mode() that correctly writes the mode flags in
the form expected by git.
2011-06-07 12:54:37 +02:00
Jakob Pfender
1869b31e0c index/fileops: Correctly process symbolic links
gitfo_exists() used to error out if the given file was a symbolic link,
due to access() returning an error code. This is not expected behaviour,
as gitfo_exists() should only check whether the file itself exists, not
its link target if it is a symbolic link.

Fix this by calling gitfo_lstat() instead, which is just a wrapper for
lstat().

Also fix the same error in index_init_entry().
2011-06-07 12:54:37 +02:00
Jakob Pfender
4d7905c579 blob: Require stat information for git_blob_create_fromfile()
In order to be able to write symlinks with git_blob_create_fromfile(),
we need to check whether the file to be written is a symbolic link or
not. Since the calling function of git_blob_create_fromfile() is likely to have
stated the file before calling, we make it pass the stat.

The reason for this is that writing symbolic link blobs is significantly
different from writing ordinary files - we do not want to open the link
destination but instead want to write the link itself, regardless of
whether it exists or not.

Previously, index_init_entry() used to error out if the file to be added
was a symlink that pointed to a nonexistent file. Fix this behaviour to
add the file regardless of whether it exists. This mimics git.git's
behaviour.
2011-06-07 12:54:36 +02:00
nulltoken
f120e92b23 Fix compilation warnings in MSVC 2011-06-07 08:41:33 +02:00
Vicent Marti
340fc0d40a threads: Cleanup TLS declarations
This time for good.
2011-06-07 03:39:19 +02:00
Vicent Marti
9d77d83a81 Revert "threads: Fix TLS declarations"
This commit uploaded an old broken test. Oops!
2011-06-07 03:38:09 +02:00
Vicent Martí
1097dacd7d Merge pull request #240 from Romain-Geissler/tree-object-type
Tree: Added a function that returns the type of a tree entry.
2011-06-06 18:33:38 -07:00
Vicent Martí
9b1692ebfc Merge pull request #239 from pegonma/oid_prefix
Search objects of different types given OID prefix
2011-06-06 18:31:21 -07:00
Vicent Martí
1b0d92b141 Merge pull request #238 from pegonma/git_oid_ncmp
Better name for git_oid_match
2011-06-06 18:28:11 -07:00
Vicent Martí
fe79750baa Merge pull request #236 from Jopie64/development
Fix build errors on MSVC
2011-06-06 18:27:29 -07:00
Vicent Martí
00c31dd293 Merge pull request #234 from Romain-Geissler/entry-count-API-uniformisation
[Tree | Index] API uniformisation
2011-06-06 18:26:50 -07:00
Vicent Martí
2c9e7fa35e Merge pull request #232 from schu/ref-available-cb
reference_rename: respect all references v2
2011-06-06 18:24:37 -07:00
Vicent Marti
64fe8c62f9 threads: Fix TLS declarations
Cleanup the thread-utils file. Do not define TLS if libgit2 is not
threadsafe.
2011-06-07 03:22:32 +02:00
Vicent Martí
7d170a4b50 Merge pull request #231 from Romain-Geissler/discovery-path-v2
[Discovery path] Fix and tests
2011-06-06 18:11:15 -07:00
Romain Geissler
ff9a4c130d Tree: Added a function that returns the type of a tree entry. 2011-06-06 17:14:30 +02:00
Marc Pegon
c09093cce2 Renamed git_oid_match to git_oid_ncmp.
As suggested by carlosmn, git_oid_ncmp would probably
be a better name than git_oid_match, for it does the same
as git_oid_cmp but only up to a certain amount of hex digits.
2011-06-06 17:04:37 +02:00
schu
05b49b02ef fileops.c: fix unused warning
Signed-off-by: schu <schu-github@schulog.org>
2011-06-06 12:17:58 +02:00
Marc Pegon
790c6c95fe Added methods to search objects of different types
given an OID prefix.
2011-06-06 11:55:48 +02:00
Romain Geissler
c5d8745fca Tree: Some more size_t to unsigned int type change. 2011-06-06 10:55:54 +02:00
Romain Geissler
efcc87c9d9 Repository: A little fix in error code. GIT_ENOTFOUND is returned when a gitfile is malformed and GIT_ENOTAREPO when the pointed dir is not a repo.
Fixed tests so that it check the right error code.
2011-06-06 10:02:07 +02:00
Vicent Marti
f9213015fd filebuf: Fix printf buffer overflows
The filebuf was not being properly written after a flush. This should
cut it now.

Fixes #228
2011-06-06 01:54:59 +02:00
Vicent Marti
2b397327e6 refs: Improve error messages 2011-06-06 01:54:25 +02:00
Romain Geissler
5ec05d0748 Repository: Fixed retrieve_device return type. 2011-06-06 01:26:01 +02:00
Johan 't Hart
393a9f9ee1 Fix build errors on MSVC 2011-06-06 00:33:23 +02:00
Romain Geissler
f11e079733 Index: API uniformisation: Use unsigned int for all index number.
Feature Added: Search an unmerged entry by path (git_index_get_unmerged
renamed to git_index_get_unmerged_bypath) or by index (git_index_get_unmerged_byindex).
2011-06-05 21:19:03 +02:00
Romain Geissler
e5c8009731 Tree: API uniformasation: Use unsigned int for all index number. 2011-06-05 21:18:05 +02:00
schu
76b15cb18a Raise GIT_EEXISTS in case of conflicting ref names instead of passing
the error returned by the subsystem; clarify error message.

Fix tiny typo.

Signed-off-by: schu <schu-github@schulog.org>
2011-06-05 20:55:23 +02:00
schu
1b6d8163ce Teach reference_rename() to really respect other references
Add a new function reference_available() to check if a reference name
actually is free and can be used.

Signed-off-by: schu <schu-github@schulog.org>
2011-06-05 19:22:32 +02:00
schu
fd21c6f67f Add test case checking we do not corrupt the repository when renaming
Signed-off-by: schu <schu-github@schulog.org>
2011-06-05 19:20:57 +02:00
Romain Geissler
76e9e3b763 Tests: Added tests for git_repository_discover.
Unfortunately, the across_fs flag can't be tested automaticly, as we can't
create a temporary new filesystem.
2011-06-05 00:23:24 +02:00
Romain Geissler
a993e4fe06 Fileops: Fixed gitfo_mkdir_recurs so that it proprely works with a path without trailing slash.
It used to discard the last directory if the path didn't have a trailing slash.
2011-06-05 00:20:35 +02:00