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
David Glesser
1c68d27d07
Fix the error pointed out by tanoku.
...
Now the code shoulb be c89.
2011-06-07 10:15:31 +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
Romain Geissler
f2a60854cd
Repository: Fixed the path returned by read_gitfile (remove trailing slashes)
2011-06-05 00:18:34 +02:00
Romain Geissler
8b05e78018
Repository: Fixed a bug in read_gitfile (proprely remove trailings newlines)
2011-06-05 00:17:26 +02:00
Vicent Marti
602ee38b6e
repository: Export all internal paths
2011-06-04 20:45:09 +02:00
Romain Geissler
9d9bab5c38
Repository: Fixed some errors with ceiling_dirs in git_repository_discover.
...
Now the ceiling_dirs are compared with their symbolic free version (like base_path).
The ceiling dirs check is now performed after getting the parent directory.
2011-06-04 16:28:39 +02:00
David Glesser
f4c925c514
Change a dirty indentation
2011-06-04 16:09:19 +02:00
Vicent Martí
793545ef2b
Merge pull request #227 from Romain-Geissler/discovery-path-v2
...
Discovery path v2
2011-06-03 17:41:53 -07:00
Romain Geissler
fd0574e5ad
Repository: Added the git_repository_discover function that finds by itself the git directory that manage a given directory path.
2011-06-04 01:05:36 +02:00
Romain Geissler
222cf1d459
Repository: Splitted the repository destructor into a helper part (only free directories path) and the complete public destructor.
2011-06-04 00:14:37 +02:00
Romain Geissler
6a01b6bd60
Repository: Added read_gitfile that allows you to read a .git file and extract the git directory path.
2011-06-04 00:10:55 +02:00
Romain Geissler
f2e6b8776e
Repository: Added some util functions that we'll need to discover repository path.
...
retrieve_device returns the file device for a given path (so that we can detect device change while walking through parent directories).
abspath returns a canonicalized path, symbolic link free.
retrieive_ceiling_directories_offset returns the biggest path offset that path match in the ceiling directory list (so that we can stop at ceiling directories).
2011-06-04 00:00:28 +02:00
Romain Geissler
1549cba9a4
Filebuf: Fixed a TODO in filebuf (real lock in lock_file)
...
Added gitfo_creat_locked and gitfo_creat_locked_force
2011-06-03 23:08:42 +02:00
Vicent Marti
3a42e0a370
index: Add git_index_entry_stage
method
...
As suggested by Romain-Geissler
2011-06-03 21:38:55 +02:00
Romain Geissler
bc6484912e
Fileops: Added gitfo_isfile.
...
Conflicts:
src/fileops.c
2011-06-03 21:20:20 +02:00
unknown
26a98ec8a2
Fileops: Added a fourth argument to the path prettifying functions to use an alternate basepath.
...
Fixed a Windows TO-DO in the prettifying functions.
2011-06-03 21:04:02 +02:00
unknown
bb88da7f90
Sha1Lookup: Fixed two MSVC compilation warnings.
2011-06-03 21:03:58 +02:00
Vicent Marti
0291b5b76b
odb: Fix loading ODB alternates
...
Fixed an issue with the `strtokz implementation and added support for
comments and relative paths in the alternates file.
2011-06-03 20:01:18 +02:00
Romain Geissler
04fdc10d35
Fileops:retrieve_path_root_offset is now named gitfo_retrieve_path_root_offset (like other public functions). Added platform specific directory separator definition.
2011-06-03 19:26:45 +02:00
Vicent Martí
1e9b7a09ff
Merge pull request #144 from nordsturm/fix_fakewstream
...
Fix fake wstream write
2011-06-02 15:12:37 -07:00