projects
/
gitlive
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
GitRepo.vala
[gitlive]
/
GitBranch.vala
diff --git
a/GitBranch.vala
b/GitBranch.vala
index
20e36fd
..
c08721b
100644
(file)
--- a/
GitBranch.vala
+++ b/
GitBranch.vala
@@
-90,9
+90,15
@@
public class GitBranch : Object
var r = repo.repo.enumerate_branches(Ggit.BranchType.LOCAL);
while (r.next()) {
var r = repo.repo.enumerate_branches(Ggit.BranchType.LOCAL);
while (r.next()) {
+
+
+
var br = new GitBranch(repo);
var gbr = r.get() as Ggit.Branch;
var br = new GitBranch(repo);
var gbr = r.get() as Ggit.Branch;
-
+ if (!gbr.is_branch()) {
+ continue;
+ }
+
br.active = gbr.is_head();
br.name = gbr.get_name();
br.lastrev = gbr.get_target().to_string();
br.active = gbr.is_head();
br.name = gbr.get_name();
br.lastrev = gbr.get_target().to_string();
@@
-111,15
+117,22
@@
public class GitBranch : Object
br.remoterev = remotes.get(rname).to_string();
remotes_used.set(rname,true);
size_t ahead, behind;
br.remoterev = remotes.get(rname).to_string();
remotes_used.set(rname,true);
size_t ahead, behind;
- repo.repo.get_ahead_behind(
- gbr.get_target(),
- remotes.get(rname),
- out ahead,
- out behind
- );
- br.ahead = (int)ahead;
- br.behind = (int) behind;
+ br.behind = 1;
+
+ try {
+ repo.repo.get_ahead_behind(
+ gbr.get_target(),
+ remotes.get(rname),
+ out ahead,
+ out behind
+ );
+ br.ahead = (int)ahead;
+ br.behind = (int) behind;
+ } catch(Error e) {
+ GLib.debug("we probably need to fetch... %s", repo.name);
+ }
+
}
}
@@
-128,7
+141,7
@@
public class GitBranch : Object
}
if (br.active) {
GLib.debug("repo: %s currentBranch = %s", repo.name, br.name);
}
if (br.active) {
GLib.debug("repo: %s currentBranch = %s", repo.name, br.name);
- repo.currentBranch = br;
+ repo.
_
currentBranch = br;
}
}
}
}
@@
-138,8
+151,16
@@
public class GitBranch : Object
if (remotes_used.get(rn)) {
continue;
}
if (remotes_used.get(rn)) {
continue;
}
+ if (repo.branches.has_key(rn)) {
+ GLib.debug("skip tracking branch - same name exists?");
+ continue;
+ }
// not clear how to do this yet...
// not clear how to do this yet...
- repo.git( { "branch" ,"--track" , rn, "origin/" + rn} );
+ try {
+ repo.git( { "branch" ,"--track" , rn, "origin/" + rn} );
+ } catch (Error e) {
+ continue; // allow failure?
+ }
var br = new GitBranch(repo);
br.name = rn;
br.lastrev = ""; // it's behind
var br = new GitBranch(repo);
br.name = rn;
br.lastrev = ""; // it's behind
@@
-151,7
+172,8
@@
public class GitBranch : Object
repo.branches.set(rn, br);
}
repo.branches.set(rn, br);
}
- if (repo.currentBranch == null) {
+
+ if (repo._currentBranch == null) {
GLib.error("could not find active Branch for %s", repo.name);
}
GLib.error("could not find active Branch for %s", repo.name);
}