Comments (2)
But I also tried the following code, which I found on the internet. Maybe that's a better method to get the commit infos. But it cannot easily be swapped, as the behavior is different in non-standard cases.
def getCommitLogFast(git: Git, from: String, to: String): List[CommitInfo] = {
val since = git.getRepository.resolve(from)
val until = git.getRepository.resolve(to)
git.log.addRange(since, until).call.asScala.map(new CommitInfo(_)).toList.reverse
}
I wrote the following tests, note the comments next to the cases. The 00000
I encountered when pushing a lot of commits to my stale test GB installation. I don't know what that means and whether this must be supported.
test("getCommitLogFast returns correct commits") {
withTestRepository { git =>
val c1 = createFile(git, Constants.HEAD, "README.md", "body1", message = "commit1")
val c2 = createFile(git, Constants.HEAD, "README.md", "body2", message = "commit2")
val c3 = createFile(git, Constants.HEAD, "README.md", "body3", message = "commit3")
for (
(from, to, msg) <- List(
(c1.name, c3.name, "1-3"), // OK
(c2.name, c3.name, "2-3"), // OK
(c1.name, c2.name, "1-2"), // OK
(c3.name, c1.name, "3-1"), // FAIL: fast: NIL, old: 1 commit
("000000000000000", c3.name, "000000-3") // FAIL: fast: NPE b/c of unknown commit
)
) {
val fast = JGitUtil.getCommitLogFast(git, from, to)
val old = JGitUtil.getCommitLog(git, from, to)
assert(fast == old, msg)
}
}
}
Overall, I don't know if it's worth changing to this method.
from gitbucket.
I have a PR with a new implementation of getCommits
that works for rebases (it calculates a merge-base/common ancestor).
Problem is, sometimes (e.g. new repo), I get commit names 000000000...0
, and those can't be resolved. Where are those coming from? What's the correct behavior there? Are those names generated by GB?
from gitbucket.
Related Issues (20)
- Gitbucket Issue
- [API] File upload does not work properly
- manisat
- Merge pull request creates java.lang.NullPointerException HOT 3
- Various problems encountered after a 4.6 -> 4.39 upgrade. HOT 5
- pull requests / issues - long web loading time HOT 2
- about LFS HOT 1
- gitbucket 4.40 search doesn't work HOT 7
- GitBucket API Insufficient for Dependabot Script HOT 2
- Make line-limit used in showing diff customizable. HOT 2
- "Add labels to an issue" API doesn't work on v4.39.0 HOT 2
- Performance problems with requests to `/api/v3/repos/:owner/:repository/branches`
- Not run with Postgresql 16 HOT 6
- Pull request comments in code disappear after pushing changed commit (force push)
- Unable to create group in gitbucket with springboot api methods HOT 3
- When opening profile page of root user, getting repository not found exception HOT 1
- Error after cloning the repository HOT 10
- Unable to create multiple files in a folder using api. HOT 1
- Failed to bind station on startup HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gitbucket.