]> source.dussan.org Git - jgit.git/commitdiff
Ignore invalid TagOpt values 47/103447/4
authorThomas Wolf <thomas.wolf@paranor.ch>
Tue, 22 Aug 2017 11:23:10 +0000 (13:23 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Sat, 26 Aug 2017 07:11:03 +0000 (09:11 +0200)
C git silently ignores invalid tagopt values; so make JGit behave the
same way.

Bug: 429625
Change-Id: I99587cc46c7e0c19348bcc63f602038fa9a7f378
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
org.eclipse.jgit/src/org/eclipse/jgit/transport/RemoteConfig.java

index 5449cf15b3ea6932b1e8f6760d1d1887b2ea8bad..c968ba37cf8f038c383580ef735f557d0b0c7363 100644 (file)
@@ -206,8 +206,13 @@ public class RemoteConfig implements Serializable {
                }
                receivepack = val;
 
-               val = rc.getString(SECTION, name, KEY_TAGOPT);
-               tagopt = TagOpt.fromOption(val);
+               try {
+                       val = rc.getString(SECTION, name, KEY_TAGOPT);
+                       tagopt = TagOpt.fromOption(val);
+               } catch (IllegalArgumentException e) {
+                       // C git silently ignores invalid tagopt values.
+                       tagopt = TagOpt.AUTO_FOLLOW;
+               }
                mirror = rc.getBoolean(SECTION, name, KEY_MIRROR, DEFAULT_MIRROR);
                timeout = rc.getInt(SECTION, name, KEY_TIMEOUT, 0);
        }