]> source.dussan.org Git - jgit.git/commitdiff
Fixed ordering of Config.getSubsections(...) 79/2679/1
authorJesse Greenwald <jesse.greenwald@garmin.com>
Wed, 9 Mar 2011 17:48:52 +0000 (09:48 -0800)
committerJesse Greenwald <jesse.greenwald@garmin.com>
Wed, 9 Mar 2011 18:00:24 +0000 (10:00 -0800)
A standard HashSet was being used to store the list of subsections as
they were being parsed.  This was changed to use a LinkedHashSet so
that iterating over the set would return values in the same order as
they are listed in the config file.

Change-Id: I4251f95b8fe0ad59b07ff563c9ebb468f996c37d

org.eclipse.jgit/src/org/eclipse/jgit/lib/Config.java

index ce86dc20f90a7186635b3013f5eb86a58f29d448..77ab150c6d423c7878e1c8ce7ab194e09776a6d0 100644 (file)
@@ -55,9 +55,9 @@ import java.text.MessageFormat;
 import java.util.AbstractSet;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -1277,7 +1277,7 @@ public class Config {
                }
 
                public Set<String> parse(Config cfg) {
-                       final Set<String> result = new HashSet<String>();
+                       final Set<String> result = new LinkedHashSet<String>();
                        while (cfg != null) {
                                for (final Entry e : cfg.state.get().entryList) {
                                        if (e.subsection != null && e.name == null