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
.storage
;
11 import org
.eclipse
.core
.runtime
.IPath
;
12 import org
.eclipse
.core
.runtime
.Path
;
13 import org
.eclipse
.egit
.core
.internal
.Utils
;
14 import org
.eclipse
.jgit
.lib
.ObjectId
;
15 import org
.eclipse
.jgit
.lib
.Repository
;
16 import org
.eclipse
.jgit
.revwalk
.RevCommit
;
19 * Blob Storage related to a RevCommit. Method <code>getFullPath</code> returns
20 * a path of format <repository name>/<file path> <commit id> This results in a
21 * useful tool tip on the editor title when viewing a revision and avoids the
22 * issue that editors get dirty because Eclipse seems to share the document of
23 * the workspace file if the remote file has the same full path.
25 public class CommitBlobStorage
extends BlobStorage
{
27 private final RevCommit commit
;
29 CommitBlobStorage(final Repository repository
, final String fileName
,
30 final ObjectId blob
, RevCommit commit
) {
31 super(repository
, fileName
, blob
);
36 public IPath
getFullPath() {
37 IPath repoPath
= new Path(Utils
.getRepositoryName(db
));
38 String pathString
= super.getFullPath().toPortableString() + " " //$NON-NLS-1$
39 + Utils
.getShortObjectId(commit
.getId());
40 return repoPath
.append(Path
.fromPortableString(pathString
));