src/revparse.c


Log

Author Commit Date CI Message
Etienne Samson cd5e33fb 2019-11-06T11:08:23 global: DRY includes of assert.h
Patrick Steinhardt 7aacf027 2019-09-13T08:55:33 global: convert all users of POSIX regex to use our new regexp API The old POSIX regex API has been superseded by our new regexp API. Convert all users to make use of the new one.
Edward Thomson 02683b20 2019-01-12T23:06:39 regexec: prefix all regexec function calls with p_ Prefix all the calls to the the regexec family of functions with `p_`. This allows us to swap out all the regular expression functions with our own implementation. Move the declarations to `posix_regex.h` for simpler inclusion.
Edward Thomson f673e232 2018-12-27T13:47:34 git_error: use new names in internal APIs and usage Move to the `git_error` name in the internal API for error-related functions.
Edward Thomson cd350852 2019-01-17T10:40:13 object_type: GIT_OBJECT_BAD is now GIT_OBJECT_INVALID 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`.
Edward Thomson 168fe39b 2018-11-28T14:26:57 object_type: use new enumeration names Use the new object_type enumeration names within the codebase.
Patrick Steinhardt 2613fbb2 2018-10-18T11:58:14 global: replace remaining use of `git__strtol32` 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.
Patrick Steinhardt ecf4f33a 2018-02-08T11:14:48 Convert usage of `git_buf_free` to new `git_buf_dispose`
Patrick Steinhardt 06b8a40f 2018-02-16T11:29:46 Explicitly mark fallthrough cases with comments 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.
Patrick Steinhardt 0c7f49dd 2017-06-30T13:39:01 Make sure to always include "common.h" first 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.
William Bain 8b107dc5 2017-05-03T11:20:57 revparse: support open-ended ranges Support '..' and '...' ranges where one side is not specified. The unspecified side defaults to HEAD. Closes #4223
Edward Thomson 909d5494 2016-12-29T12:25:15 giterr_set: consistent error messages 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
Arthur Schreiber ab96ca55 2016-10-06T13:15:31 Make sure we use the `C` locale for `regcomp` on macOS.
Vicent Marti 1e71354e 2014-09-05T03:24:43 reflog: Error handling on empty reflog
Carlos Martín Nieto c74077d1 2014-02-02T12:08:18 revparse: do look at all refs when matching text 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.
Linquize e7c66fc8 2014-01-20T23:32:18 git_reflog_entry_message can be null
Carlos Martín Nieto b976f3c2 2013-08-19T13:01:49 reflog: move the reflog implementation into refdb_fs 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.
nulltoken 8cf80525 2013-09-11T20:13:59 errors: Fix format of some error messages
nulltoken 1634df8c 2013-09-07T17:31:30 revparse: Simplify error handling
nulltoken a8d67afe 2013-09-07T17:21:41 revparse: Prevent unnecessary odb backend calls
Carlos Martín Nieto 6d69fbce 2013-08-19T13:04:05 Revparse does not handle refspecs
Evan Hanson 1616fa68 2013-08-15T17:25:05 revparse: Use more idiomatic error value test
Evan Hanson 899ec41f 2013-08-15T16:25:48 revparse: Free left side of invalid range revspecs 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.
nulltoken 80fd31fa 2013-07-13T13:30:23 revparse: Don't return a reference when asked for a git object Fix #1722
Russell Belfer 37f66e82 2013-06-12T15:21:21 Fix Windows warnings This fixes problems with missing function prototypes and 64-bit data issues on Windows.
nulltoken f672cd2a 2013-05-10T20:15:57 revparse: Make revparse_ext() return git_reference from names as well
nulltoken e841c533 2013-05-09T16:42:39 revparse: Introduce git_revparse_ext() Expose a way to retrieve, along with the target git_object, the reference pointed at by some revparse expression (`@{<-n>}` or `<branchname>@{upstream}` syntax).
nulltoken dcaa898d 2013-05-09T16:52:04 revparse: Simplify temporary reference freeing
nulltoken 1fed6b07 2013-05-13T21:57:37 Fix trailing whitespaces
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.
Russell Belfer f470b00b 2013-05-01T15:48:40 Fix one error not reported in revparse 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.
Russell Belfer 2aee1aa4 2013-04-18T14:35:13 Fix uninitialized var warnings
Vicent Marti cbda09d0 2013-04-15T23:40:46 git_revision -> git_revspec
Vicent Marti 36c2dfed 2013-04-15T23:32:40 Is this crazy?
Vicent Marti d064c747 2013-04-15T23:18:24 Merge remote-tracking branch 'ben/unified-revparse' into development
Ben Straub 299a224b 2013-04-15T12:00:04 Change git_revparse to output git_object pointers This will probably prevent many lookup/free operations in calling code.
Ben Straub 4291ad07 2013-04-15T11:42:34 Reintroduce git_revparse_single.
Vicent Martí ea8bac37 2013-04-11T06:34:59 Merge pull request #1450 from carlosmn/branch-upstream Branch upstream configuration
Vicent Marti 575a54db 2013-04-10T16:55:29 object: Export git_object_dup
Ben Straub 1aa21fe3 2013-04-09T05:03:51 Deprecate git_revparse_single and _rangelike
Ben Straub 8480eef7 2013-03-11T20:27:16 Implement unified git_revparse
Vicent Marti d9ecaf8c 2013-04-07T07:22:38 Merge remote-tracking branch 'gnprice/revwalk' into development
Greg Price b208d900 2013-03-20T10:01:58 revparse: Parse range-like syntax Signed-off-by: Greg Price <price@mit.edu>
Carlos Martín Nieto a258d8e3 2013-03-30T03:39:19 branch: rename 'tracking' to 'upstream' The term 'tracking' is overloaded. Help distinguish what we mean by using 'upstream' for this part of the library.
Arkadiy Shapkin 10c06114 2013-03-17T04:46:46 Several warnings detected by static code analyzer fixed 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
Edward Thomson d00d5464 2013-03-01T15:37:33 immutable references and a pluggable ref database
nulltoken 0e8e5a61 2013-02-03T11:44:26 revparse: Lookup sha before branch
nulltoken 545b479a 2013-02-02T17:36:20 revparse: Lookup branch before described tag Fix #1306
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
nulltoken cc146626 2012-11-19T19:00:46 revparse: Deploy EINVALIDSPEC usage
Russell Belfer a8122b5d 2012-11-21T15:39:03 Fix warnings on Win64 build
Ben Straub 2508cc66 2012-11-18T21:38:08 Rename ref and reflog apis for consistency
Michael Schubert 0066955d 2012-11-18T04:27:49 Fix a couple of warnings
nulltoken b15df1d9 2012-11-17T18:29:51 reflog: make entry_byindex() and drop() git compliant Passing 0 as the index now retrieves the most recent entry instead of the oldest one.
nulltoken 5912d74c 2012-10-18T22:25:27 revparse: properly handle refnames containing a @ Fix #994
nulltoken 74a24005 2012-09-21T10:28:20 refs: use constants for well-known names
nulltoken 77e06d7e 2012-09-17T07:11:32 refs: introduce git_reference_is_valid_name()
Russell Belfer f335ecd6 2012-08-30T14:24:16 Diff iterators This refactors the diff output code so that an iterator object can be used to traverse and generate the diffs, instead of just the `foreach()` style with callbacks. The code has been rearranged so that the two styles can still share most functions. This also replaces `GIT_REVWALKOVER` with `GIT_ITEROVER` and uses that as a common error code for marking the end of iteration when using a iterator style of object.
Vicent Marti e25dda51 2012-08-02T01:38:30 Merge remote-tracking branch 'nulltoken/topic/amd64-compat' into development Conflicts: src/netops.c src/netops.h src/oid.c
nulltoken b8457baa 2012-07-24T07:57:58 portability: Improve x86/amd64 compatibility
nulltoken fb910281 2012-07-20T16:38:54 branch: introduce git_branch_tracking()
Carlos Martín Nieto 7e48635d 2012-07-23T21:56:06 revparse: initialize 'parsed' in case the user doesn't give a number with the @-notation
Carlos Martín Nieto 279b45b0 2012-07-23T21:22:53 revparse: don't allow an empty string Asking the library for "" used to give HEAD, but that's trying to impose a default at the wrong layer. Make it fail.
nulltoken e2c81fca 2012-07-15T11:59:31 revparse: deploy git_object_peel()
nulltoken b8748c12 2012-07-15T00:46:26 revparse: enhance parsing engine
nulltoken b5f90115 2012-07-12T22:31:53 revparse: fix propagation of error
nulltoken 5a6f31f2 2012-07-12T13:20:29 revparse: only allow decimal specifiers in carete and tilde synatx passing 0 to git_strol(32|64) let the implementation guess if it's dealing with an octal number or a decimal one. Let's make it safe and ensure that both 'HEAD@{010}' and 'HEAD@{10}' point at the same commit.
nulltoken d1b7921a 2012-07-12T11:46:20 revparse: fix disambiguation of refs and abbrev oids
nulltoken bb89cf94 2012-07-12T10:57:31 revparse: simplify handling of the colon syntax
nulltoken 12595ab8 2012-07-12T00:52:01 revparse: deploy git_reference_remote_tracking_from_branch()
nulltoken 2d012c0c 2012-07-11T16:52:02 revparse: deploy git_commit_nth_gen_ancestor()
nulltoken 8f17ed80 2012-07-10T20:52:56 revparse: simplify the parsing of described object
nulltoken 3e82d6c6 2012-07-07T08:25:39 revparse: unfound reference return ENOTFOUND
nulltoken b8460c20 2012-07-06T23:37:44 revparse: do not segfault when retrieving the last entry
nulltoken e7279381 2012-07-06T21:25:42 revparse: fix disambiguation of refs
nulltoken 805c8159 2012-07-06T20:44:17 revparse: unfound previous head return ENOTFOUND
nulltoken 6a5136e5 2012-07-06T12:47:14 revparse: only allow decimal reflog ordinal specs passing 0 to git_strol(32|64) let the implementation guess if it's dealing with an octal number or a decimal one. Let's make it safe and ensure that both 'HEAD@{010}' and 'HEAD@{10}' point at the same commit.
nulltoken 29f72aa6 2012-07-04T22:02:54 revparse: leverage git__isdigit()
nulltoken cab65c2b 2012-07-05T22:26:14 revparse: detect incorrect "refname@{-n}" syntax
nulltoken 494ae940 2012-07-02T17:51:02 revparse: fix parsing of date specifiers
nulltoken 52b938d5 2012-06-29T17:06:38 revparse: unfound reflog entry returns ENOTFOUND
nulltoken 08ac23a5 2012-06-29T17:02:29 revparse: unfound reflog ref returns ENOTFOUND
nulltoken 4de89ce7 2012-06-29T16:51:46 revparse: unfound partially-named ref returns ENOTFOUND
nulltoken 0e7af9e7 2012-06-28T18:04:01 revparse: unfound nth parent returns ENOTFOUND
nulltoken 0d23c62c 2012-06-28T11:09:16 revparse: handle specs with caret and colon
nulltoken 5b68ba7e 2012-06-27T17:27:38 revparse: unfound treepath returns ENOTFOUND
nulltoken faaa7c51 2012-06-27T16:51:19 revparse: return trees through the "colon" syntax
nulltoken e28dd29b 2012-06-28T07:50:16 revparse: replace spaces with tabs
Ben Straub a15e7f86 2012-06-19T21:12:04 Fix indentation.
Ben Straub eb6bc45f 2012-06-19T21:11:48 Avoid uninitialized variable error.
Carlos Martín Nieto cdca82c7 2012-06-20T00:46:26 Plug a few leaks
Carlos Martín Nieto 053b5096 2012-06-19T23:36:36 revparse: handle a non-existent path in the colon syntax oid_for_tree_path may not always find the path in the tree, in which case we need to return an error. The current code doesn't do this and results in undefined behavior.
Ben Straub 2c90145a 2012-06-19T09:24:44 Fix potential segfault in revparse.
Vicent Marti 8c4c357f 2012-06-19T02:43:36 clar: Fix warnings
Michael Schubert c0734593 2012-06-12T11:33:46 revparse: remove unnecessary GIT_BEGIN_DECL
Vicent Martí 3f035860 2012-06-07T22:43:03 misc: Fix warnings from PVS Studio trial
Ben Straub 763b8381 2012-06-07T13:22:50 Fixing rev-parse-induced Travis errors.
Ben Straub 327dc61f 2012-06-07T12:28:08 Prefer git__free (again).
Ben Straub 31dda647 2012-06-07T12:16:39 Rename internal function.
Ben Straub 1a728066 2012-06-06T13:04:08 Remove 'git__' prefix from a static function.