diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-03-12 21:04:12 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-03-13 08:18:32 -0700 |
commit | 13e2210d75bb29a78fa1d08c79b5930a7fbaa3e4 (patch) | |
tree | 495c50ebecb6a7721b08018e89317ef5113553fd /load-git.c | |
parent | 7a999a875e0a2f237c4a85c8c8e4c45ba6009846 (diff) | |
download | subsurface-13e2210d75bb29a78fa1d08c79b5930a7fbaa3e4.tar.gz |
Allow remote branch names when reading a git object tree
This is the quick hack to read from a remote branch, which allows you to
look at other peoples branches when sharing a git tree.
Note that the "remote" part of "remote branch" is the _git_ meaning of a
remote branch: it is the local cached copy from a remote. This does not
imply any kind of network traffic - but if you have done a "git fetch"
to get branches from some other source, you can now use the remote
branch-name to see them in subsurface.
Also notice that you should *NOT* save the end result. It will "work",
but it won't do what you think it does. Saving does not update the
remote branch, it would create a new *local* branch with that same
branch-name, and since it's a new branch, it would do so with no
parenthood information. So you'll be very very confused.
I think I'll add code to remember the parent when loading from a git
repository, and then use that remembered information when saving. So
then you could create a real local branch with real history. But that's
an independent issue from this loading case.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'load-git.c')
-rw-r--r-- | load-git.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/load-git.c b/load-git.c index 5d55245db..c268cf1ef 100644 --- a/load-git.c +++ b/load-git.c @@ -1205,8 +1205,11 @@ static int do_git_load(git_repository *repo, const char *branch) git_object *tree; ret = git_branch_lookup(&ref, repo, branch, GIT_BRANCH_LOCAL); - if (ret) - return report_error("Unable to look up branch '%s'", branch); + if (ret) { + ret = git_branch_lookup(&ref, repo, branch, GIT_BRANCH_REMOTE); + if (ret) + return report_error("Unable to look up branch '%s'", branch); + } if (git_reference_peel(&tree, ref, GIT_OBJ_TREE)) return report_error("Could not look up tree of branch '%s'", branch); ret = load_dives_from_tree(repo, (git_tree *) tree); |