Class Grit::Index
In: lib/grit/index.rb
Parent: Object

Methods

add   commit   delete   new   read_tree   write_blob   write_tree  

Attributes

current_tree  [RW]  Public: Gets/Sets the Grit::Tree object representing the tree upon which the next commit will be based.
last_commit_size  [R] 
last_tree_size  [R]  Public: if a tree or commit is written, this stores the size of that object
repo  [RW]  Public: Gets/Sets the Grit::Repo to which this index belongs.
tree  [RW]  Public: Gets/Sets the Hash tree map that holds the changes to be made in the next commit.

Public Class methods

Initialize a new Index object.

repo - The Grit::Repo to which the index belongs.

Returns the newly initialized Grit::Index.

Public Instance methods

Public: Add a file to the index.

path - The String file path including filename (no slash prefix). data - The String binary contents of the file.

Returns nothing.

Public: Commit the contents of the index. This method supports two formats for arguments:

message - The String commit message. options - An optional Hash of index options.

          :parents        - Array of String commit SHA1s or Grit::Commit
                            objects to attach this commit to to form a
                            new head (default: nil).
          :actor          - The Grit::Actor details of the user making
                            the commit (default: nil).
          :last_tree      - The String SHA1 of a tree to compare with
                            in order to avoid making empty commits
                            (default: nil).
          :head           - The String branch name to write this head to
                            (default: nil).
          :committed_date - The Time that the commit was made.
                            (Default: Time.now)
          :authored_date  - The Time that the commit was authored.
                            (Default: committed_date)

The legacy argument style looks like:

message - The String commit message. parents - Array of String commit SHA1s or Grit::Commit objects to

            attach this commit to to form a new head (default: nil).

actor - The Grit::Actor details of the user making the commit

            (default: nil).

last_tree - The String SHA1 of a tree to compare with in order to avoid

            making empty commits (default: nil).

head - The String branch name to write this head to

            (default: "master").

Returns a String of the SHA1 of the new commit.

Public: Delete the given file from the index.

path - The String file path including filename (no slash prefix).

Returns nothing.

Public: Read the contents of the given Tree into the index to use as a starting point for the index.

tree - The String branch/tag/sha of the Git tree object.

Returns nothing.

Write a blob to the index.

data - The String data to write.

Returns the String SHA1 of the new blob.

Recursively write a tree to the index.

tree - The Hash tree map:

           key - The String directory or filename.
           val - The Hash submap or the String contents of the file.

now_tree - The Grit::Tree representing the a previous tree upon which

           this tree will be based (default: nil).

Returns the String SHA1 String of the tree.

[Validate]