aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/object
Commit message (Collapse)AuthorAgeFilesLines
* Fix typo in comment of func TestCancelgopye2020-04-271-1/+1
|
* plumbing: object, make renames diff defaultMáximo Cuadros2020-04-253-16/+55
|
* plumbing: detect renames by hash and similar content in diff treeMiguel Molina2020-04-234-4/+1374
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit implements the rename detection algorithms used in the JGit implementation. Given a list of changes, additions and deletions are extracted and matched in two ways: - By exact hash content: all additions and deletions are grouped by the content hash and paired with the best match based on the file mode and file path. All the files that cannot be paired are kept as regular deletions and additions. - By similar content: a matrix of addition and deletion pairs with all possible combinations is created and scored by how similar the content is between both files as well as how similar the file path is. The pairs with the best score and whose score is equal or greater than a threshold are paired and turned into a rename. All the files that cannot be paired are kept as regular deletions and additions. DiffTree and DiffTreeContext will not return the changes with renames detected for compatibility reasons, although this will change in v6 so that detecting renames is the default behaviour. A new function DiffTreeWithOptions has been added to configure the parameters for the rename detection to control the score threshold, the limit of renames and whether to use similar content detection in the detection. More information: - https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/diff/RenameDetector.java - https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityRenameDetector.java - https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/diff/SimilarityIndex.java Signed-off-by: Miguel Molina <miguel@erizocosmi.co>
* *: migration from go-git-fixtures/v4 and go-git/gcfgMáximo Cuadros2020-03-1014-34/+28
|
* *: migration from gopkg to go modulesMáximo Cuadros2020-03-1037-122/+122
|
* Merge pull request #7 from dsymonds/masterMáximo Cuadros2020-03-101-2/+5
|\ | | | | plumbing/object: avoid O(N^2) string building when decoding commit message
| * 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>
* | Merge pull request #3 from go-git/pr-1248Máximo Cuadros2020-03-101-12/+24
|\ \ | | | | | | git.LogOptions: add `PathFilter func(string) bool`
| * | add NewCommitPathIterFromIter that accepts pathFilter func(string) boolSaeed Rasooli2019-11-291-12/+24
| |/ | | | | | | | | | | keep NewCommitFileIterFromIter for compatibilty for now Signed-off-by: Saeed Rasooli <saeed.gnu@gmail.com>
* | hack to prevent codecov from adding more codepathsAndrew Thornton2020-02-231-6/+3
| | | | | | | | Signed-off-by: Andrew Thornton <art27@cantab.net>
* | Fix date readingAndrew Thornton2020-02-231-7/+12
|/ | | | | | | | | | | | | | | | In the British TZ the following time: ``` 1579639200 +0100 ``` will be erroneously parsed as being with the GMT TZ. This leads to multiple errors with GPG validation. This PR fixes this by using the provided TZ information to create a FixedZone and sets that as the TZ Signed-off-by: Andrew Thornton <art27@cantab.net>
* 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>