On 18 Mar 2013, at 23:02, Alex Blewitt wrote: On 18 Mar 2013, at 22:33, Shawn Pearce wrote: This also has to be in the ids RefList. That is the contract you broke.
Thanks, I'll try that out and verify it works when that happens.
Alex
This worked:
• protected RefCache scanAllRefs() throws IOException { • RefList.Builder<Ref> ids = new RefList.Builder<Ref>(); • RefList.Builder<Ref> sym = new RefList.Builder<Ref>(); • for (Ref ref : refs.values()) { if(ref.getName().equals("refs/heads/master")) { SymbolicRef HEAD = new SymbolicRef("HEAD",ref); sym.add(HEAD); ids.add(HEAD); } • if (ref.isSymbolic()) • sym.add(ref); • ids.add(ref); • } • ids.sort(); • sym.sort(); • return new RefCache(ids.toRefList(), sym.toRefList()); • }
Would it be worth storing the 'default branch' in a config property of the project? That way, the code could be more generic and be part of the InMemory example of DFS. Say, something like:
branch_default = cfg.getString("dfs",null,"branch.default"); if(branch_default != null && branch_default.equals(ref.getName())) { sym.add(HEAD); ids.add(HEAD); }
Should this be part of the DFS implementation anyway, or should it be handled higher up?
If the above seems like a good idea I'll submit a patch.
Alex |