Git.Core.ObjectStore.Checkin C# (CSharp) Method

Checkin() public method

Checkin a single object by using its path
public Checkin ( string path ) : void
path string /// A ///
return void
        public void Checkin(string path)
        {
            if (!File.Exists (path)) {
                Console.WriteLine ("File {0} doesn't exist", path);
                return;
            }

            // Its a tree
            if (Directory.Exists (path)) {
                throw new NotImplementedException ("This is not implemented yet");
                return;
            }

            // its a blob
            FileStream fs = File.Open (path, FileMode.Open, FileAccess.Read);
            byte[] content = new byte[(int) fs.Length];

            fs.Read (content, 0, (int) content.Length);
            fs.Close ();

            Blob blob = new Blob (content);

            AddToQueue (blob);
        }

Usage Example

Example #1
0
        public static void CheckinObject(string filePath, string storePath)
        {
            ObjectStore store = new ObjectStore (storePath);
            store.Checkin (filePath);

            store.Write ();
        }