Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] InMemoryRepository and HEAD reference

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.


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);
} •                                 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())) {

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.


Back to the top