aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/lib
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2012-06-04 11:08:12 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2012-06-04 11:08:12 -0400
commite83d096ec6fea97b9bee1155654238073f6d1571 (patch)
tree4f443d608f2fd95f43026954c79c0d60536ce0d7 /org.eclipse.jgit/src/org/eclipse/jgit/lib
parente3bb6ae3fd559234fd7644b828e7b87e55e8522f (diff)
parent0f84b86e01da4680633c32bad101d021e0cb98ad (diff)
downloadjgit-e83d096ec6fea97b9bee1155654238073f6d1571.tar.gz
jgit-e83d096ec6fea97b9bee1155654238073f6d1571.zip
Merge "fix PackWriter excluded objects handling"
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/lib')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java37
1 files changed, 35 insertions, 2 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
index c70c9b0f85..7b9d453aa2 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/Repository.java
@@ -871,7 +871,7 @@ public abstract class Repository {
*/
public DirCache readDirCache() throws NoWorkTreeException,
CorruptObjectException, IOException {
- return DirCache.read(getIndexFile(), getFS());
+ return DirCache.read(this);
}
/**
@@ -903,7 +903,7 @@ public abstract class Repository {
notifyIndexChanged();
}
};
- return DirCache.lock(getIndexFile(), getFS(), l);
+ return DirCache.lock(this, l);
}
static byte[] gitInternalSlash(byte[] bytes) {
@@ -1248,6 +1248,39 @@ public abstract class Repository {
}
/**
+ * Write original HEAD commit into $GIT_DIR/ORIG_HEAD.
+ *
+ * @param head
+ * an object id of the original HEAD commit or <code>null</code>
+ * to delete the file
+ * @throws IOException
+ */
+ public void writeOrigHead(ObjectId head) throws IOException {
+ List<ObjectId> heads = head != null ? Collections.singletonList(head)
+ : null;
+ writeHeadsFile(heads, Constants.ORIG_HEAD);
+ }
+
+ /**
+ * Return the information stored in the file $GIT_DIR/ORIG_HEAD.
+ *
+ * @return object id from ORIG_HEAD file or {@code null} if this file
+ * doesn't exist. Also if the file exists but is empty {@code null}
+ * will be returned
+ * @throws IOException
+ * @throws NoWorkTreeException
+ * if this is bare, which implies it has no working directory.
+ * See {@link #isBare()}.
+ */
+ public ObjectId readOrigHead() throws IOException, NoWorkTreeException {
+ if (isBare() || getDirectory() == null)
+ throw new NoWorkTreeException();
+
+ byte[] raw = readGitDirectoryFile(Constants.ORIG_HEAD);
+ return raw != null ? ObjectId.fromString(raw, 0) : null;
+ }
+
+ /**
* Read a file from the git directory.
*
* @param filename