aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object
Commit message (Collapse)AuthorAgeFilesLines
* plumbing/object: avoid O(N^2) string building when decoding commit messageDavid Symonds2020-03-101-2/+5
| | | | | | | | | | | Most commits have relatively small messages, so this was never noticeable. However, there are some repositories that have semi-automated messages that can get very large (e.g. github.com/riscv/riscv-clang and its riscv-trunk branch), on the order of 109k lines. Changing from string += to using a bytes.Buffer reduces the time for Commit.Decode for that specific case from 35s to 74ms. Signed-off-by: David Symonds <dsymonds@golang.org>
* Fix typos in comments, variables and function namesOleksandr Redko2019-10-243-8/+8
| | | | Signed-off-by: Oleksandr Redko <oleksandr.red+github@gmail.com>
* Add limiting options to git logknqyf2632019-08-041-0/+65
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* Remove elseknqyf2632019-08-041-1/+2
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* Handle io.EOF error in commitFileIter.ForEachknqyf2632019-08-031-1/+4
| | | | Signed-off-by: knqyf263 <knqyf263@gmail.com>
* plumbing/object: don't assign err from ForEach loopChristian Muehlhaeuser2019-07-291-1/+1
| | | | | | | Since we don't check the value anyway, as it can't possibly be anything but nil. Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit 293e70fbceb5c81f33a96d5705f10785c6063db9)
* *: avoid unnecessary conversionsChristian Muehlhaeuser2019-07-292-3/+3
| | | | | | | No need to convert these values, they're already of the right type. Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit a1d8a7ac8bd0e4aff0f27dbb8bb37b8bd13a1346)
* *: added missing error checks in testsChristian Muehlhaeuser2019-07-291-0/+1
| | | | | | | | | | When we assign a value to err, make sure to also check for it being nil afterwards. If those were intentionally unchecked, we should remove the assignment in the first place. Those checks certainly never harm, but please review thoroughly and let me know. Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit 19d6f42a4d814a50bd262fbb69a9b670db9756a2)
* plumbing/object: simplify codeChristian Muehlhaeuser2019-07-291-8/+2
| | | | | | | | - Use append instead of ranged for loop - Simpler bool comparison Signed-off-by: Christian Muehlhaeuser <muesli@gmail.com> (cherry picked from commit 3918d0e1b73f5e59a8c93e2b5ae99295cef26cf9)
* Merge pull request #1097 from dpordomingo/merge-base-coreMáximo Cuadros2019-06-034-0/+971
|\ | | | | Create merge-base feature
| * Create merge-base featureDavid Pordomingo2019-06-034-0/+971
| | | | | | | | Signed-off-by: David Pordomingo <David.Pordomingo.F@gmail.com>
* | Add doc.go for commitgraph packagesFilip Navara2019-05-071-0/+7
| | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | Fix object/commitgraph testsFilip Navara2019-05-031-0/+3
| | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | Move CommitNode/CommitNodeIndex into separate object/commitgraph packageFilip Navara2019-05-035-20/+23
| | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | Expose Generation property on CommitNodeFilip Navara2019-04-293-0/+18
| | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | pluming: object, adjust to new API names in format/commitgraphFilip Navara2019-04-262-19/+19
| | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | Merge branch 'master' into commitgraph-objFilip Navara2019-04-265-4/+61
|\ \
| * | plumbing: object/{commit,tag} add EncodeWithoutSignature, Implement #1116Antoine GIRARD2019-04-244-4/+57
| | | | | | | | | | | | Signed-off-by: Antoine GIRARD <sapk@sapk.fr>
| * | plumbing: commit.Stats, fix panic on empty chucksMáximo Cuadros2019-04-241-0/+4
| | | | | | | | | | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
* | | Add test for CommitNode.Commit() and CommitNode.Tree()Filip Navara2019-04-241-17/+27
| | | | | | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | | Add test for traversal on mixed object and commit-graphFilip Navara2019-04-241-0/+30
| | | | | | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | | Update commentsFilip Navara2019-04-243-3/+6
| | | | | | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | | Add test for CommitNode.ParentNodes()Filip Navara2019-04-241-2/+26
| | | | | | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | | Code cleanup, split into more files for clarityFilip Navara2019-04-243-205/+200
| | | | | | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | | Move Commit() to CommitNode APIFilip Navara2019-04-241-11/+19
| | | | | | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | | Simplify the CommitNode API, make it look more like CommitFilip Navara2019-04-243-87/+65
| | | | | | | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | | plumbing: object, add APIs for traversing over commit graphsFilip Navara2019-04-243-0/+499
|/ / | | | | | | Signed-off-by: Filip Navara <filip.navara@gmail.com>
* | plumbing: TreeWalker performance improvement, bufio pool for objectsArran Walker2019-04-224-9/+34
| | | | | | | | | | | | | | | | | | Removes path.Clean and path.Join, as they're expensive in comparison to basic string manipulation that can be used here. Adds bufio.Buffer pool to be used by tag, tree and commit object decoding. Signed-off-by: Arran Walker <arran.walker@fiveturns.org>
* | Add test for decoding and verifying signed tags with extra new line after ↵Filip Navara2019-04-201-0/+72
| | | | | | | | | | | | signature Signed-off-by: Filip Navara <navara@emclient.com>
* | plumbing: object, Fix tag message decodingSpencer Judd2019-04-201-1/+1
| | | | | | | | | | | | | | | | | | | | The Decode method was adding one too many newlines to the tag message, causing signature verification to fail. This is because in signed tags produced by `git`, there is a newline after the PGP signature block, resulting in `messageAndSig` having one extra (empty) `[]byte` element. This caused `t.Message` to receive one extra newline. Signed-off-by: Spencer Judd <spencercjudd@gmail.com>
* | plumbing: commit.StatsContext and fix for orphan commit (#1115)v4.11.0Máximo Cuadros2019-04-182-15/+40
| | | | | | plumbing: commit.StatsContext and fix for root commit
* | Merge pull request #1088 from oleksii-shnyra/fix-1074Máximo Cuadros2019-04-182-2/+87
|\ \ | |/ |/| plumbing: object, Count stats properly when no new line added at the …
| * plumbing: commit.Stat test suiteMáximo Cuadros2019-04-181-0/+78
| | | | | | | | Signed-off-by: Máximo Cuadros <mcuadros@gmail.com>
| * plumbing: object, Count stats properly when no new line added at the end. ↵oleksiishnyra2019-03-141-2/+9
| | | | | | | | | | | | Fixes #1074 Signed-off-by: Oleksii Shnyra <oleksii@global>
* | fix panic in object.Tree.FindEntryniukuo2019-03-272-1/+4
| | | | | | | | Signed-off-by: niukuo <niukuo@gmail.com>
* | fix missing error in bfsCommitIteratorniukuo2019-03-211-1/+1
|/ | | | Signed-off-by: niukuo <niukuo@gmail.com>
* Improve error handling logicAntonio Jesus Navarro Perez2019-02-131-4/+4
| | | | Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
* Ignore missing references on log --allAntonio Jesus Navarro Perez2019-02-121-11/+23
| | | | | | To mimic the actual standard git behavior, we must ignore references that are pointing to wrong/unexistent objects. Signed-off-by: Antonio Jesus Navarro Perez <antnavper@gmail.com>
* Refine Log.kuba--2019-01-102-92/+109
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* First lookup if hash exists, then GetCommit.kuba--2019-01-081-6/+6
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* Implement git log --allkuba--2019-01-072-3/+148
| | | | Signed-off-by: kuba-- <kuba@sourced.tech>
* tree: add a Size() method for getting plaintext sizeJeremy Stribling2018-10-112-0/+17
| | | | | | Without reading the entire object into memory. Signed-off-by: Jeremy Stribling <strib@alum.mit.edu>
* Plumbing: object, Add support for Log with filenames. Fixes #826 (#979)Nithin Gangadharan2018-10-111-0/+115
| | | plumbing: object, Add support for Log with filenames. Fixes #826
* Merge branch 'master' of github.com:src-d/go-git into f-add-tagging-supportMáximo Cuadros2018-09-1011-37/+75
|\
| * Expose Storage cache.kuba--2018-09-079-30/+24
| | | | | | | | Signed-off-by: kuba-- <kuba@sourced.tech>
| * Merge pull request #939 from ↵Máximo Cuadros2018-09-042-2/+6
| |\ | | | | | | | | | | | | keybase/taruti/cherrypick-for-upstream-clamp-object-timestamp Clamp object timestamps before unix epoch to unix epoch
| | * plumbing: object: Clamp object timestamps before unix epoch to unix epochTaru Karttunen2018-08-292-2/+6
| | | | | | | | | | | | Signed-off-by: Taru Karttunen <taruti@taruti.net>
| * | object: fix panic when reading object headerJavi Fontan2018-08-172-5/+45
| |/ | | | | | | | | | | | | | | When the first line of the pgp signature is an empty line or some header is malformed it crashes as there's no data for the header element. For example, if author name is "\n". Signed-off-by: Javi Fontan <jfontan@gmail.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>