include/git2/refs.h


Log

Author Commit Date CI Message
Dimitris Apostolou 90df4302 2022-01-05T12:18:05 Fix typos
Peter Pettersson 38c34498 2021-10-03T00:12:52 Make enum in includes C90 compliant by removing trailing comma.
David Turner 95b7a639 2021-04-14T21:52:36 git_reference_create_matching: Treat all-zero OID as "must be absent" This is pretty useful in avoiding races: I want to create a ref only if it doesn't already exist. I can't check first because of TOCTOU -- by the time I finish the check, someone else might have already created the ref. And I can't take a lock because then I can't do the create, since the create expects to take the lock. The semantics are inspired by git update-ref, which allows an all-zero old value to mean that the ref must not exist.
Tobias Nießen 25efbc4b 2021-02-22T22:57:16 include: fix typos in comments
Edward Thomson 63460fe4 2020-10-11T13:21:13 refs: deprecate git_reference_is_valid_name
Edward Thomson 29715d40 2020-10-11T12:50:52 refs: introduce git_reference_name_is_valid Provide a function that can check reference name validity but can also signal when an error occurs. Use the name "name_is_valid", which is more suggestive of checking a given name, rather than "is_valid_name", which suggests that the function checks the validity of the current reference's name.
Etienne Samson 764196ff 2019-06-13T20:17:01 doc: add missing documentation comments
Edward Thomson a7d0d14f 2019-01-23T00:07:40 deprecation: move deprecated bits to deprecated.h
Edward Thomson 1b2af79e 2019-01-20T10:49:23 deprecation: use the enum type in declaration The C standard does not specify whether an enum is a signed or unsigned type. Obviously, any enum that includes negative values _must_ be signed, but if all values are positive then the compiler is free to choose signed or unsigned. Thus, by changing the type signatures to `git_object_t` and declaring the old `GIT_OBJ_` values as a signed or unsigned int, we risk a mismatch between what the compiler has chosen for a `git_object_t`'s type and our type declaration. Thus, we declare the deprecated values as the enum instead of guessing.
Edward Thomson 1758636b 2019-01-19T01:38:34 Merge pull request #4939 from libgit2/ethomson/git_ref Move `git_ref_t` to `git_reference_t`
Edward Thomson 22d2062d 2019-01-09T18:25:10 Introduce GIT_CALLBACK macro to enforce cdecl Since we now always build the library with cdecl calling conventions, our callbacks should be decorated as such so that users will not be able to provide callbacks defined with other calling conventions. The `GIT_CALLBACK` macro will inject the `__cdecl` attribute as appropriate.
Edward Thomson 87fe5788 2019-01-16T23:58:09 references: use full name in type names Update the reference type names from an abbreviation (`git_ref`) to use the fullname (`git_reference`). This ensures that we are consistent with our naming for reference types and functions throughout the library. The previous names are now marked as deprecated.
Carlos Martín Nieto 5bd78c48 2018-12-14T14:41:17 refs: constify git_reference_peel We have no need to take a non-const reference. This does involve some other work to make sure we don't mix const and non-const variables, but by splitting what we want each variable to do we can also simplify the logic for when we do want to free a new reference we might have allocated.
Edward Thomson 19faf7c5 2018-11-14T23:35:48 object_type: update public API to use git_object_t git_object_t is the future; update the public API to use it. This will also ensure that we can build our tests which make use of the old API without modification (and without compiler warnings).
Patrick Steinhardt 5963292f 2018-01-12T13:03:19 refs: document need to free refs in foreach-callback References passed to the callback function of `git_reference_foreach` are expected to be owned by the callback. As such, they are never being freed by `git_reference_foreach`, but will have to be freed by the caller. This small detail is never mentioned in the function's documentation, though, making it easy to get wrong. Document this to make it discoverable.
Arthur Schreiber 908f24fd 2016-04-22T10:34:17 Allow creating copies of `git_reference` objects.
Carlos Martín Nieto 659cf202 2015-01-07T12:23:05 Remove the signature from ref-modifying functions 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.
Carlos Martín Nieto a295bd2d 2014-12-06T03:36:18 doc: add documentation to all the public structs and enums This makes them show up in the reference, even if the text itself isn't the most descriptive. These have been found with grep -Przon '\n\ntypedef struct.*?\{' -- include grep -Przon '\n\ntypedef enum.*?\{' -- include
Will Stamper b874629b 2014-12-04T21:06:59 Spelling fixes
Michael Anderson 31b0cb51 2014-05-22T17:16:21 Fixed miscellaneous documentation errors.
Carlos Martín Nieto 891b0277 2014-04-30T11:20:51 refs: document _next_name() If it's not documented, it doesn't show up in the docs (and we really should document, anyway).
Jacques Germishuys 3b4ba278 2014-04-03T15:50:21 Const correctness!
Carlos Martín Nieto 853b1407 2014-03-17T16:10:33 branch: constness fixes
Carlos Martín Nieto 2b40390f 2014-03-13T15:54:53 refs: fix copy-paste doc error
Carlos Martín Nieto 15284a2c 2014-02-10T14:52:28 refs: move current_id before the reflog parameters Keep the reflog parameters as the last two, as they're the optional parameters.
Carlos Martín Nieto 77ad6754 2014-02-10T14:38:01 refs: conditional wording fixups This addresses arrbee's concerns about wording in the conditional reference udpate functions.
Carlos Martín Nieto 5367ec4b 2014-02-05T12:02:52 refs: add an unconditional delete Add it under the git_reference_remove() name, letting the user pass the repo and name, analogous to unconditional setting/creation.
Carlos Martín Nieto 878fb66f 2014-02-05T10:19:17 refs: bring conditional symbolic updates to the frontend Bring the race detection goodness to symbolic references as well.
Carlos Martín Nieto f44fd59e 2014-02-05T11:21:14 refs: check the ref's old value when deleting Recognize when the reference has changed since we loaded it.
Carlos Martín Nieto fc4728e3 2014-01-29T14:07:18 refs: return GIT_EMODIFIED if the ref target moved In case we loose the race to update the reference, return GIT_EMODIFIED to let the user distinguish it from other types of errors.
Carlos Martín Nieto 5d96fe88 2014-01-14T15:33:29 refs: changes from feedback Change the name to _matching() intead of _if(), and force _set_target() to be a conditional update. If the user doesn't care about the old value, they should use git_reference_create().
Carlos Martín Nieto 9b148098 2013-12-18T19:58:16 refs: conditional ref updates Allow updating references if the old value matches the given one.
Arthur Schreiber 50ad7cc2 2014-02-02T18:20:06 Add `git_reference_is_note`.
Ben Straub ccf6ce5c 2014-01-28T11:30:36 Ensure renaming a reference updates the reflog
Arthur Schreiber 3f033c55 2014-01-16T21:53:25 Revert a wrong doc change.
Arthur Schreiber 3f0e3e16 2014-01-16T21:42:28 Fix some documentation issues.
Carlos Martín Nieto 0b28217b 2014-01-15T12:51:31 refs: remove the _with_log differentiation 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.
Vicent Marti 4e1f517c 2013-12-18T09:33:45 Merge pull request #1920 from libgit2/cmn/ref-with-log Reference operations with log
Russell Belfer 373cf6a9 2013-12-09T10:17:47 Update docs for new callback return value behavior
Carlos Martín Nieto f2105129 2013-11-23T14:39:53 refs: expose has_log() on the backend The frontend used to look at the file directly, but that's obviously not the right thing to do. Expose it on the backend and use that function instead.
Carlos Martín Nieto 8d5ec910 2013-11-23T14:13:01 refs: expose a way to ensure a ref has a log Sometimes (e.g. stash) we want to make sure that a log will be written, even if it's not in one of the standard locations. Let's make that easier.
nulltoken ca84e058 2013-05-14T16:40:09 refs: Introduce git_reference_symbolic_set_target_with_log()
nulltoken 14ab0e10 2013-05-14T16:07:33 refs: Introduce git_reference_set_target_with_log()
nulltoken 56ad3782 2013-05-13T17:44:39 refs: Introduce git_reference_symbolic_create_with_log()
nulltoken bba25f39 2013-05-13T16:21:09 refs: Introduce git_reference_create_with_log()
Russell Belfer 92dac975 2013-10-08T16:35:57 Make reference lookups apply precomposeunicode 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.
Nikolai Vladimirov 504850cd 2013-08-25T15:59:50 refs: add git_reference_is_tag
Andrej Mitrovic 0b170f4d 2013-07-01T00:56:54 Fix docs to use proper enum names that exist.
Andreas Linde e1967164 2013-06-24T15:33:41 Fixed most documentation header bugs Fixed a few header @param and @return typos with the help of -Wdocumentation in Xcode. The following warnings have not been fixed: common.h:213 - Not sure how the documentation format is for '...' notes.h:102 - Correct @param name but empty text notes.h:111 - Correct @param name but empty text pack.h:140 - @return missing text pack.h:148 - @return missing text
Vicent Martí 947fad4f 2013-06-03T09:28:58 Merge pull request #1624 from libgit2/vmg/full-ref-iterator Breaking RefDB changes
Vicent Martí 9afc5971 2013-05-31T03:09:38 Merge pull request #1559 from carlosmn/ref-shorthand Introduce git_reference_shorthand
Vicent Marti 4e6e2ff2 2013-05-30T03:47:10 ...Aaaand this works
Vicent Marti ec24e542 2013-05-29T22:47:37 What are the chances, really
Vicent Marti 56960b83 2013-05-28T20:47:55 Liike this
Ben Straub e167ec18 2013-05-21T08:09:17 Merge pull request #1597 from zodiac/patch-1 define "long name" in git_reference_name_to_id
Carlos Martín Nieto fc74343f 2013-05-21T16:51:50 refs: export the glob iterator
Li Xuanji e069478e 2013-05-21T21:35:58 define "long name" in git_reference_name_to_id
Edward Thomson b6cc559a 2013-05-11T02:42:49 Merge pull request #1385 from carlosmn/refs-iter Introduce a refs iterator
Carlos Martín Nieto 2b562c3a 2013-05-04T16:32:58 refs: remove the OID/SYMBOLIC filtering Nobody should ever be using anything other than ALL at this level, so remove the option altogether. As part of this, git_reference_foreach_glob is now implemented in the frontend using an iterator. Backends will later regain the ability of doing the glob filtering in the backend.
Carlos Martín Nieto 4def7035 2013-03-02T19:31:03 refs: introduce an iterator This allows us to get a list of reference names in a loop instead of callbacks.
Carlos Martín Nieto 4f2eb2b7 2013-05-08T02:28:47 Introduce git_reference_shorthand Generate a shorthand name out of the full refname.
Carlos Martín Nieto 98d633cc 2013-05-07T23:28:21 Expose git_reference_dwim Extract this function out of the rev-parse code to be able to DWIM a reference instead of its target.
Carlos Martín Nieto 528a4e24 2013-04-28T14:16:45 Parse shorthand refspecs as valid Relax the ONELEVEL ref naming rules so the refspec parsing code can ask for 'master' to be considered valid.
Vicent Marti 3be933b1 2013-04-17T17:33:51 refs: Add `git_referene_target_peel`
Vicent Marti 33abaad8 2013-03-07T18:58:34 refs: Dude, you're OUT.
Edward Thomson d00d5464 2013-03-01T15:37:33 immutable references and a pluggable ref database
Michael Schubert abeefbbe 2012-12-26T19:16:23 push: properly handle tags Currently, push doesn't really handle tags when queueing objects. Fix it.
Jameson Miller 087f64d3 2012-12-17T18:48:26 Relax refspecs accepted by push
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Vicent Martí e05ca13f 2012-12-05T11:47:19 Merge pull request #1115 from ben/struct-versions Version info for public structs
nulltoken bc05f30c 2012-11-19T18:49:25 object: refine git_object_peel() error report
nulltoken 80d9d1df 2012-11-12T15:42:15 refs: Deploy EINVALIDSPEC usage
Ben Straub f4fc9fdb 2012-11-29T12:26:40 Cleanup nitpicky things
Russell Belfer eecc8050 2012-11-20T14:03:05 Update callback fn ptr for git_reference_foreach As part of API review, use a typedef for the callback fn ptr.
Ben Straub 2508cc66 2012-11-18T21:38:08 Rename ref and reflog apis for consistency
Russell Belfer b90500f0 2012-11-01T14:08:30 Improve docs, examples, warnings This improves docs in some of the public header files, cleans up and improves some of the example code, and fixes a couple of pedantic warnings in places.
Paul Thompson b46708aa 2012-10-11T23:04:08 Separated git_strarray from common.h. Added doxy comments.
nulltoken 77e06d7e 2012-09-17T07:11:32 refs: introduce git_reference_is_valid_name()
nulltoken c030ada7 2012-09-11T12:06:57 refs: make git_reference_normalize_name() accept refspec pattern
nulltoken 31665948 2012-08-24T21:30:45 refs: introduce git_reference_peel() Fix #530
Vicent Marti 62eafd06 2012-08-27T14:54:52 Merge branch 'branch-delete-ref' into development Conflicts: include/git2/refs.h
nulltoken 2e0c8816 2012-08-26T22:08:22 refs: expose git_reference_normalize_name()
Vicent Marti 1c947daa 2012-08-23T15:47:29 branch: Change `git_branch_delete` to take a ref
nulltoken e0db9f11 2012-08-15T17:54:05 refs: fix missing parameter documentation
Vicent Marti 51e1d808 2012-08-06T12:41:08 Merge remote-tracking branch 'arrbee/tree-walk-fixes' into development Conflicts: src/notes.c src/transports/git.c src/transports/http.c src/transports/local.c tests-clar/odb/foreach.c
Russell Belfer 5dca2010 2012-08-03T17:08:01 Update iterators for consistency across library This updates all the `foreach()` type functions across the library that take callbacks from the user to have a consistent behavior. The rules are: * A callback terminates the loop by returning any non-zero value * Once the callback returns non-zero, it will not be called again (i.e. the loop stops all iteration regardless of state) * If the callback returns non-zero, the parent fn returns GIT_EUSER * Although the parent returns GIT_EUSER, no error will be set in the library and `giterr_last()` will return NULL if called. This commit makes those changes across the library and adds tests for most of the iteration APIs to make sure that they follow the above rules.
nulltoken ef4d795e 2012-07-20T16:39:22 refs: drop git_reference_remote_tracking_from_branch()
nulltoken 88bcd515 2012-07-20T16:27:56 branch: introduce git_reference_is_branch()
nulltoken 84f18e35 2012-07-12T00:44:07 refs: introduce git_reference_remote_tracking_from_branch()
nulltoken 75261421 2012-07-04T11:58:04 refs: add git_reference_has_log()
nulltoken 527ed554 2012-06-22T15:51:44 references: introduce git_reference_foreach_glob()
Bruce Mitchener d73c94b2 2012-05-19T20:24:55 Fix spelling errors.
Vicent Martí e172cf08 2012-05-18T01:21:06 errors: Rename the generic return codes
Vicent Martí 2e2e9785 2012-05-18T00:42:24 Properly tag all `enums` with a `_t`
Vicent Martí 4fbd1c00 2012-05-17T20:35:48 refs: git_reference_listall -> git_reference_list
Russell Belfer 26515e73 2012-04-23T10:06:31 Rename to git_reference_name_to_oid
Russell Belfer f201d613 2012-04-13T10:33:14 Add git_reference_lookup_oid and lookup_resolved 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.
schu 5e0de328 2012-02-13T17:10:24 Update Copyright header Signed-off-by: schu <schu-github@schulog.org>
schu a5cd086d 2011-11-21T11:56:00 reference_rename: don't delete the reflog 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>
Vicent Marti d4a0b124 2011-10-30T21:58:33 refs: Partial rewrite for read-only refs 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.