Skip to content
Browse files

add more todos and implement Index.Head

  • Loading branch information...
1 parent 3d70617 commit 17dc25913a34ef19b741a99850ac513e74b45f7c @hbons committed Aug 3, 2011
Showing with 21 additions and 5 deletions.
  1. +16 −4 Index.cs
  2. +5 −1 Objects.cs
View
20 Index.cs
@@ -31,13 +31,19 @@ public class Index {
public readonly string CheckoutPath;
- public Commit Current {
+ public Commit Head {
get {
- return null;
+ string head_file_path = Path.Combine (DatabasePath, "HEAD");
+ string hash = File.ReadAllText (head_file_path).Trim ();
+
+ return new Commit (hash);
}
set {
+ Commit head_commit = value;
+ string head_file_path = Path.Combine (DatabasePath, "HEAD");
+ File.WriteAllText (head_file_path, head_commit.Hash);
}
}
@@ -117,12 +123,18 @@ public void PullAndRebase ()
}
- public void CollectGarbage ()
+ public void CollectGarbage (int days)
{
// TODO: Remove all objects that are not in the current HEAD and are older than a week
}
+ public static bool Clone (string url, string target_database_path)
+ {
+ return false;
+ }
+
+
public static Index Init (string path)
{
if (!Directory.Exists (path))
@@ -138,7 +150,7 @@ public static Index Init (string path)
}
- // TODO: integrate into Index
+ // TODO: integrate into Objects
public class Blobs {
public readonly string OutputDirectory;
View
6 Objects.cs
@@ -65,7 +65,6 @@ protected void WriteHashObject (string hash, string lines)
public class Commit : HashObject {
public string ParentHash;
-
public string UserName;
public string UserEmail;
public DateTime Timestamp;
@@ -171,6 +170,11 @@ public Chunk (string hash) : base (hash)
get {
return ReadHashObject (Hash);
}
+
+ set {
+ // Saving chunks is done by the Chunker,
+ // so we don't need to implement it
+ }
}
}
}

0 comments on commit 17dc259

Please sign in to comment.
Something went wrong with that request. Please try again.