src/refs.c


Log

Author Commit Date CI Message
Russell Belfer 114f5a6c 2013-06-10T10:10:39 Reorganize diff and add basic diff driver This is a significant reorganization of the diff code to break it into a set of more clearly distinct files and to document the new organization. Hopefully this will make the diff code easier to understand and to extend. This adds a new `git_diff_driver` object that looks of diff driver information from the attributes and the config so that things like function content in diff headers can be provided. The full driver spec is not implemented in the commit - this is focused on the reorganization of the code and putting the driver hooks in place. This also removes a few #includes from src/repository.h that were overbroad, but as a result required extra #includes in a variety of places since including src/repository.h no longer results in pulling in the whole world.
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 979f75d8 2013-05-30T17:19:43 Refcounting
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
Edward Thomson b6cc559a 2013-05-11T02:42:49 Merge pull request #1385 from carlosmn/refs-iter Introduce a refs iterator
Carlos Martín Nieto c58cac12 2013-05-04T18:06:14 Introduce a glob-filtering iterator If the backend doesn't provide support for it, the matching is done in refdb on top of a normal 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 95727245 2013-05-04T16:03:17 refs: implement _foreach with the iterator
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.
Russell Belfer 41e93563 2013-05-01T15:08:12 Error messages for a couple other boundary conditions
Vicent Martí cd2ed9f0 2013-04-30T04:02:52 Merge pull request #1518 from arrbee/export-oid-comparison Remove most inlines from the public API
Russell Belfer b7f167da 2013-04-29T13:52:12 Make git_oid_cmp public and add git_oid__cmp
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.
Russell Belfer 21ca0451 2013-04-21T12:52:17 Move git_reference__alloc to include/git2/sys Create a new include/git2/sys/refs.h and move the reference alloc functions there. Also fix some documentation issues and some minor code cleanups.
Russell Belfer 4dcd8780 2013-04-19T17:17:44 Move refdb_backend to include/git2/sys This moves most of the refdb stuff over to the include/git2/sys directory, with some minor shifts in function organization. While I was making the necessary updates, I also removed the trailing whitespace in a few files that I modified just because I was there and it was bugging me.
Edward Thomson 4e4eab52 2013-04-19T18:19:53 alloc doesn't take a refdb; git_refdb_free nicely in the tests
Vicent Marti fedd0f9e 2013-04-17T23:29:34 refs: Do not union the peel
Vicent Marti 13421eee 2013-04-17T22:32:39 refs: Check alloc is cleaner
Vicent Marti 3be933b1 2013-04-17T17:33:51 refs: Add `git_referene_target_peel`
Vicent Marti 575a54db 2013-04-10T16:55:29 object: Export git_object_dup
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
Russell Belfer 55e0f53d 2013-03-14T15:09:29 Fix various build warnings This fixes various build warnings on Mac and Windows (64-bit).
Edward Thomson d00d5464 2013-03-01T15:37:33 immutable references and a pluggable ref database
Carlos Martín Nieto bb45c57f 2013-03-07T16:38:44 refs: explicitly catch leading slashes It's somewhat common to try to write "/refs/tags/something". There is no easy way to catch it during the main body of the function, as there is no way to distinguish whether it's a leading slash or a double slash somewhere in the middle. Catch this at the beginning so we don't trigger the assert in is_all_caps_and_underscore().
Russell Belfer 0d1b094b 2013-02-26T13:15:06 Fix portability issues on Windows The new tests were not taking core.filemode into account when testing file modes after repo initialization. Fixed that and some other Windows warnings that have crept in.
nulltoken c1b5e8c4 2013-02-15T11:35:33 branch: Make git_branch_remote_name() cope with orphaned heads
Russell Belfer 56543a60 2013-02-15T16:02:45 Clear up warnings from cppcheck The cppcheck static analyzer generates warnings for a bunch of places in the libgit2 code base. All the ones fixed in this commit are actually false positives, but I've reorganized the code to hopefully make it easier for static analysis tools to correctly understand the structure. I wouldn't do this if I felt like it was making the code harder to read or worse for humans, but in this case, these fixes don't seem too bad and will hopefully make it easier for better analysis tools to get at any real issues.
nulltoken 2bca5b67 2013-02-07T23:44:18 remote: Introduce git_remote_is_valid_name() Fix libgit2/libgit2sharp#318
nulltoken 4d811c3b 2013-02-07T23:40:10 refs: No component of a refname can end with '.lock'
Carlos Martín Nieto e5ef0f18 2013-01-31T20:23:30 refs: handle ALLOW_ONELEVEL normalization with leading slash A leading slash confuses the name normalization code when the flags include ALLOW_ONELEVEL. Catch this case in particular to avoid triggering an assertion in the uppercase check which expects us not to pass it an empty string. The existing tests don't catch this as they simply use the NORMAL flag. This fixes #1300.
Scott J. Goldman cb35094b 2013-01-22T15:49:51 Allow peeled references without trailing newline at end of file Also ammends one of the tag tests to make sure it's working.
Scott J. Goldman 2a707d0e 2013-01-22T14:08:50 Revert "Handle packed peeled objects without trailing newlines" This reverts commit 28b1cdf3a1bdcd37cf9d550c92b8c19b1782ea6b. //cc #1262 #1267
Scott J. Goldman 28b1cdf3 2013-01-21T14:45:43 Handle packed peeled objects without trailing newlines Fixes #1262
nulltoken bf031581 2013-01-14T14:22:11 branch: Introduce git_branch_tracking_name()
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
Scott J. Goldman ef82ff30 2013-01-05T00:46:39 Handle packed refs with no trailing newline I saw a repo in the wild today which had a master branch ref which was packed, but had no trailing newline. Git handled it fine, but libgit2 choked on it. Fix seems simple enough. If we don't see a newline, assume the end of the buffer is the end of the ref line.
Russell Belfer 3865f7f6 2012-12-27T23:23:12 Invalid ref name normalization leaked memory When normalizing a reference name, if there is an error because the name is invalid, then the memory allocated for storing the name could be leaked if the caller was not careful and assumed that the error return code meant that no allocation had occurred. This fixes that by explicitly deallocating the reference name buffer if there is an error in normalizing the name.
Rick Bradley ed4e887d 2012-12-18T16:09:57 Also, whitespace. I was totally flaunting @ben's 3-space tab advice.
Rick Bradley 33f169e2 2012-12-18T16:07:18 Improve comment text This looked wrong to me. I *think* this is more appropriate commentary.
Ben Straub 28abb187 2012-12-14T14:16:10 Stop returning incorrect error message
Ben Straub b524fe1a 2012-12-14T08:35:59 Local Only ignore ENOTFOUNDs when adding corrupted refs
nulltoken 80d9d1df 2012-11-12T15:42:15 refs: Deploy EINVALIDSPEC usage
nulltoken 83458bb7 2012-11-12T14:06:13 refs: Fix error clearing
Russell Belfer d9023dbe 2012-11-20T17:06:54 API updates for tag.h
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 331e7de9 2012-10-24T17:32:50 Extensions to rmdir and mkdir utilities * Rework GIT_DIRREMOVAL values to GIT_RMDIR flags, allowing combinations of flags * Add GIT_RMDIR_EMPTY_PARENTS flag to remove parent dirs that are left empty after removal * Add GIT_MKDIR_VERIFY_DIR to give an error if item is a file, not a dir (previously an EEXISTS error was ignored, even for files) and enable this flag for git_futils_mkpath2file call * Improve accuracy of error messages from git_futils_mkdir
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.
Russell Belfer 744cc03e 2012-10-30T12:10:36 Add git_config_refresh() API to reload config This adds a new API that allows users to reload the config if the file has changed on disk. A new config callback function to refresh the config was added. The modified time and file size are used to test if the file needs to be reloaded (and are now stored in the disk backend object). In writing tests, just using mtime was a problem / race, so I wanted to check file size as well. To support that, I extended `git_futils_readbuffer_updated` to optionally check file size in addition to mtime, and I added a new function `git_filebuf_stats` to fetch the mtime and size for an open filebuf (so that the config could be easily refreshed after a write). Lastly, I moved some similar file checking code for attributes into filebuf. It is still only being used for attrs, but it seems potentially reusable, so I thought I'd move it over.
Russell Belfer 4c47a8bc 2012-10-17T14:14:51 Merge pull request #968 from arrbee/diff-support-typechange Support TYPECHANGE records in status and adjust checkout accordingly
Carlos Martín Nieto 7ae5ab56 2012-10-15T16:35:10 Fix leak in the tests Also introduce the slective ref trimming promised but also missed in the previous commit.
Carlos Martín Nieto 47f44b6e 2012-10-15T13:51:25 refs: loosen the OID parsing We used to require loose references to contain only an OID (possibly after trimming the string). This is however not enough for letting us lookup FETCH_HEAD, which can have a lot of content after the initial OID. Change the parsing rules so that a loose refernce must e at least 40 bytes long and the 41st (if it's there) must be accepted by isspace(3). This makes the trim unnecessary, so only do it for symrefs. This fixes #977.
nulltoken 3548fcf5 2012-10-11T14:00:26 refs: propagate EEXISTS upon renaming
Russell Belfer 0d64bef9 2012-10-05T15:56:57 Add complex checkout test and then fix checkout This started as a complex new test for checkout going through the "typechanges" test repository, but that revealed numerous issues with checkout, including: * complete failure with submodules * failure to create blobs with exec bits * problems when replacing a tree with a blob because the tree "example/" sorts after the blob "example" so the delete was being processed after the single file blob was created This fixes most of those problems and includes a number of other minor changes that made it easier to do that, including improving the TYPECHANGE support in diff/status, etc.
nulltoken 4ba23be1 2012-10-06T12:20:13 branch: deploy git_branch_is_head()
nulltoken f3cc7834 2012-09-22T12:51:34 refs: deploy git_repository_set_head() usage
nulltoken 74a24005 2012-09-21T10:28:20 refs: use constants for well-known names
Vicent Martí 8bc5cacc 2012-10-01T13:57:32 Merge pull request #961 from arrbee/win64-cleanups Win64 cleanups
Russell Belfer 7c411fd9 2012-10-01T12:32:55 Fix up more Win64 compile warnings
Carlos Martín Nieto c1281493 2012-09-30T11:37:53 refs: propagate EEXISTS Indicate whether the error comes from the ref already existing or elsewhere. We always perform the check and this lets the user write more concise code.
nulltoken 0adfa20a 2012-09-11T11:42:13 refspec: introduce git_refspec__parse()
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 c2948c77 2012-09-14T21:36:49 refs: prevent locked refs from being enumerated Fix #936
nulltoken 31665948 2012-08-24T21:30:45 refs: introduce git_reference_peel() Fix #530
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.
Michael Schubert 0844ed06 2012-08-28T20:15:21 Fix parentheses warning
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
Vicent Marti c07d9c95 2012-08-09T15:33:04 oid: Explicitly include `oid.h` for the inlined CMP
Joshua Peek 186c054d 2012-08-09T14:47:29 Revert implementation changes
Joshua Peek 28e00681 2012-08-09T14:39:56 Ignore ref oid terminator
Russell Belfer 2fe293b6 2012-08-09T11:36:21 trim whitespace when parsing loose refs
Joshua Peek 6ab68290 2012-08-09T12:39:09 Parse ref oids without trailing newline
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 151d81a6 2012-07-12T22:03:28 refs: fix a memory leak
nulltoken 84f18e35 2012-07-12T00:44:07 refs: introduce git_reference_remote_tracking_from_branch()
nulltoken 5ffd510d 2012-07-04T12:23:03 refs: remove seemingly useless giterr_clear() call
nulltoken 33c33707 2012-07-04T12:20:43 refs: deploy git_reference_has_log()
nulltoken 75261421 2012-07-04T11:58:04 refs: add git_reference_has_log()
nulltoken b6bfd96f 2012-07-03T12:07:33 refs: fix moving of the reflog when renaming a ref
nulltoken 527ed554 2012-06-22T15:51:44 references: introduce git_reference_foreach_glob()
nulltoken edebceff 2012-05-01T13:57:45 Add git_reset() Currently supports Soft and Mixed modes.
Vicent Martí 904b67e6 2012-05-18T01:48:50 errors: Rename error codes
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
nulltoken fa6420f7 2012-04-29T21:46:33 buf: deploy git_buf_len()
Michael Schubert 9738e2cd 2012-04-27T18:04:58 refs: fix unused-but-set warning
Russell Belfer c2b67043 2012-04-25T15:20:28 Rename git_khash_str to git_strmap, etc. 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`.
Russell Belfer 01fed0a8 2012-04-25T10:36:01 Convert hashtable usage over to khash 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.