1 /*******************************************************************************
2 * Copyright (C) 2010, Jens Baumgart <jens.baumgart@sap.com>
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *******************************************************************************/
9 package org
.eclipse
.egit
.core
.internal
;
13 import org
.eclipse
.jgit
.lib
.ObjectId
;
14 import org
.eclipse
.jgit
.lib
.Repository
;
24 * @return display name of the repository
26 public static String
getRepositoryName(Repository repository
) {
27 String repositoryName
;
28 File gitDir
= repository
.getDirectory();
30 repositoryName
= repository
.getDirectory().getParentFile()
33 repositoryName
= ""; //$NON-NLS-1$
34 return repositoryName
;
39 * @return a shortened ObjectId (first 6 digits)
41 public static String
getShortObjectId(ObjectId id
) {
42 return id
.getName().substring(0, 6);