summaryrefslogtreecommitdiff
path: root/src/revparse.c
Commit message (Collapse)AuthorAgeFilesLines
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-221-8/+8
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* object_type: GIT_OBJECT_BAD is now GIT_OBJECT_INVALIDEdward Thomson2019-01-171-2/+2
| | | | | | | We use the term "invalid" to refer to bad or malformed data, eg `GIT_REF_INVALID` and `GIT_EINVALIDSPEC`. Since we're changing the names of the `git_object_t`s in this release, update it to be `GIT_OBJECT_INVALID` instead of `BAD`.
* object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-011-18/+18
| | | | Use the new object_type enumeration names within the codebase.
* global: replace remaining use of `git__strtol32`Patrick Steinhardt2018-10-181-2/+3
| | | | | | | Replace remaining uses of the `git__strtol32` function. While these uses are all safe as the strings were either sanitized or from a trusted source, we want to remove `git__strtol32` altogether to avoid future misuse.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-4/+4
|
* Explicitly mark fallthrough cases with commentsPatrick Steinhardt2018-02-161-4/+1
| | | | | | | | | | | | | | | | | | A lot of compilers nowadays generate warnings when there are cases in a switch statement which implicitly fall through to the next case. To avoid this warning, the last line in the case that is falling through can have a comment matching a regular expression, where one possible comment body would be `/* fall through */`. An alternative to the comment would be an explicit attribute like e.g. `[[clang::fallthrough]` or `__attribute__ ((fallthrough))`. But GCC only introduced support for such an attribute recently with GCC 7. Thus, and also because the fallthrough comment is supported by most compilers, we settle for using comments instead. One shortcoming of that method is that compilers are very strict about that. Most interestingly, that comment _really_ has to be the last line. In case a closing brace follows the comment, the heuristic will fail.
* Make sure to always include "common.h" firstPatrick Steinhardt2017-07-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
* revparse: support open-ended rangesWilliam Bain2017-05-051-3/+22
| | | | | | | Support '..' and '...' ranges where one side is not specified. The unspecified side defaults to HEAD. Closes #4223
* giterr_set: consistent error messagesEdward Thomson2016-12-291-5/+5
| | | | | | | | Error messages should be sentence fragments, and therefore: 1. Should not begin with a capital letter, 2. Should not conclude with punctuation, and 3. Should not end a sentence and begin a new one
* Make sure we use the `C` locale for `regcomp` on macOS.Arthur Schreiber2016-10-061-1/+1
|
* reflog: Error handling on empty reflogVicent Marti2014-09-051-18/+15
|
* revparse: do look at all refs when matching textCarlos Martín Nieto2014-02-051-2/+1
| | | | | Now that we no longer fail to push non-commits on a glob, let's search on all refs when we rev-parse syntax asks us to match text.
* git_reflog_entry_message can be nullLinquize2014-01-201-0/+2
|
* reflog: move the reflog implementation into refdb_fsCarlos Martín Nieto2013-10-021-2/+2
| | | | | | | | | | References and their logs are logically coupled, let's make it so in the code by moving the fs-based reflog implementation to live next to the fs-based refs one. As part of the change, make the function take names rather than references, as only the names are relevant when looking up and handling reflogs.
* errors: Fix format of some error messagesnulltoken2013-09-111-1/+1
|
* revparse: Simplify error handlingnulltoken2013-09-071-11/+3
|
* revparse: Prevent unnecessary odb backend callsnulltoken2013-09-071-6/+3
|
* Revparse does not handle refspecsCarlos Martín Nieto2013-08-191-1/+1
|
* revparse: Use more idiomatic error value testEvan Hanson2013-08-151-1/+1
|
* revparse: Free left side of invalid range revspecsEvan Hanson2013-08-151-7/+3
| | | | | | This fixes a small memory leak in git_revparse where early returns on errors from git_revparse_single cause a free() on the (reallocated) left side of the revspec to be skipped.
* revparse: Don't return a reference when asked for a git objectnulltoken2013-07-131-0/+13
| | | | Fix #1722
* Fix Windows warningsRussell Belfer2013-06-121-2/+4
| | | | | This fixes problems with missing function prototypes and 64-bit data issues on Windows.
* revparse: Make revparse_ext() return git_reference from names as wellnulltoken2013-05-161-14/+23
|
* revparse: Introduce git_revparse_ext()nulltoken2013-05-161-5/+60
| | | | | | Expose a way to retrieve, along with the target git_object, the reference pointed at by some revparse expression (`@{<-n>}` or `<branchname>@{upstream}` syntax).
* revparse: Simplify temporary reference freeingnulltoken2013-05-161-13/+7
|
* Fix trailing whitespacesnulltoken2013-05-151-1/+0
|
* Expose git_reference_dwimCarlos Martín Nieto2013-05-071-65/+4
| | | | | Extract this function out of the rev-parse code to be able to DWIM a reference instead of its target.
* Fix one error not reported in revparseRussell Belfer2013-05-011-1/+8
| | | | | | | There are many paths through revparse that may return an error code without reporting an error, I believe. This fixes one of them. Because of the backtracking in revparse, it is pretty complicated to fix the others.
* Fix uninitialized var warningsRussell Belfer2013-04-181-1/+1
|
* git_revision -> git_revspecVicent Marti2013-04-151-9/+9
|
* Is this crazy?Vicent Marti2013-04-151-18/+14
|
* Merge remote-tracking branch 'ben/unified-revparse' into developmentVicent Marti2013-04-151-22/+44
|\
| * Change git_revparse to output git_object pointersBen Straub2013-04-151-13/+8
| | | | | | | | This will probably prevent many lookup/free operations in calling code.
| * Reintroduce git_revparse_single.Ben Straub2013-04-151-1/+1
| |
| * Deprecate git_revparse_single and _rangelikeBen Straub2013-04-091-26/+1
| |
| * Implement unified git_revparseBen Straub2013-04-081-6/+58
| |
* | Merge pull request #1450 from carlosmn/branch-upstreamVicent Martí2013-04-111-1/+1
|\ \ | | | | | | Branch upstream configuration
| * | branch: rename 'tracking' to 'upstream'Carlos Martín Nieto2013-03-301-1/+1
| | | | | | | | | | | | | | | The term 'tracking' is overloaded. Help distinguish what we mean by using 'upstream' for this part of the library.
* | | object: Export git_object_dupVicent Marti2013-04-101-1/+1
| |/ |/|
* | Merge remote-tracking branch 'gnprice/revwalk' into developmentVicent Marti2013-04-071-0/+25
|\ \ | |/ |/|
| * revparse: Parse range-like syntaxGreg Price2013-04-061-0/+25
| | | | | | | | Signed-off-by: Greg Price <price@mit.edu>
* | Several warnings detected by static code analyzer fixedArkadiy Shapkin2013-03-181-3/+3
| | | | | | | | | | | | | | Implicit type conversion argument of function to size_t type Suspicious sequence of types castings: size_t -> int -> size_t Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)' Unsigned type is never < 0
* | immutable references and a pluggable ref databaseEdward Thomson2013-03-071-1/+2
|/
* revparse: Lookup sha before branchnulltoken2013-02-031-6/+29
|
* revparse: Lookup branch before described tagnulltoken2013-02-031-7/+7
| | | | Fix #1306
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* revparse: Deploy EINVALIDSPEC usagenulltoken2012-12-011-39/+46
|
* Fix warnings on Win64 buildRussell Belfer2012-11-271-20/+19
|
* Rename ref and reflog apis for consistencyBen Straub2012-11-271-6/+6
|
* Fix a couple of warningsMichael Schubert2012-11-181-1/+1
|