org.eclipse.jgit.lib
Class GitIndex

java.lang.Object
  extended by org.eclipse.jgit.lib.GitIndex

Deprecated. Use DirCache instead.

public class GitIndex
extends Object

A representation of the Git index. The index points to the objects currently checked out or in the process of being prepared for committing or objects involved in an unfinished merge. The abstract format is:
path stage flags statdata SHA-1

An index can also contain a tree cache which we ignore for now. We drop the tree cache when writing the index.


Nested Class Summary
 class GitIndex.Entry
          Deprecated. Use DirCacheEntry.
 
Field Summary
static int STAGE_0
          Deprecated. Stage 0 represents merged entries.
 
Constructor Summary
GitIndex(Repository db)
          Deprecated. Construct a Git index representation.
 
Method Summary
 GitIndex.Entry add(File wd, File f)
          Deprecated. Add the content of a file to the index.
 GitIndex.Entry add(File wd, File f, byte[] content)
          Deprecated. Add the content of a file to the index.
 GitIndex.Entry addEntry(TreeEntry te)
          Deprecated. Add tree entry to index
 void checkout(File wd)
          Deprecated. Check out content of the content represented by the index
 void checkoutEntry(File wd, GitIndex.Entry e)
          Deprecated. Check out content of the specified index entry
 GitIndex.Entry getEntry(String path)
          Deprecated. Look up an entry with the specified path.
 GitIndex.Entry[] getMembers()
          Deprecated. Return the members of the index sorted by the unsigned byte values of the path names.
 Repository getRepository()
          Deprecated.  
 boolean isChanged()
          Deprecated.  
 void read()
          Deprecated. Read the cache file into memory.
 void readTree(Tree t)
          Deprecated. Read a Tree recursively into the index
 boolean remove(File wd, File f)
          Deprecated. Remove a path from the index.
 void rereadIfNecessary()
          Deprecated. Reread index data from disk if the index file has been changed
 void write()
          Deprecated. Write content of index to disk.
 ObjectId writeTree()
          Deprecated. Construct and write tree out of index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STAGE_0

public static final int STAGE_0
Deprecated. 
Stage 0 represents merged entries.

See Also:
Constant Field Values
Constructor Detail

GitIndex

public GitIndex(Repository db)
Deprecated. 
Construct a Git index representation.

Parameters:
db -
Method Detail

isChanged

public boolean isChanged()
Deprecated. 
Returns:
true if we have modified the index in memory since reading it from disk

rereadIfNecessary

public void rereadIfNecessary()
                       throws IOException
Deprecated. 
Reread index data from disk if the index file has been changed

Throws:
IOException

add

public GitIndex.Entry add(File wd,
                          File f)
                   throws IOException
Deprecated. 
Add the content of a file to the index.

Parameters:
wd - workdir
f - the file
Returns:
a new or updated index entry for the path represented by f
Throws:
IOException

add

public GitIndex.Entry add(File wd,
                          File f,
                          byte[] content)
                   throws IOException
Deprecated. 
Add the content of a file to the index.

Parameters:
wd - workdir
f - the file
content - content of the file
Returns:
a new or updated index entry for the path represented by f
Throws:
IOException

remove

public boolean remove(File wd,
                      File f)
               throws IOException
Deprecated. 
Remove a path from the index.

Parameters:
wd - workdir
f - the file whose path shall be removed.
Returns:
true if such a path was found (and thus removed)
Throws:
IOException

read

public void read()
          throws IOException
Deprecated. 
Read the cache file into memory.

Throws:
IOException

write

public void write()
           throws IOException
Deprecated. 
Write content of index to disk.

Throws:
IOException

readTree

public void readTree(Tree t)
              throws IOException
Deprecated. 
Read a Tree recursively into the index

Parameters:
t - The tree to read
Throws:
IOException

addEntry

public GitIndex.Entry addEntry(TreeEntry te)
                        throws IOException
Deprecated. 
Add tree entry to index

Parameters:
te - tree entry
Returns:
new or modified index entry
Throws:
IOException

checkout

public void checkout(File wd)
              throws IOException
Deprecated. 
Check out content of the content represented by the index

Parameters:
wd - workdir
Throws:
IOException

checkoutEntry

public void checkoutEntry(File wd,
                          GitIndex.Entry e)
                   throws IOException
Deprecated. 
Check out content of the specified index entry

Parameters:
wd - workdir
e - index entry
Throws:
IOException

writeTree

public ObjectId writeTree()
                   throws IOException
Deprecated. 
Construct and write tree out of index.

Returns:
SHA-1 of the constructed tree
Throws:
IOException

getMembers

public GitIndex.Entry[] getMembers()
Deprecated. 
Return the members of the index sorted by the unsigned byte values of the path names. Small beware: Unaccounted for are unmerged entries. You may want to abort if members with stage != 0 are found if you are doing any updating operations. All stages will be found after one another here later. Currently only one stage per name is returned.

Returns:
The index entries sorted

getEntry

public GitIndex.Entry getEntry(String path)
                        throws UnsupportedEncodingException
Deprecated. 
Look up an entry with the specified path.

Parameters:
path -
Returns:
index entry for the path or null if not in index.
Throws:
UnsupportedEncodingException

getRepository

public Repository getRepository()
Deprecated. 
Returns:
The repository holding this index.


Copyright © 2011. All Rights Reserved.