summaryrefslogtreecommitdiff
path: root/src/refs.h
Commit message (Collapse)AuthorAgeFilesLines
* repository: distinguish sequencer cherry-pick and revertcmn/repository-state-sequencerCarlos Martín Nieto2015-11-201-0/+5
| | | | These are not quite like their plain counterparts and require special handling.
* repository: remove log message override for switching the active branchCarlos Martín Nieto2015-03-031-0/+1
| | | | | | We want to use the "checkout: moving from ..." message in order to let git know when a change of branch has happened. Make the convenience functions for this goal write this message.
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-031-2/+1
| | | | | | | | | | The signature for the reflog is not something which changes dynamically. Almost all uses will be NULL, since we want for the repository's default identity to be used, making it noise. In order to allow for changing the identity, we instead provide git_repository_set_ident() and git_repository_ident() which allow a user to override the choice of signature.
* git_rebase_commit: write HEAD's reflog appropriatelyEdward Thomson2014-10-261-0/+9
|
* Introduce reference transactionsCarlos Martín Nieto2014-09-301-0/+2
| | | | | | | | | A transaction allows you to lock multiple references and set up changes for them before applying the changes all at once (or as close as the backend supports). This can be used for replication purposes, or for making sure some operations run when the reference is locked and thus cannot be changed.
* git_cherry_pick -> git_cherrypickEdward Thomson2014-07-221-1/+1
|
* Fixes #2443 Zero size arrays are an extensionphkelley/flexarrayPhilip Kelley2014-06-261-1/+1
|
* Refs: Introduce `git_refname_t`.Arthur Schreiber2014-05-301-0/+2
|
* Refs: Fix some issue when core.precomposeunicode = true.Arthur Schreiber2014-05-301-1/+0
| | | | | | | | | | | This fixes two issues I found when core.precomposeunicode is enabled: * When creating a reference with a NFD string, the returned git_reference would return this NFD string as the reference’s name. But when looking up the reference later, the name would then be returned as NFC string. * Renaming a reference would not honor the core.precomposeunicode and apply no normalization to the new reference name.
* refs: remove the _with_log differentiationCarlos Martín Nieto2014-01-151-1/+1
| | | | | | Any well-behaved program should write a descriptive message to the reflog whenever it updates a reference. Let's make this more prominent by removing the version without the reflog parameters.
* reflog: write to the reflog following git's rulesCarlos Martín Nieto2013-12-091-0/+1
| | | | | | git-core only writes to the reflogs of HEAD, refs/heads/ and, refs/notes/ or if there is already a reflog in place. Adjust our code to follow these semantics.
* Make reference lookups apply precomposeunicodeRussell Belfer2013-10-081-0/+2
| | | | | | | | | | | | | | | | | | | | | Before these changes, looking up a reference would return the same precomposed or decomposed form of the reference name that was used to look it up, so on MacOS which ignores the difference between the two, a single reference could be looked up either way and git_reference_name would return the form of the name that was used to look it up! This change makes lookup always return the precomposed name if core.precomposeunicode is set regardless of which version was used to look it up. The reference iterator was already returning the precomposed form from earlier work. This also updates the CMakeLists.txt rules for enabling iconv usage because the clar tests for this code were actually not being activated properly with the old version. Finally, this moves git_repository_reset_filesystem from include/ git2/repository.h to include/git2/sys/repository.h since it is not really a function that normal library users should have to think about very often.
* Merge pull request #1805 from libgit2/threading-packed-loadVicent Martí2013-08-281-0/+2
|\ | | | | Thread safety for the refdb_fs
| * Add internal ref set_name fn instead of reallocRussell Belfer2013-08-211-0/+2
| | | | | | | | | | | | | | | | The refdb_fs implementation calls realloc directly on a reference object when it wants to rename it. It is not a public object, so this doesn't mess with the immutability of references, but it does assume certain constraints on the reference representation. This commit wraps that assumption in an isolated API to isolate it.
* | refs: add git_reference_is_tagNikolai Vladimirov2013-08-261-0/+1
|/
* refdb_fs: Traits are always surrounded by spacesVicent Marti2013-05-021-1/+1
| | | | This makes parsing easier! :p
* refdb_fs: implement the fully-peeled traitVicent Marti2013-05-021-1/+1
|
* Make git_oid_cmp public and add git_oid__cmpRussell Belfer2013-04-291-0/+1
|
* refs: Do not union the peelvmg/refs-peelVicent Marti2013-04-171-6/+3
|
* refs: Add `git_referene_target_peel`Vicent Marti2013-04-171-2/+5
|
* immutable references and a pluggable ref databaseEdward Thomson2013-03-071-12/+7
|
* branch: Make git_branch_remote_name() cope with orphaned headsnulltoken2013-02-221-0/+1
|
* branch: Introduce git_branch_tracking_name()nulltoken2013-01-161-0/+1
|
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Merge pull request #1026 from nulltoken/repo/stateVicent Martí2012-10-301-0/+6
|\ | | | | repo: enhance git_repository_state() detection
| * repo: enhance git_repository_state() detectionnulltoken2012-10-271-0/+6
| |
* | refs: add GIT_REFS_STASH_FILE definenulltoken2012-10-261-0/+3
|/
* reset changes for mergeEdward Thomson2012-10-241-0/+3
|
* refspec: introduce git_refspec__parse()nulltoken2012-09-251-0/+1
|
* refs: introduce git_reference_is_valid_name()nulltoken2012-09-251-1/+0
|
* refs: make git_reference_normalize_name() accept refspec patternnulltoken2012-09-251-1/+3
|
* Add git_reset()nulltoken2012-06-071-0/+1
| | | | Currently supports Soft and Mixed modes.
* Rename git_khash_str to git_strmap, etc.Russell Belfer2012-04-251-2/+2
| | | | | | This renamed `git_khash_str` to `git_strmap`, `git_hash_oid` to `git_oidmap`, and deletes `git_hashtable` from the tree, plus adds unit tests for `git_strmap`.
* Convert hashtable usage over to khashRussell Belfer2012-04-251-2/+2
| | | | | | | | | | | | | | | This updates khash.h with some extra features (like error checking on allocations, ability to use wrapped malloc, foreach calls, etc), creates two high-level wrappers around khash: `git_khash_str` and `git_khash_oid` for string-to-void-ptr and oid-to-void-ptr tables, then converts all of the old usage of `git_hashtable` over to use these new hashtables. For `git_khash_str`, I've tried to create a set of macros that yield an API not too unlike the old `git_hashtable` API. Since the oid hashtable is only used in one file, I haven't bother to set up all those macros and just use the khash APIs directly for now.
* Add git_reference_lookup_oid and lookup_resolvedRussell Belfer2012-04-171-0/+23
| | | | | | | | | | | | | | Adds a new public reference function `git_reference_lookup_oid` that directly resolved a reference name to an OID without returning the intermediate `git_reference` object (hence, no free needed). Internally, this adds a `git_reference_lookup_resolved` function that combines looking up and resolving a reference. This allows us to be more efficient with memory reallocation. The existing `git_reference_lookup` and `git_reference_resolve` are reimplmented on top of the new utility and a few places in the code are changed to use one of the two new functions.
* Update Copyright headerschu2012-02-131-1/+1
| | | | Signed-off-by: schu <schu-github@schulog.org>
* refs: move GIT_PACKED_REFS_FILE_MODE to refs.h as GIT_PACKEDREFS_FILE_MODEBrodie Rao2011-11-161-0/+1
| | | | | This groups the #define with the other ref-related file modes, and it makes the name consistent with the other packed-refs definitions.
* refs: Partial rewrite for read-only refsVicent Marti2011-11-061-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* refs: split internal and external referencesschu2011-11-061-2/+0
| | | | | | | | | | | | | | | | | 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>
* *: correct and codify various file permissionsBrodie Rao2011-10-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* fetch: store FETCH_HEADCarlos Martín Nieto2011-10-081-0/+1
| | | | | | We should always save the remote's HEAD as FETCH_HEAD locally. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
* Cleanup legal dataVicent Marti2011-09-191-0/+6
| | | | | | | | | | 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.
* reference_rename: git compliant reference renamingschu2011-07-061-0/+2
| | | | | | | | | | | | | | | | So far libgit2 didn't handle the following scenarios: * Rename of reference m -> m/m * Rename of reference n/n -> n Fixed. Since we don't write reflogs, we have to delete any old reflog for the renamed reference. Otherwise git.git will possibly fail when it finds invalid logs. Reported-by: nulltoken <emeric.fermas@gmail.com> Signed-off-by: schu <schu-github@schulog.org>
* refs: Do not overflow when normalizing refnamesVicent Marti2011-06-231-3/+4
|
* refs: Allow MERGE_HEAD in normalize_name()Jakob Pfender2011-04-211-0/+1
| | | | | Do not return with EINVALIDREFNAME when trying to normalize MERGE_HEAD's name.
* Refs are now always in-sync on diskVicent Marti2011-03-161-0/+2
|
* Refactored the opening and the initialization of a repository.nulltoken2011-03-031-0/+3
|
* Finish the References APIVicent Marti2011-03-031-4/+2
| | | | | | | | | | | | | | The following methods have been implemented: git_reference_packall git_reference_rename git_reference_delete The library now has full support for packed references, including partial and total writing. Internal documentation has been updated with the details. Signed-off-by: Vicent Marti <tanoku@gmail.com>
* Split packed from unpacked referencesVicent Marti2011-03-031-10/+7
| | | | | | | | These two reference types are now stored separately to eventually allow the removal/renaming of loose references and rewriting of the refs packfile. Signed-off-by: Vicent Marti <tanoku@gmail.com>