aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* git: s/TagObjectOptions/CreateTagOptions/Chris Marchesi2018-09-073-13/+13
| | | | | | | Just renaming the TagObjectOptions type to CreateTagOptions so that it's consistent with the other option types. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Add some tests for annotated tag deletionChris Marchesi2018-09-071-3/+110
| | | | | | | | | | | | | | | | | Added a couple of tests for annotated tag deletion: * The first one is a general test and should work regardless of the fixture used - the tag object could possibly be packed, so we do a prune *and* a repack operation before testing to see if the object was GCed correctly. * The second one actually creates the tag to be deleted, so that the tag object gets created as a loose, unpacked object. This is so we can effectively test that purning unpacked objects is now working 100% correctly (this was failing before because tag objects were not supported for walking). Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Don't touch tag objects orphaned by tag deletionChris Marchesi2018-09-071-16/+2
| | | | | | | | Deleting a tag ref for an annotated tag in normal git behavior does not delete the tag object right away. This is handled by the normal GC process. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Add Tag objects to the list of supported objects for walkingChris Marchesi2018-09-071-0/+2
| | | | | | This is necessary to support pruning on Tag objects. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: s/fetch/returns/ on Tag function docChris Marchesi2018-09-071-1/+1
| | | | | | | This is to avoid any ambiguity with the act of "fetching" in git in general. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Don't return tag object with Tag, adjust docs for Tag and TagsChris Marchesi2018-08-232-50/+71
| | | | | | | | | | | | | | | | | | | | I've mainly noticed that in using the current Tag function, that there were lots of times that I was ignoring the ref or the object, depending on what I needed. This was evident in the tests as well. As such, I think it just makes more sense for a singular tag fetcher to return just a ref, through which the caller may grab the annotation if they need it, and if it exists. Also, contrary to the docs on Tags, all tags have a ref, even if they are annotated. The difference between a lightweight tag and an annotated tag is the presence of the tag object, which the ref will point to if the tag is annotated. As such I've adjusted the docs with an example as to how one can get the annotation for a tag ref through the iterator. Source: https://git-scm.com/book/en/v2/Git-Internals-Git-References, tags section. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Discern tag target type from supplied hashChris Marchesi2018-08-233-41/+30
| | | | | | | | | | I figured there was a way to do this without having to have TagObjectOptions supply this in - there is. Added support for this in and removed the object type from TagObjectOptions. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Replace test signing key with one with longer expiryChris Marchesi2018-08-211-53/+53
| | | | | | | | | | | | | | | | The old one was created with defaults, which would have caused CI failures in 2 years. The new one is valid for 10 years: > gpg --list-secret-keys /root/.gnupg/pubring.kbx ------------------------ sec rsa4096 2018-08-22 [SC] [expires: 2028-08-19] 93A17FF01E54328546087C8E029395402EFCCD53 uid [ unknown] foo bar <foo@foo.foo> Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Canonicalize incoming annotated tag messagesChris Marchesi2018-08-212-1/+50
| | | | | | | | | | Tag messages are highly sensitive to being in the expected format, especially when encoding/decoding for PGP verification. As such, we do a simple trimming of whitespace on the incoming message and add a newline on the end, to ensure there are no surprises here. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* plumbing: object, don't add extra newline on PGP signatureChris Marchesi2018-08-211-1/+6
| | | | | | | | | | | | | | | | Tag encoding/decoding seems to be a lot more sensitive to requiring the exact expected format in the object, which generally includes messages canonicalized so that they have a newline on the end (even if they didn't before). As such, the message should be written with the newline (no need for an extra), and the PGP signature right after that, which will be newline split already, so there's no need to split it again. All of this means it's very important for the caller to send the message in the correct format - which I'm correcting in the next commit. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* plumbing: object, correct tag PGP encodingChris Marchesi2018-08-211-7/+3
| | | | | | | | As with the update in ec3d2a8, tag encoding needed to be corrected to ensure extra newlines were not being added in during tag object encoding, so that it did not corrupt the object for verification. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* git: Add tagging supportChris Marchesi2018-08-213-3/+443
| | | | | | | | | | | | | | | | | | | | | | | This adds a few methods: * CreateTag, which can be used to create both lightweight and annotated tags with a supplied TagObjectOptions struct. PGP signing is possible as well. * Tag, to fetch a single tag ref. As opposed to Tags or TagObjects, this will also fetch the tag object if it exists and return it along with the output. Lightweight tags just return the object as nil. * DeleteTag, to delete a tag. This simply deletes the ref. The object is left orphaned to be GCed later. I'm not 100% sure if DeleteTag is the correct behavior - looking for details on exactly *what* happens to a tag object if you delete the ref and not the tag were sparse, and groking the Git source did not really produce much insight to the untrained eye. This may be something that comes up in review. If deletion of the object is necessary, the in-memory storer may require some updates to allow DeleteLooseObject to be supported. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* Merge pull request #920 from vancluever/f-add-commit-signkeyv4.6.0Máximo Cuadros2018-08-174-7/+178
|\ | | | | git: Add ability to PGP sign commits
| * git: Add extra test for testing bad key error caseChris Marchesi2018-08-161-55/+85
| | | | | | | | | | | | I'm hoping this helps get codecov to a tolerable delta. :) Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
| * git: Remove old hash validation codeChris Marchesi2018-08-161-5/+0
| | | | | | | | | | | | | | | | | | | | This will not work for a signed commit as with the GPG signature being a part of the commit, the hash is now non-deterministic. Verification of the commit is done through the validation of the signature. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
| * git: Remove use of strings.BuilderChris Marchesi2018-08-162-2/+4
| | | | | | | | | | | | | | This was added in Go 1.10 and is not supported on Go 1.9. Switched to bytes.Buffer to ensure compatibility. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
| * git: Add ability to PGP sign commitsChris Marchesi2018-08-163-0/+144
| | | | | | | | | | | | | | | | | | | | This adds the ability to sign commits by adding the SignKey field to CommitOptions. If present, the commit will be signed during the WorkTree.Commit call. The supplied SignKey must already be decrypted by the caller. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
| * plumbing: object, Don't add new line at end of commit signatureChris Marchesi2018-08-161-7/+7
| | | | | | | | | | | | | | | | | | | | The way that commit signatures were being written out was causing an extra newline to be written at the end of the commit when the message encoding was already taking care of this. Ultimately, this results in a corrupt object, rendering the object unverifiable with the signature in the commit. Signed-off-by: Chris Marchesi <chrism@vancluevertech.com>
* | Merge pull request #916 from ↵Máximo Cuadros2018-08-174-53/+276
|\ \ | |/ |/| | | | | jfontan/improvement/memory-consumption-new-packfile-parser Improvement/memory consumption new packfile parser
| * plumbing/packfile: do not compute sha1 for already undeltified objectsJavi Fontan2018-08-141-7/+9
| | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| * plumbing/pacfile: tidy up objectInfo structJavi Fontan2018-08-141-36/+22
| | | | | | | | | | | | | | | | * a new hasher is created when needed * delete unused fields * base content is no longer kept in memory Signed-off-by: Javi Fontan <jfontan@gmail.com>
| * plumbing: add buffer cache and use it in packfile parserJavi Fontan2018-08-144-14/+249
|/ | | | | | | It uses less memory and is faster as slices don't have to be converted from/to MemoryObject and they are indexed by offset. Signed-off-by: Javi Fontan <jfontan@gmail.com>
* Merge pull request #906 from src-d/perf/packfile-readsMáximo Cuadros2018-08-1434-1539/+2949
|\ | | | | Improve packfile reading performance
| * plumbing: idxfile, Crc32 to CRC32 and return ok from findHashIndexMiguel Molina2018-08-104-23/+23
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * git: add benchmark for iterating repository objectsMiguel Molina2018-08-101-0/+56
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * plumbing: packfile, open and close packfile on FSObject readsMiguel Molina2018-08-099-75/+174
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * storage: filesystem, add PackfileIter benchmark reading object contentMiguel Molina2018-08-091-0/+67
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * storage: filesystem, close Packfile after iterating objectsMiguel Molina2018-08-092-1/+17
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * plumbing: packfile, rename DiskObject to FSObjectMiguel Molina2018-08-092-15/+15
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * storage: filesystem, benchmark PackfileIterMiguel Molina2018-08-092-15/+94
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * plumbing: packfile, read object content only onceMiguel Molina2018-08-092-7/+40
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * plumbing: packfile, add Parse benchmarkMiguel Molina2018-08-091-0/+30
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * plumbing: packfile, allow non-seekable sources on ParserMiguel Molina2018-08-087-180/+235
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * *: use parser to populate non writable storages and bug fixesMiguel Molina2018-08-0719-1237/+561
| | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * Merge pull request #907 from erizocosmico/feature/fix-testsMiguel Molina2018-08-017-45/+116
| |\ | | | | | | | | | | | | plumbing: packfile, fix package tests Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| | * plumbing: packfile, fix package testsMiguel Molina2018-07-306-43/+88
| |/ | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * Merge pull request #904 from jfontan/feature/new-packfile-parserJavi Fontan2018-07-274-32/+132
| |\ | | | | | | Tests and indexes in packfile decoder
| | * plumbing/packfile: add index generation to decoderJavi Fontan2018-07-271-7/+25
| | | | | | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| | * storage/filesystem: remove duplicated IndexStorageJavi Fontan2018-07-271-15/+0
| | | | | | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| | * plumbing/idxfile: test FindHash and writer with 64 bit offsetsJavi Fontan2018-07-272-10/+107
| |/ | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| * Merge pull request #899 from erizocosmico/feature/new-packfileMiguel Molina2018-07-279-38/+723
| |\ | | | | | | plumbing: packfile, new Packfile representation
| | * plumbing: packfile, lazy object reads with DiskObjectsMiguel Molina2018-07-276-41/+314
| | | | | | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| | * plumbing: packfile, new Packfile representationMiguel Molina2018-07-267-158/+437
| | | | | | | | | | | | Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
| * | Merge pull request #902 from jfontan/feature/new-packfile-parserJavi Fontan2018-07-274-135/+49
| |\ \ | | |/ | |/| Bugfixes and IndexStorage
| | * storage/filesystem: add back IndexStorageJavi Fontan2018-07-271-0/+47
| | | | | | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| | * plumbing: fix two errors in idxfile and packfile decoderJavi Fontan2018-07-262-2/+2
| | | | | | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| | * plumbing, packfile: delete index_test as is no longer usedJavi Fontan2018-07-261-133/+0
| | | | | | | | | | | | Signed-off-by: Javi Fontan <jfontan@gmail.com>
| * | Merge pull request #898 from jfontan/feature/new-packfile-parserJavi Fontan2018-07-2610-47/+831
| |\| | | | | | | Feature/new packfile parser
| | * plumbing, storage: integrate new indexJavi Fontan2018-07-265-45/+57
| | | | | | | | | | | | | | | | | | Now dotgit.PackWriter uses the new packfile.Parser and index. Signed-off-by: Javi Fontan <jfontan@gmail.com>
| | * plumbing/idxfile: index is created only once and retrieved with IndexJavi Fontan2018-07-262-35/+70
| | | | | | | | | | | | | | | | | | Index is also automatically generated when OnFooter is called. Signed-off-by: Javi Fontan <jfontan@gmail.com>