summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* remote: Cleanup the remotes coderepo-ownershipVicent Marti2011-11-2810-206/+201
| | | | | | - Hide the remaining transports code - Drop `git_headarray`, switch to using a callback to list refs. Makes the code cleaner.
* repository: Use `git_config` when initializingVicent Marti2011-11-261-14/+2
| | | | Thanks @carlosmn!
* util: Remove unused macroVicent Marti2011-11-261-19/+0
|
* refcount: Fix off-by one errorVicent Marti2011-11-261-1/+1
|
* Rename all `_close` methodsVicent Marti2011-11-269-21/+21
| | | | | There's no difference between `_free` and `_close` semantics: keep everything with the same name to avoid confusions.
* repository: Change ownership semanticsVicent Marti2011-11-2621-380/+571
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ownership semantics have been changed all over the library to be consistent. There are no more "borrowed" or duplicated references. Main changes: - `git_repository_open2` and `3` have been dropped. - Added setters and getters to hotswap all the repository owned objects: `git_repository_index` `git_repository_set_index` `git_repository_odb` `git_repository_set_odb` `git_repository_config` `git_repository_set_config` `git_repository_workdir` `git_repository_set_workdir` Now working directories/index files/ODBs and so on can be hot-swapped after creating a repository and between operations. - All these objects now have proper ownership semantics with refcounting: they all require freeing after they are no longer needed (the repository always keeps its internal reference). - Repository open and initialization has been updated to keep in mind the configuration files. Bare repositories are now always detected, and a default config file is created on init. - All the tests affected by these changes have been dropped from the old test suite and ported to the new one.
* Merge pull request #497 from carlosmn/configVicent Martí2011-11-251-5/+21
|\ | | | | Don't fail when opening a new config file
| * config: allow to open and write to a new fileCarlos Martín Nieto2011-11-261-5/+21
| |
* | Merge pull request #491 from schu/refs-cleanupVicent Martí2011-11-253-28/+39
|\ \ | |/ |/| reference_rename() cleanup
| * reference_rename: don't delete the reflogschu2011-11-211-22/+9
| | | | | | | | | | | | | | | | reference_rename used to delete an old reflog file when renaming a reference to not confuse git.git. Don't do this anymore but let the user take care of writing a reflog entry. Signed-off-by: schu <schu-github@schulog.org>
| * Add git_reflog_rename() and git_reflog_delete()schu2011-11-211-0/+26
| | | | | | | | Signed-off-by: schu <schu-github@schulog.org>
| * reference_rename: make sure to rollbackschu2011-11-211-1/+4
| | | | | | | | | | | | | | Actually rollback when we can't create the new reference. Mark the rolled back reference as loose. Signed-off-by: schu <schu-github@schulog.org>
| * fileops.h: remove git_futils_mv_atomic prototypeschu2011-11-211-5/+0
| | | | | | | | | | | | | | 0c49ec2 replaced git_futils_mv_atomic with p_rename without removing its prototype. Signed-off-by: schu <schu-github@schulog.org>
* | transport: Add `git_transport_valid_url`Vicent Marti2011-11-221-15/+21
| |
* | Free the created refs in git_remote_update_tipsCarlos Martín Nieto2011-11-221-0/+3
| |
* | Set transport to NULL after freeing itCarlos Martín Nieto2011-11-221-0/+1
| |
* | remote: Assert things that should be assertedVicent Marti2011-11-221-7/+23
| |
* | Merge pull request #492 from carlosmn/networkingVicent Martí2011-11-217-84/+147
|\ \ | | | | | | Networking improvements
| * | Add git_remote_connectedCarlos Martín Nieto2011-11-211-0/+5
| | | | | | | | | | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | Add git_remote_disconnectCarlos Martín Nieto2011-11-211-6/+11
| | | | | | | | | | | | | | | | | | | | | It can be useful to separate disconnecting from actually destroying the object. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | refspec: allow a simple branchnameCarlos Martín Nieto2011-11-181-2/+7
| | | | | | | | | | | | | | | | | | | | | A simple branchname as refspec is valid and we shouldn't throw an error when encountering one. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | refspec: make the structure more completeCarlos Martín Nieto2011-11-181-1/+4
| | | | | | | | | | | | | | | | | | | | | Add a next pointer to make it a linked list and add the 'pattern' and 'matching' flags. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | Add a name to a remote created from the APICarlos Martín Nieto2011-11-181-1/+13
| | | | | | | | | | | | | | | | | | Make it a bit more resilient. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | remote: get rid of git_remote_negotiateCarlos Martín Nieto2011-11-181-5/+5
| | | | | | | | | | | | | | | | | | | | | There is no good reason to expose the negotiation as a different step to downloading the packfile. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
| * | net: move the reference storage to common codeCarlos Martín Nieto2011-11-184-69/+102
| |/
* | filebuf: add GIT_FILEBUF_INIT and protect multiple opens and cleanupsRussell Belfer2011-11-228-12/+39
|/ | | | | | | | Update all stack allocations of git_filebuf to use GIT_FILEBUF_INIT and make git_filebuf_open and git_filebuf_cleanup safe to be called multiple times on the same buffer. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Don't overwrite existing objectsCarlos Martín Nieto2011-11-181-0/+11
| | | | | | | It's redundant to do this (git doesn't) and Windows doesn't allow us to overwrite a read-only file (which objects are). Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* tree: Add payload to `git_tree_walk`Vicent Marti2011-11-181-5/+9
|
* Rename `git_tree_frompath` to `git_tree_get_subtree`Vicent Marti2011-11-181-14/+42
| | | | That makes more sense to me.
* refs: move GIT_PACKED_REFS_FILE_MODE to refs.h as GIT_PACKEDREFS_FILE_MODEBrodie Rao2011-11-162-3/+2
| | | | | This groups the #define with the other ref-related file modes, and it makes the name consistent with the other packed-refs definitions.
* refs: use 0666 permissions when writing packed-refs, not 0644Brodie Rao2011-11-161-1/+1
| | | | This matches stock Git's behavior.
* threads: Fix the shared global state with TLSVicent Marti2011-11-168-63/+233
| | | | | | | See `global.c` for a description of what we're doing. When libgit2 is built with GIT_THREADS support, the threading system must be explicitly initialized with `git_threads_init()`.
* Write packed-refs with 0644 permissionsCarlos Martín Nieto2011-11-071-1/+3
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Reword packed-refs error messages so they're easier to track downCarlos Martín Nieto2011-11-071-4/+4
| | | | Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Implement p_renameCarlos Martín Nieto2011-11-076-25/+32
| | | | | | Move the callers of git_futils_mv_atomic to use p_rename. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* reflog: Do not free references before timenew-referencesVicent Marti2011-11-061-10/+20
|
* refs: Partial rewrite for read-only refsVicent Marti2011-11-063-848/+623
| | | | | | | | | | | | | | | | | | | | | | | | | This new version of the references code is significantly faster and hopefully easier to read. External API stays the same. A new method `git_reference_reload()` has been added to force updating a memory reference from disk. In-memory references are no longer updated automagically -- this was killing us. If a reference is deleted externally and the user doesn't reload the memory object, nothing critical happens: any functions using that reference should fail gracefully (e.g. deletion, renaming, and so on). All generated references from the API are read only and must be free'd by the user. There is no reference counting and no traces of generated references are kept in the library. There is no longer an internal representation for references. There is only one reference struct `git_reference`, and symbolic/oid targets are stored inside an union. Packfile references are stored using an optimized struct with flex array for reference names. This should significantly reduce the memory cost of loading the packfile from disk.
* git_reference_rename: cleanup reference renamingschu2011-11-061-37/+35
| | | | | | | | | git_reference_rename() didn't properly cleanup old references given by the user to not break some ugly old tests. Since references don't point to libgit's internal cache anymore we can cleanup git_reference_rename() to be somewhat less messy. Signed-off-by: schu <schu-github@schulog.org>
* Free all used references in the source treeschu2011-11-065-17/+77
| | | | | | | Since references are not owned by the repository anymore we have to free them manually now. Signed-off-by: schu <schu-github@schulog.org>
* refs: split internal and external referencesschu2011-11-063-128/+303
| | | | | | | | | | | | | | | | | Currently libgit2 shares pointers to its internal reference cache with the user. This leads to several problems like invalidation of reference pointers when reordering the cache or manipulation of the cache from user side. Give each user its own git_reference instead of leaking the internal representation (struct reference). Add the following new API functions: * git_reference_free * git_reference_is_packed Signed-off-by: schu <schu-github@schulog.org>
* Merge pull request #468 from nulltoken/ntk/fix/issue-465Vicent Martí2011-10-291-27/+48
|\ | | | | Status: fix segfault (#465) and order issues
| * status: Fix a sorting issue in the treewalkernulltoken2011-10-291-7/+26
| | | | | | | | | | | | | | This ensures that entries from the working directory are retrieved according to the following rules: - The file "subdir" should appear before the file "subdir.txt" - The folder "subdir" should appear after the file "subdir.txt"
| * status: Prevent segfaulting when determining the status of a repositorynulltoken2011-10-291-20/+22
| | | | | | | | Fixes #465
* | Merge pull request #456 from brodie/perm-fixesVicent Martí2011-10-2824-54/+79
|\ \ | |/ |/| Create objects, indexes, and directories with the right file permissions
| * *: correct and codify various file permissionsBrodie Rao2011-10-1417-18/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following files now have 0444 permissions: - loose objects - pack indexes - pack files - packs downloaded by fetch - packs downloaded by the HTTP transport And the following files now have 0666 permissions: - config files - repository indexes - reflogs - refs This brings libgit2 more in line with Git. Note that git_filebuf_commit() and git_filebuf_commit_at() have both gained a new mode parameter. The latter change fixes an important issue where filebufs created with GIT_FILEBUF_TEMPORARY received 0600 permissions (due to mkstemp(3) usage). Now we chmod() the file before renaming it into place. Tests have been added to confirm that new commit, tag, and tree objects are created with the right permissions. I don't have access to Windows, so for now I've guarded the tests with "#ifndef GIT_WIN32".
| * fileops/repository: create (most) directories with 0777 permissionsBrodie Rao2011-10-1411-23/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
| * fileops/posix: replace usage of "int mode" with "mode_t mode"Brodie Rao2011-10-147-20/+20
| | | | | | | | | | Note: Functions exported from fileops take const mode_t, while the underlying POSIX wrappers take mode_t.
* | global: Properly use `git__` memory wrappersVicent Marti2011-10-2847-268/+270
| | | | | | | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* | tree: Add traversal in post-orderVicent Marti2011-10-271-2/+54
| |
* | Merge branch 'status' of https://github.com/carlosmn/libgit2 into developmentVicent Marti2011-10-271-37/+17
|\ \