Here you can find the source of normalizeGitRepoLocation(URI location)
public static URI normalizeGitRepoLocation(URI location)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 IBM Corporation and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * /*from ww w. ja v a 2 s .c o m*/ * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ import java.net.URI; import java.net.URISyntaxException; public class Main { /** * Normalizes a git repository location so that it never ends with ".git". */ public static URI normalizeGitRepoLocation(URI location) { final String locationString = location.toString(); if (locationString.endsWith("/")) { //$NON-NLS-1$ try { return new URI(locationString.substring(0, locationString.lastIndexOf("/"))); //$NON-NLS-1$ } catch (URISyntaxException e) { //keep original location } } if (locationString.endsWith(".git")) { //$NON-NLS-1$ try { return new URI(locationString.substring(0, locationString.lastIndexOf(".git"))); //$NON-NLS-1$ } catch (URISyntaxException e) { //keep original location } } return location; } }