jgit

JGit retrieve branch on which a commitID was made

岁酱吖の 提交于 2020-01-05 04:37:12
问题 When I checkout from a commitID, git goes into a NO_BRANCH detached state. So the JGit APi which I use to get the branch name is returning the commit. So I need to a way, in JGit API, to find the branch on which this commit was made. 回答1: Using the detached-branch mode (i.e. checking out from a commit) is really not recommended: http://sitaramc.github.com/concepts/detached-head.html First of all, I do not know how you get the commit SHA. Usually you find a commit by scanning a branch (using

JGit S3 support for Standard-US buckets only?

我们两清 提交于 2020-01-05 02:46:09
问题 Is it possbile to use other locations besides US-standard for S3 buckets with JGit (ie. through the config file etc.) or am I doing something wrong here? If I try to use a S3 bucket with JGit that is located in EU, jgit throws an error -> jgit push origin master Counting objects: 3 Finding sources: 100% (3/3) Getting sizes: 100% (2/2) Compressing objects: 100% (1/1) Writing objects: 100% (3/3) java.lang.NullPointerException at org.eclipse.jgit.transport.AmazonS3.error(AmazonS3.java:518) at

JGit bare commit / tree construction

◇◆丶佛笑我妖孽 提交于 2020-01-03 17:03:39
问题 I'm trying to commit a single blob directly to a repository using jgit. I know how to insert the blob and get its sha1, however I'm having difficulties constructing a tree for this scenario. I can't seem to figure out how to correctly use jgit's tree abstractions (TreeWalk and the like) to recursively construct a tree, almost identical to the previous commits', with only different parent trees of the blob. What is the idiomatic way to do this in JGit? The reason I ask, is because I'm writing

what is the meaning of setStartPoint in jgit when you move branch?

一曲冷凌霜 提交于 2020-01-02 14:30:50
问题 I created two branches with start point to origin/master does it have any meaning when i checkout the branches ( move between the branches ) with parameter of start Point ? What happened if I move or not moved the parameter startPoint when I checkout branches? 回答1: You can see setStartPoint used for createBranch (also in this example) Ref ref = git.branchCreate().setName("testbranch").setStartPoint("origin/testbranch").call(); You can also set a startpoint on a checkout command, when you want

jgit how can i get all the commits that occurred between two dates

久未见 提交于 2020-01-02 07:02:22
问题 Or just all the commits that occurred between two dates? In SVN, you could do something like svn diff -r{date}:{date} to do it! 回答1: You can take example of this JGit test class RevWalkFilterTest.java: Date since = getClock(); Date until = getClock(); RevFilter between = CommitTimeRevFilter.between(since, until); It uses the class org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter. 来源: https://stackoverflow.com/questions/19580762/jgit-how-can-i-get-all-the-commits-that-occurred-between-two

jgit how can i get all the commits that occurred between two dates

大兔子大兔子 提交于 2020-01-02 07:02:10
问题 Or just all the commits that occurred between two dates? In SVN, you could do something like svn diff -r{date}:{date} to do it! 回答1: You can take example of this JGit test class RevWalkFilterTest.java: Date since = getClock(); Date until = getClock(); RevFilter between = CommitTimeRevFilter.between(since, until); It uses the class org.eclipse.jgit.revwalk.filter.CommitTimeRevFilter. 来源: https://stackoverflow.com/questions/19580762/jgit-how-can-i-get-all-the-commits-that-occurred-between-two

Retrieving Commit Message Log from Git Using JGit

不羁的心 提交于 2020-01-02 06:07:24
问题 I just want to retrieve the commitlog from Git repository that has messages for all the commit you've done on a specific repopsitory. I had found some code snippets for achieve this and ends with an exception. try { FileRepositoryBuilder builder = new FileRepositoryBuilder(); Repository repo = builder.setGitDir(new File("https://github.com/name/repository.git")).readEnvironment().findGitDir().build(); RevWalk walk =new RevWalk(repo); ObjectId head = repo.resolve(Constants.HEAD); RevCommit

JGit: Checkout a remote branch

我只是一个虾纸丫 提交于 2019-12-29 05:43:35
问题 I'm using JGit to checkout a remote tracking branch. Git binrepository = cloneCmd.call() CheckoutCommand checkoutCmd = binrepository.checkout(); checkoutCmd.setName( "origin/" + branchName); checkoutCmd.setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.TRACK ); checkoutCmd.setStartPoint( "origin/" + branchName ); Ref ref = checkoutCmd.call(); The files are checked out, but the HEAD is not pointing to the branch. Following is the git status output, $ git status # Not currently on any

Turn SSL verification off for JGit clone command

耗尽温柔 提交于 2019-12-28 06:33:43
问题 I am trying to a clone of a Git Repository via the CloneCommand . With this piece of code `Git.cloneRepository().setDirectory(new File(path)).setURI(url).call();` The remote repository is on a GitBlit Instance which uses self signed certificates. Because of these self signed certificates I get the below exception when the Fetch Part of the Clone is executing: Caused by: java.security.cert.CertificateException: No name matching <hostName> found at sun.security.util.HostnameChecker.matchDNS

JGit: How to use InMemoryRepository to learn about dfs implementations

跟風遠走 提交于 2019-12-24 12:44:11
问题 I want to learn how to implement an alternative dfs backend for jgit and am looking at https://github.com/eclipse/jgit/blob/master/org.eclipse.jgit/src/org/eclipse/jgit/storage/dfs/InMemoryRepository.java as an example. How ever I am having a hard time figuring out how to set this up as a standalone git daemon. Basically I want to be able to start a java process that is the git server for a single (empty) in-memory git repository, and then I want to be able to use a git client to push/pull