mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-10 08:21:21 +00:00
Recording parent GHRepository
This commit is contained in:
@@ -800,7 +800,7 @@ public class GHRepository extends GHObject {
|
||||
*/
|
||||
public GHTree getTree(String sha) throws IOException {
|
||||
String url = String.format("/repos/%s/%s/git/trees/%s", getOwnerName(), name, sha);
|
||||
return root.retrieve().to(url, GHTree.class).wrap(root);
|
||||
return root.retrieve().to(url, GHTree.class).wrap(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -815,7 +815,7 @@ public class GHRepository extends GHObject {
|
||||
*/
|
||||
public GHTree getTreeRecursive(String sha, int recursive) throws IOException {
|
||||
String url = String.format("/repos/%s/%s/git/trees/%s?recursive=%d", getOwnerName(), name, sha, recursive);
|
||||
return root.retrieve().to(url, GHTree.class).wrap(root);
|
||||
return root.retrieve().to(url, GHTree.class).wrap(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
* @see GHRepository#getTree(String)
|
||||
*/
|
||||
public class GHTree {
|
||||
/* package almost final */GitHub root;
|
||||
/* package almost final */GHRepository repo;
|
||||
|
||||
private boolean truncated;
|
||||
private String sha, url;
|
||||
@@ -50,8 +50,11 @@ public class GHTree {
|
||||
return GitHub.parseURL(url);
|
||||
}
|
||||
|
||||
/* package */GHTree wrap(GitHub root) {
|
||||
this.root = root;
|
||||
/* package */GHTree wrap(GHRepository repo) {
|
||||
this.repo = repo;
|
||||
for (GHTreeEntry e : tree) {
|
||||
e.tree = this;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.net.URL;
|
||||
* @see GHTree
|
||||
*/
|
||||
public class GHTreeEntry {
|
||||
/* package almost final */GHTree tree;
|
||||
|
||||
private String path, mode, type, sha, url;
|
||||
private long size;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user