GitSharp.Core Format an as a Git style unified patch script. Create a new formatter with a default level of context. Change the number of lines of context to display. Number of lines of context to see before the first modification and After the last modification within a hunk of the modified file. Format a patch script, reusing a previously parsed FileHeader. This formatter is primarily useful for editing an existing patch script to increase or reduce the number of lines of context within the script. All header lines are reused as-is from the supplied FileHeader. stream to write the patch script out to. existing file header containing the header lines to copy. Text source for the pre-image version of the content. This must match the content of . writing to the supplied stream failed. Formats a list of edits in unified diff format where the unified diff is written to the text A which was compared the text B which was compared some differences which have been calculated between A and B A modified region detected between two versions of roughly the same content. Regions should be specified using 0 based notation, so add 1 to the start and end marks for line numbers in a file. An edit where beginA == endA && beginB > endB is an insert edit, that is sequence B inserted the elements in region [beginB, endB) at beginA. An edit where beginA > endA && beginB > endB is a replace edit, that is sequence B has replaced the range of elements between [beginA, endA) with those found in [beginB, endB). Create a new empty edit. beginA: start and end of region in sequence A; 0 based. beginB: start and end of region in sequence B; 0 based. Create a new empty edit. beginA: start and end of region in sequence A; 0 based. endA: end of region in sequence A; must be >= as. beginB: start and end of region in sequence B; 0 based. endB: end of region in sequence B; must be >= bs. Increase by 1. Increase by 1. Swap A and B, so the edit goes the other direction. Determines whether the specified is equal to the current . true if the specified is equal to the current ; otherwise, false. The to compare with the current . The parameter is null. 2 Gets the type of this region. Start point in sequence A. End point in sequence A. Start point in sequence B. End point in sequence B. Type of edit Sequence B has inserted the region. Sequence B has removed the region. Sequence B has replaced the region with different content. Sequence A and B have zero length, describing nothing. Specialized list of s in a document. Diff algorithm, based on "An O(ND) Difference Algorithm and its Variations", by Eugene Myers. The basic idea is to put the line numbers of text A as columns ("x") and the lines of text B as rows ("y"). Now you try to find the shortest "edit path" from the upper left corner to the lower right corner, where you can always go horizontally or vertically, but diagonally from (x,y) to (x+1,y+1) only if line x in text A is identical to line y in text B. Myers' fundamental concept is the "furthest reaching D-path on diagonal k": a D-path is an edit path starting at the upper left corner and containing exactly D non-diagonal elements ("differences"). The furthest reaching D-path on diagonal k is the one that contains the most (diagonal) elements which ends on diagonal k (where k = y - x). Example: H E L L O W O R L D ____ L \___ O \___ W \________ Since every D-path has exactly D horizontal or vertical elements, it can only end on the diagonals -D, -D+2, ..., D-2, D. Since every furthest reaching D-path contains at least one furthest reaching (D-1)-path (except for D=0), we can construct them recursively. Since we are really interested in the shortest edit path, we can start looking for a 0-path, then a 1-path, and so on, until we find a path that ends in the lower right corner. To save space, we do not need to store all paths (which has quadratic space requirements), but generate the D-paths simultaneously from both sides. When the ends meet, we will have found "the middle" of the path. From the end points of that diagonal part, we can generate the rest recursively. This only requires linear space. The overall (runtime) complexity is O(N * D^2 + 2 * N/2 * (D/2)^2 + 4 * N/4 * (D/4)^2 + ...) = O(N * D^2 * 5 / 4) = O(N * D^2), (With each step, we have to find the middle parts of twice as many regions as before, but the regions (as well as the D) are halved.) So the overall runtime complexity stays the same with linear space, albeit with a larger constant factor. The list of edits found during the last call to The first text to be compared. Referred to as "Text A" in the comments The second text to be compared. Referred to as "Text B" in the comments The only constructor the text A which should be compared the text B which should be compared the list of edits found during the last call to {@link #calculateEdits()} Entrypoint into the algorithm this class is all about. This method triggers that the differences between A and B are calculated in form of a list of edits. Calculates the differences between a given part of A against another given part of B start of the part of A which should be compared (0<=beginA<sizeof(A)) end of the part of A which should be compared (beginA<=endA<sizeof(A)) start of the part of B which should be compared (0<=beginB<sizeof(B)) end of the part of B which should be compared (beginB<=endB<sizeof(B)) A class to help bisecting the sequences a and b to find minimal edit paths. As the arrays are reused for space efficiency, you will need one instance per thread. The entry function is the calculate() method. This function calculates the "middle" Edit of the shortest edit path between the given subsequences of a and b. Once a forward path and a backward path meet, we found the middle part. From the last snake end point on both of them, we construct the Edit. It is assumed that there is at least one edit in the range. A sequence supporting UNIX formatted text in byte[] format. Elements of the sequence are the lines of the file, as delimited by the UNIX newline character ('\n'). The file content is treated as 8 bit binary text, with no assumptions or requirements on character encoding. Note that the first line of the file is element 0, as defined by the Sequence interface API. Traditionally in a text editor a patch file the first line is line number 1. Callers may need to subtract 1 prior to invoking methods if they are converting from "line number" to "element index". Arbitrary sequence of elements with fast comparison support. A sequence of elements is defined to contain elements in the index range [0, ), like a standard Java List implementation. Unlike a List, the members of the sequence are not directly obtainable, but element equality can be tested if two Sequences are the same implementation. An implementation may chose to implement the equals semantic as necessary, including fuzzy matching rules such as ignoring insignificant sub-elements, e.g. ignoring whitespace differences in text. Implementations of Sequence are primarily intended for use in content difference detection algorithms, to produce an of instances describing how two Sequence instances differ. Total number of items in the sequence. Determine if the i-th member is equal to the j-th member. Implementations must ensure equals(thisIdx,other,otherIdx) returns the same as other.equals(otherIdx,this,thisIdx). Index within this sequence; must be in the range [ 0, this.size() ). Another sequence; must be the same implementation class, that is this.getClass() == other.getClass(). Index within other sequence; must be in the range [ 0, other.size() ). true if the elements are equal; false if they are not equal. Create a new sequence from an existing content byte array. The entire array (indexes 0 through length-1) is used as the content. the content array. The array is never modified, so passing through cached arrays is safe. Create a new sequence from a file. The entire file contents are used. the text file. Write a specific line to the output stream, without its trailing LF. The specified line is copied as-is, with no character encoding translation performed. If the specified line ends with an LF ('\n'), the LF is not copied. It is up to the caller to write the LF, if desired, between output lines. Stream to copy the line data onto. Index of the line to extract. Note this is 0-based, so line number 1 is actually index 0. the stream write operation failed. Determine if the file ends with a LF ('\n'). true if the last line has an LF; false otherwise. Compute a hash code for a single line. The raw file content. First byte of the content line to hash. 1 past the last byte of the content line. Hash code for the region [ptr, end) of raw. The content of the raw text as byte array. Represents starting points of lines in Content. Note: the line indices are 1-based and are mapped to 0-based positions in the Content byte array. As line indices are based on 1 the result of line 0 is undefined. Generic update/editing support for . The different update strategies extend this class to provide their own unique services to applications. Entry table this builder will eventually replace into . Use or to make additions to this table. The table is automatically expanded if it is too small for a new addition. Typically the entries in here are sorted by their path names, just like they are in the DirCache instance. Construct a new editor. the cache this editor will eventually update. estimated number of entries the editor will have upon completion. This sizes the initial entry table. The cache we will update on . Append one entry into the resulting entry list. The entry is placed at the end of the entry list. The caller is responsible for making sure the final table is correctly sorted. The table is automatically expanded if there is insufficient space for the new addition. The new entry to add. Add a range of existing entries from the destination cache. The entries are placed at the end of the entry list, preserving their current order. The caller is responsible for making sure the final table is correctly sorted. This method copies from the destination cache, which has not yet been updated with this editor's new table. So all offsets into the destination cache are not affected by any updates that may be currently taking place in this editor. The table is automatically expanded if there is insufficient space for the new additions. First entry to copy from the destination cache. Number of entries to copy. * Finish this builder and update the destination . When this method completes this builder instance is no longer usable by the calling application. A new builder must be created to make additional changes to the index entries. After completion the DirCache returned by will contain all modifications. Note to implementors: Make sure is fully sorted then invoke to update the DirCache with the new table. Update the DirCache with the contents of . This method should be invoked only during an implementation of , and only after is sorted. Finish, write, commit this change, and release the index lock. If this method fails (returns false) the lock is still released. This is a utility method for applications as the finish-write-commit pattern is very common after using a builder to update entries. True if the commit was successful and the file contains the new data; false if the commit failed and the file remains with the old data. The output file could not be created. The caller no longer holds the lock. Support for the Git dircache (aka index file). The index file keeps track of which objects are currently checked out in the working directory, and the last modified time of those working files. Changes in the working directory can be detected by comparing the modification times to the cached modification time within the index file. Index files are also used during merges, where the merge happens within the index file first, and the working directory is updated as a post-merge step. Conflicts are stored in the index file to allow tool (and human) based resolutions to be easily performed. Create a new empty index which is never stored on disk. An empty cache which has no backing store file. The cache may not be read or written, but it may be queried and updated (in memory). Create a new in-core index representation and read an index from disk. The new index will be read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index. Location of the index file on disk. a cache representing the contents of the specified index file (if it exists) or an empty cache if the file does not exist. The index file is present but could not be read. The index file is using a format or extension that this library does not support. Create a new in-core index representation and read an index from disk. The new index will be read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index. repository the caller wants to read the default index of. A cache representing the contents of the specified index file (if it exists) or an empty cache if the file does not exist. The index file is present but could not be read. The index file is using a format or extension that this library does not support. Create a new in-core index representation, lock it, and read from disk. The new index will be locked and then read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index. On read failure, the lock is released. location of the index file on disk. A cache representing the contents of the specified index file (if it exists) or an empty cache if the file does not exist. The index file is present but could not be read, or the lock could not be obtained. the index file is using a format or extension that this library does not support. Create a new in-core index representation, lock it, and read from disk. The new index will be locked and then read before it is returned to the caller. Read failures are reported as exceptions and therefore prevent the method from returning a partially populated index. Repository the caller wants to read the default index of. A cache representing the contents of the specified index file (if it exists) or an empty cache if the file does not exist. The index file is present but could not be read, or the lock could not be obtained. The index file is using a format or extension that this library does not support. Create a new in-core index representation. The new index will be empty. Callers may wish to read from the on disk file first with . location of the index file on disk. Create a new builder to update this cache. Callers should add all entries to the builder, then use to update this instance. A new builder instance for this cache. Create a new editor to recreate this cache. Callers should add commands to the editor, then use to update this instance. A new builder instance for this cache. Read the index from disk, if it has changed on disk. This method tries to avoid loading the index if it has not changed since the last time we consulted it. A missing index file will be treated as though it were present but had no file entries in it. The index file is present but could not be read. This instance may not be populated correctly. The index file is using a format or extension that this library does not support. Empty this index, removing all entries. Try to establish an update lock on the cache file. True if the lock is now held by the caller; false if it is held by someone else. The output file could not be created. The caller does not hold the lock. Write the entry records from memory to disk. The cache must be locked first by calling and receiving true as the return value. Applications are encouraged to lock the index, then invoke to ensure the in-memory data is current, prior to updating the in-memory entries. Once written the lock is closed and must be either committed with or rolled back with . The output file could not be created. The caller no longer holds the lock. Commit this change and release the lock. If this method fails (returns false) the lock is still released. True if the commit was successful and the file contains the new data; false if the commit failed and the file remains with the old data. the lock is not held. Unlock this file and abort this change. The temporary file (if created) is deleted before returning. Locate the position a path's entry is at in the index. If there is at least one entry in the index for this path the position of the lowest stage is returned. Subsequent stages can be identified by testing consecutive entries until the path differs. If no path matches the entry -(position+1) is returned, where position is the location it would have gone within the index. The path to search for. if >= 0 then the return value is the position of the entry in the index; pass to to obtain the entry information. If > 0 the entry does not exist in the index. Determine the next index position past all entries with the same name. As index entries are sorted by path name, then stage number, this method advances the supplied position to the first position in the index whose path name does not match the path name of the supplied position's entry. entry position of the path that should be skipped. Position of the next entry whose path is after the input. Total number of file entries stored in the index. This count includes unmerged stages for a file entry if the file is currently conflicted in a merge. This means the total number of entries in the index may be up to 3 times larger than the number of files in the working directory. Note that this value counts only files. Number of entries available. Get a specific entry. position of the entry to get. The entry at position . Get a specific entry. The path to search for. The entry at position . Recursively get all entries within a subtree. The subtree path to get all entries within. All entries recursively contained within the subtree. Obtain (or build) the current cache tree structure. This method can optionally recreate the cache tree, without flushing the tree objects themselves to disk. If true and the cache tree is not present in the index it will be generated and returned to the caller. The cache tree; null if there is no current cache tree available and was false. Write all index trees to the object store, returning the root tree. The writer to use when serializing to the store. identity for the root tree. One or more paths contain higher-order stages (stage > 0), which cannot be stored in a tree object. One or more paths contain an invalid mode which should never appear in a tree object. An unexpected error occurred writing to the object store. Updates a by adding individual s. A builder always starts from a clean slate and appends in every single which the final updated index must have to reflect its new content. For maximum performance applications should add entries in path name order. Adding entries out of order is permitted, however a final sorting pass will be implicitly performed during to correct any out-of-order entries. Duplicate detection is also delayed until the sorting is complete. Construct a new builder. the cache this builder will eventually update. Estimated number of entries the builder will have upon completion. This sizes the initial entry table. Append one entry into the resulting entry list. The entry is placed at the end of the entry list. If the entry causes the list to now be incorrectly sorted a final sorting phase will be automatically enabled within . The internal entry table is automatically expanded if there is insufficient space for the new addition. the new entry to add. Add a range of existing entries from the destination cache. The entries are placed at the end of the entry list. If any of the entries causes the list to now be incorrectly sorted a final sorting phase will be automatically enabled within . This method copies from the destination cache, which has not yet been updated with this editor's new table. So all offsets into the destination cache are not affected by any updates that may be currently taking place in this editor. The internal entry table is automatically expanded if there is insufficient space for the new additions. First entry to copy from the destination cache. Number of entries to copy. Recursively add an entire tree into this builder. If pathPrefix is "a/b" and the tree contains file "c" then the resulting DirCacheEntry will have the path "a/b/c". All entries are inserted at stage 0, therefore assuming that the application will not insert any other paths with the same pathPrefix. UTF-8 encoded prefix to mount the tree's entries at. If the path does not end with '/' one will be automatically inserted as necessary. Stage of the entries when adding them. Repository the tree(s) will be read from during recursive traversal. This must be the same repository that the resulting would be written out to (or used in) otherwise the caller is simply asking for deferred MissingObjectExceptions. The tree to recursively add. This tree's contents will appear under . The ObjectId must be that of a tree; the caller is responsible for dereferencing a tag or commit (if necessary). A tree cannot be read to iterate through its entries. Iterate and update a as part of a . Like this iterator allows a to be used in parallel with other sorts of iterators in a . However any entry which appears in the source and which is skipped by the is automatically copied into , thus retaining it in the newly updated index. This iterator is suitable for update processes, or even a simple delete algorithm. For example deleting a path: DirCache dirc = DirCache.lock(db); DirCacheBuilder edit = dirc.builder(); TreeWalk walk = new TreeWalk(db); walk.reset(); walk.setRecursive(true); walk.setFilter(PathFilter.Create("name/to/remove")); walk.addTree(new DirCacheBuildIterator(edit)); while (walk.next()) ; // do nothing on a match as we want to remove matches edit.commit(); Iterate a as part of a . This is an iterator to adapt a loaded instance (such as Read from an existing .git/index file) to the tree structure used by a , making it possible for applications to walk over any combination of tree objects already in the object database, index files, or working directories. Walks a Git tree (directory) in Git sort order. A new iterator instance should be positioned on the first entry, or at eof. Data for the first entry (if not at eof) should be available immediately. Implementors must walk a tree in the Git sort order, which has the following odd sorting: A.c A/c A0c In the second item, A is the name of a subtree and c is a file within that subtree. The other two items are files in the root level tree. Default size for the buffer. A dummy buffer that matches the zero . Create a new iterator with no parent. Create a new iterator with no parent and a prefix. The prefix path supplied is inserted in front of all paths generated by this iterator. It is intended to be used when an iterator is being created for a subsection of an overall repository and needs to be combined with other iterators that are created to run over the entire repository namespace. position of this iterator in the repository tree. The value may be null or the empty string to indicate the prefix is the root of the repository. A trailing slash ('/') is automatically appended if the prefix does not end in '/'. Create a new iterator with no parent and a prefix. The prefix path supplied is inserted in front of all paths generated by this iterator. It is intended to be used when an iterator is being created for a subsection of an overall repository and needs to be combined with other iterators that are created to run over the entire repository namespace. position of this iterator in the repository tree. The value may be null or the empty array to indicate the prefix is the root of the repository. A trailing slash ('/') is automatically appended if the prefix does not end in '/'. Create an iterator for a subtree of an existing iterator. parent tree iterator. Create an iterator for a subtree of an existing iterator. The caller is responsible for setting up the path of the child iterator. parent tree iterator. Path array to be used by the child iterator. This path must contain the path from the top of the walk to the first child and must end with a '/'. position within childPath where the child can insert its data. The value at childPath[childPathOffset-1] must be '/'. Grow the _path buffer larger. Number of live bytes in the path buffer. This many bytes will be moved into the larger buffer. Ensure that path is capable to hold at least bytes. the amount of bytes to hold the amount of live bytes in path buffer Set path buffer capacity to the specified size the new size the amount of bytes to copy Compare the path of this current entry to another iterator's entry. The other iterator to compare the path against. return -1 if this entry sorts first; 0 if the entries are equal; 1 if 's entry sorts first. Compare the path of this current entry to another iterator's entry. The other iterator to compare the path against. The other iterator bits. return -1 if this entry sorts first; 0 if the entries are equal; 1 if 's entry sorts first. Check if the current entry of both iterators has the same id. This method is faster than as it does not require copying the bytes out of the buffers. A direct compare operation is performed. the other iterator to test against. true if both iterators have the same object id; false otherwise. Gets the of the current entry. The for the current entry. Gets the of the current entry. buffer to copy the object id into. Get the byte array buffer object IDs must be copied out of. The id buffer contains the bytes necessary to construct an for the current entry of this iterator. The buffer can be the same buffer for all entries, or it can be a unique buffer per-entry. Implementations are encouraged to expose their private buffer whenever possible to reduce garbage generation and copying costs. byte array the implementation stores object IDs within. Get the position within {@link #idBuffer()} of this entry's ObjectId. @return offset into the array returned by {@link #idBuffer()} where the ObjectId must be copied out of. Create a new iterator for the current entry's subtree. The parent reference of the iterator must be this, otherwise the caller would not be able to exit out of the subtree iterator correctly and return to continue walking this. @param repo repository to load the tree data from. @return a new parser that walks over the current subtree. @throws IncorrectObjectTypeException the current entry is not actually a tree and cannot be parsed as though it were a tree. @throws IOException a loose object or pack file could not be Read. Create a new iterator as though the current entry were a subtree. @return a new empty tree iterator. Create a new iterator for the current entry's subtree. The parent reference of the iterator must be this, otherwise the caller would not be able to exit out of the subtree iterator correctly and return to continue walking this. @param repo repository to load the tree data from. @param idBuffer temporary ObjectId buffer for use by this method. @param curs window cursor to use during repository access. @return a new parser that walks over the current subtree. @throws IncorrectObjectTypeException the current entry is not actually a tree and cannot be parsed as though it were a tree. @throws IOException a loose object or pack file could not be Read. Is this tree iterator positioned on its first entry? An iterator is positioned on the first entry if back(1) would be an invalid request as there is no entry before the current one. An empty iterator (one with no entries) will be first() && eof(). @return true if the iterator is positioned on the first entry. Is this tree iterator at its EOF point (no more entries)? An iterator is at EOF if there is no current entry. @return true if we have walked all entries and have none left. Move to next entry, populating this iterator with the entry data. The delta indicates how many moves forward should occur. The most common delta is 1 to move to the next entry. Implementations must populate the following members:
  • {@link #mode}
  • {@link #_path} (from {@link #_pathOffset} to {@link #_pathLen})
  • {@link #_pathLen}
as well as any implementation dependent information necessary to accurately return data from {@link #idBuffer()} and {@link #idOffset()} when demanded. @param delta number of entries to move the iterator by. Must be a positive, non-zero integer. @throws CorruptObjectException the tree is invalid.
Move to prior entry, populating this iterator with the entry data. The delta indicates how many moves backward should occur. The most common delta is 1 to move to the prior entry. Implementations must populate the following members:
  • {@link #_path} (from {@link #_pathOffset} to {@link #_pathLen})
  • {@link #_pathLen}
as well as any implementation dependent information necessary to accurately return data from and when demanded.
Number of entries to move the iterator by. Must be a positive, non-zero integer.
Advance to the next tree entry, populating this iterator with its data. This method behaves like seek(1) but is called by only if a was used and ruled out the current entry from the results. In such cases this tree iterator may perform special behavior. Indicates to the iterator that no more entries will be Read. This is only invoked by TreeWalk when the iteration is aborted early due to a being thrown from within a TreeFilter. Get the name component of the current entry path into the provided buffer. The buffer to get the name into, it is assumed that buffer can hold the name. The offset of the name in the The file mode of the current entry. The file mode of the current entry as bits. Gets the path of the current entry, as a string. Gets the Length of the name component of the path for the current entry. Iterator for the parent tree; null if we are the root iterator. The iterator this current entry is path equal to. Number of entries we moved forward to force a D/F conflict match. bits for the current entry. A numerical value from FileMode is usually faster for an iterator to obtain from its data source so this is the preferred representation. Path buffer for the current entry. This buffer is pre-allocated at the start of walking and is shared from parent iterators down into their subtree iterators. The sharing allows the current entry to always be a full path from the root, while each subtree only needs to populate the part that is under their control. Position within this iterator starts writing at. This is the first offset in that this iterator must populate during . At the root level (when is null) this is 0. For a subtree iterator the index before this position should have the value '/'. Total Length of the current entry's complete _path from the root. This is the number of bytes within that pertain to the current entry. Values at this index through the end of the array are garbage and may be randomly populated from prior entries. Create a new iterator for an already loaded DirCache instance. The iterator implementation may copy part of the cache's data during construction, so the cache must be Read in prior to creating the iterator. The cache to walk. It must be already loaded into memory. Get the DirCacheEntry for the current file. The current cache entry, if this iterator is positioned on a non-tree. The cache this iterator was created to walk. The tree this iterator is walking. First position in this tree. Last position in this tree. Special buffer to hold the of . Index of entry within . Next subtree to consider within . The current file entry from . The subtree containing if this is first entry. Create a new iterator for an already loaded instance. The iterator implementation may copy part of the cache's data during construction, so the cache must be Read in prior to creating the iterator. The cache builder for the cache to walk. The cache must be already loaded into memory. Create a new iterator for an already loaded instance. The iterator implementation may copy part of the cache's data during construction, so the cache must be Read in prior to creating the iterator. The parent iterator The cache tree Updates a by supplying discrete edit commands. An editor updates a by taking a list of commands and executing them against the entries of the destination cache to produce a new cache. This edit style allows applications to insert a few commands and then have the editor compute the proper entry indexes necessary to perform an efficient in-order update of the index records. This can be easier to use than . Construct a new editor. The cache this editor will eventually update. Estimated number of entries the editor will have upon completion. This sizes the initial entry table. Append one edit command to the list of commands to be applied. Edit commands may be added in any order chosen by the application. They are automatically rearranged by the builder to provide the most efficient update possible. Another edit command. Any index record update. Applications should subclass and provide their own implementation for the method. The editor will invoke apply once for each record in the index which matches the path name. If there are multiple records (for example in stages 1, 2 and 3), the edit instance will be called multiple times, once for each stage. Create a new update command by path name. path of the file within the repository. Create a new update command for an existing entry instance. Entry instance to match path of. Only the path of this entry is actually considered during command evaluation. Apply the update to a single cache entry matching the path. After apply is invoked the entry is added to the output table, and will be included in the new index. The entry being processed. All fields are zeroed out if the path is a new path in the index. Deletes a single file entry from the index. This deletion command removes only a single file at the given location, but removes multiple stages (if present) for that path. To remove a complete subtree use instead. Create a new deletion command by path name. Path of the file within the repository. Create a new deletion command for an existing entry instance. Entry instance to remove. Only the path of this entry is actually considered during command evaluation. Recursively deletes all paths under a subtree. This deletion command is more generic than as it can remove all records which appear recursively under the same subtree. Multiple stages are removed (if present) for any deleted entry. This command will not remove a single file entry. To remove a single file use . Create a new tree deletion command by path name. Path of the subtree within the repository. If the path does not end with "/" a "/" is implicitly added to ensure only the subtree's contents are matched by the command. A single file (or stage of a file) in a . An entry represents exactly one stage of a file. If a file path is unmerged then multiple DirCacheEntry instances may appear for the same path name. The standard (fully merged) stage for an entry. The base tree revision for an entry. The first tree revision (usually called "ours"). The second tree revision (usually called "theirs"). Mask applied to data in to get the name Length. (Possibly shared) header information storage. First location within where our header starts. Our encoded path name, from the root of the repository. Create an empty entry at stage 0. Name of the cache entry. Create an empty entry at the specified stage. name of the cache entry. the stage index of the new entry. Create an empty entry at stage 0. name of the cache entry, in the standard encoding. Create an empty entry at the specified stage. Name of the cache entry, in the standard encoding. The stage index of the new entry. Is it possible for this entry to be accidentally assumed clean? The "racy git" problem happens when a work file can be updated faster than the filesystem records file modification timestamps. It is possible for an application to edit a work file, update the index, then edit it again before the filesystem will give the work file a new modification timestamp. This method tests to see if file was written out at the same time as the index. Seconds component of the index's last modified time. Nanoseconds component of the index's last modified time. true if extra careful checks should be used. Force this entry to no longer match its working tree file. This avoids the "racy git" problem by making this index entry no longer match the file in the working directory. Later git will be forced to compare the file content to ensure the file matches the working tree. Is this entry always thought to be unmodified? Most entries in the index do not have this flag set. Users may however set them on if the file system stat() costs are too high on this working directory, such as on NFS or SMB volumes. true if we must assume the entry is unmodified. Set the assume valid flag for this entry, True to ignore apparent modifications; false to look at last modified to detect file modifications. Get the stage of this entry. Entries have one of 4 possible stages: 0-3. the stage of this entry. Obtain the raw bits for this entry. mode bits for the entry. Obtain the for this entry. The file mode singleton for this entry. Set the file mode for this entry. The new mode constant. Get the cached last modification date of this file, in milliseconds. One of the indicators that the file has been modified by an application changing the working tree is if the last modification time for the file differs from the time stored in this entry. last modification time of this file, in milliseconds since the Java epoch (midnight Jan 1, 1970 UTC). Set the cached last modification date of this file, using milliseconds. new cached modification date of the file, in milliseconds. Get the cached size (in bytes) of this file. One of the indicators that the file has been modified by an application changing the working tree is if the size of the file (in bytes) differs from the size stored in this entry. Note that this is the length of the file in the working directory, which may differ from the size of the decompressed blob if work tree filters are being used, such as LF<->CRLF conversion. cached size of the working directory file, in bytes. Set the cached size (in bytes) of this file. new cached size of the file, as bytes. Obtain the ObjectId for the entry. Using this method to compare ObjectId values between entries is inefficient as it causes memory allocation. object identifier for the entry. Set the ObjectId for the entry. New object identifier for the entry. May be to remove the current identifier. Set the ObjectId for the entry from the raw binary representation. The raw byte buffer to read from. At least 20 bytes after must be available within this byte array. position to read the first byte of data from. Get the entry's complete path. This method is not very efficient and is primarily meant for debugging and final output generation. Applications should try to avoid calling it, and if invoked do so only once per interesting entry, where the name is absolutely required for correct function. Complete path of the entry, from the root of the repository. If the entry is in a subtree there will be at least one '/' in the returned string. Copy the ObjectId and other meta fields from an existing entry. This method copies everything except the path from one entry to another, supporting renaming. The entry to copy ObjectId and meta fields from. New cached modification date of the file, in milliseconds. Single tree record from the 'TREE' extension. A valid cache tree record contains the object id of a tree object and the total number of instances (counted recursively) from the DirCache contained within the tree. This information facilitates faster traversal of the index and quicker generation of tree objects prior to creating a new commit. An invalid cache tree record indicates a known subtree whose file entries have changed in ways that cause the tree to no longer have a known object id. Invalid cache tree records must be revalidated prior to use. Determine if this cache is currently valid. A valid cache tree knows how many instances from the parent reside within this tree (recursively enumerated). It also knows the object id of the tree, as the tree should be readily available from the repository's object database. True if this tree is knows key details about itself; false if the tree needs to be regenerated. Get the number of entries this tree spans within the DirCache. If this tree is not valid (see ) this method's return value is always strictly negative (less than 0) but is otherwise an undefined result. Total number of entries (recursively) contained within this tree. Get the number of cached subtrees contained within this tree. Number of child trees available through this tree. Get the i-th child cache tree. Index of the child to obtain. The child tree. Get the tree's name within its parent. This method is not very efficient and is primarily meant for debugging and final output generation. Applications should try to avoid calling it, and if invoked do so only once per interesting entry, where the name is absolutely required for correct function. Name of the tree. This does not contain any '/' characters. Get the tree's path within the repository. This method is not very efficient and is primarily meant for debugging and final output generation. Applications should try to avoid calling it, and if invoked do so only once per interesting entry, where the name is absolutely required for correct function. Path of the tree, relative to the repository root. If this is not the root tree the path ends with '/'. The root tree's path string is the empty string (""). Write (if necessary) this tree to the object store. the complete cache from DirCache. first position of cache that is a member of this tree. The path of cache[cacheIdx].path for the range [0,pathOff-1) matches the complete path of this tree, from the root of the repository. number of bytes of cache[cacheIdx].path that matches this tree's path. The value at array position cache[cacheIdx].path[pathOff-1] is always '/' if pathOff is > 0. the writer to use when serializing to the store. identity of this tree. one or more paths contain higher-order stages (stage > 0), which cannot be stored in a tree object. an unexpected error occurred writing to the object store. Update (if necessary) this tree's entrySpan. the complete cache from DirCache. Number of entries in cache that are valid for iteration. First position of cache that is a member of this tree. The path of cache[cacheIdx].path for the range [0,pathOff-1) matches the complete path of this tree, from the root of the repository. number of bytes of cache[cacheIdx].path that matches this tree's path. The value at array position cache[cacheIdx].path[pathOff-1] is always '/' if pathOff is > 0. Construct a for the specified file Construct a for the specified file Construct a for the specified file An exception detailing multiple reasons for failure. Constructs an exception detailing many potential reasons for failure. Two or more exceptions that may have been the problem. Get the complete list of reasons why this failure happened. Unmodifiable collection of all possible reasons. Indicates a text string is not a valid Git style configuration. Construct an invalid configuration error. Why the configuration is invalid. Construct an invalid configuration error. why the configuration is invalid. Construct an invalid configuration error. An exception thrown when a gitlink entry is found and cannot be handled. Construct a GitlinksNotSupportedException for the specified link Name of link in tree or workdir Construct a GitlinksNotSupportedException for the specified link Name of link in tree or workdir Inner Exception An inconsistency with respect to handling different object types. This most likely signals a programming error rather than a corrupt object database. Construct and IncorrectObjectTypeException for the specified object id. Provide the type to make it easier to track down the problem. SHA-1 Object type Construct and IncorrectObjectTypeException for the specified object id. Provide the type to make it easier to track down the problem. SHA-1 Object type Inner Exception. Construct and IncorrectObjectTypeException for the specified object id. Provide the type to make it easier to track down the problem. SHA-1 Object type Construct and IncorrectObjectTypeException for the specified object id. Provide the type to make it easier to track down the problem. SHA-1 Object type Construct and IncorrectObjectTypeException for the specified object id. Provide the type to make it easier to track down the problem. SHA-1 Object type Inner Exception. Thrown when an invalid object id is passed in as an argument. Create exception with bytes of the invalid object id. containing the invalid id. offset in the byte array where the error occurred. length of the sequence of invalid bytes. Create exception with bytes of the invalid object id. containing the invalid id. offset in the byte array where the error occurred. length of the sequence of invalid bytes. Inner Exception. The invalid pattern. Indicates a base/common object was required, but is not found. Constructs a MissingBundlePrerequisiteException for a set of objects. URI used for transport the Map of the base/common object(s) we don't have. Keys are ids of the missing objects and values are short descriptions. An expected object is missing. Construct a MissingObjectException for the specified object id. Expected type is reported to simplify tracking down the problem. SHA-1 Object type Construct a MissingObjectException for the specified object id. Expected type is reported to simplify tracking down the problem. SHA-1 Object type Construct a MissingObjectException for the specified object id. Expected type is reported to simplify tracking down the problem. SHA-1 Object type Construct a MissingObjectException for the specified object id. Expected type is reported to simplify tracking down the problem. SHA-1 Object type Inner Exception. Construct a MissingObjectException for the specified object id. Expected type is reported to simplify tracking down the problem. SHA-1 Object type Inner Exception. Construct a MissingObjectException for the specified object id. Expected type is reported to simplify tracking down the problem. SHA-1 Object type Inner Exception. Indicates a local repository does not exist Constructs an exception indicating a local repository does not exist Description of the repository not found, usually file path Constructs an exception indicating a local repository does not exist Description of the repository not found, usually file path Constructs an exception indicating a local repository does not exist Description of the repository not found, usually file path Inner Exception. Constructs an exception indicating a local repository does not exist Description of the repository not found, usually file path Inner Exception. Indicates a checked exception was thrown inside of . Usually this exception is thrown from the Iterator created around a RevWalk instance, as the Iterator API does not allow checked exceptions to be thrown from hasNext() or next(). The of this exception is the original checked exception that we really wanted to throw back to the application for handling and recovery. Create a new walk exception an original cause. The checked exception that describes why the walk failed. Stops the driver loop of walker and finish with current result Singleton instance for throwing within a filter. Indicates one or more paths in a DirCache have non-zero stages present. Create a new unmerged path exception. The first non-zero stage of the unmerged path. Create a new unmerged path exception. The first non-zero stage of the unmerged path. Inner Exception. Returns the first non-zero stage of the unmerged path. the character which decides which heads are returned. a list of heads based on the input. A list of s which will not be modified. This class can be used to match filenames against fnmatch like patterns. It is not thread save. Supported are the wildcard characters * and ? and groups with:
  • characters e.g. [abc]
  • ranges e.g. [a-z]
  • the following character classes
    • [:alnum:]
    • [:alpha:]
    • [:blank:]
    • [:cntrl:]
    • [:digit:]
    • [:graph:]
    • [:lower:]
    • [:print:]
    • [:punct:]
    • [:space:]
    • [:upper:]
    • [:word:]
    • [:xdigit:]
    e. g. [[:xdigit:]]
needs a list for the new heads, allocating a new array would be bad for the performance, as the method gets called very often. Must be a list which will never be modified. must be a list which will never be modified. a list which will be cloned and then used as current head list. must contain a pattern which fnmatch would accept. if this parameter isn't null then this character will not match at wildcards(* and ? are wildcards). if the patternString contains a invalid fnmatch pattern. A copy constructor which creates a new with the same state and Reset point like other. another instance. Extends the string which is matched against the patterns of this class. Resets this matcher to it's state right After construction. A instance which uses the same pattern like this matcher, but has the current state of this matcher as Reset and start point. True, if the string currently being matched does match. False, if the string being matched will not match when the string gets extended. The character to test Returns true if the character matches a pattern. Don't call this constructor, use Provides the merge algorithm which does a three-way merge on content provided as RawText. Makes use of {@link MyersDiff} to compute the diffs. Since this class provides only static methods I add a private default constructor to prevent instantiation. Does the three way merge between a common base and two sequences. base the common base sequence ours the first sequence to be merged theirs the second sequence to be merged the resulting content Helper method which returns the next Edit for an Iterator over Edits. When there are no more edits left this method will return the constant END_EDIT. the iterator for which the next edit should be returned the next edit from the iterator or END_EDIT if there no more edits One chunk from a merge result. Each chunk contains a range from a single sequence. In case of conflicts multiple chunks are reported for one conflict. The conflictState tells when conflicts start and end. Creates a new empty MergeChunk determines to which sequence this chunks belongs to. Same as in the first element from the specified sequence which should be included in the merge result. Indexes start with 0. specifies the end of the range to be added. The element this index points to is the first element which not added to the merge result. All elements between begin (including begin) and this element are added. the state of this chunk. See the index of the sequence to which sequence this chunks belongs to. Same as in the first element from the specified sequence which should be included in the merge result. Indexes start with 0. the end of the range of this chunk. The element this index points to is the first element which not added to the merge result. All elements between begin (including begin) and this element are added. the state of this chunk. See A state telling whether a MergeChunk belongs to a conflict or not. The first chunk of a conflict is reported with a special state to be able to distinguish the border between two consecutive conflicts This chunk does not belong to a conflict This chunk does belong to a conflict and is the first one of the conflicting chunks This chunk does belong to a conflict but is not the first one of the conflicting chunks. It's a subsequent one. A class to convert merge results into a Git conformant textual presentation Formats the results of a merge of objects in a Git conformant way. This method also assumes that the objects being merged are line oriented files which use LF as delimiter. This method will also use LF to separate chunks and conflict metadata, therefore it fits only to texts that are LF-separated lines. the outputstream where to write the textual presentation the merge result which should be presented When a conflict is reported each conflicting range will get a name. This name is following the "<<<<<<< " or ">>>>>>> " conflict markers. The names for the sequences are given in this list the name of the characterSet used when writing conflict metadata Formats the results of a merge of exactly two objects in a Git conformant way. This convenience method accepts the names for the three sequences (base and the two merged sequences) as explicit parameters and doesn't require the caller to specify a List the where to write the textual presentation the merge result which should be presented the name ranges from the base should get the name ranges from ours should get the name ranges from theirs should get the name of the characterSet used when writing conflict metadata Instance of a specific for a single . Create a new merge instance for a repository. the repository this merger will read and write data on. An object writer to Create objects in . Merge together two or more tree-ish objects. Any tree-ish may be supplied as inputs. Commits and/or tags pointing at trees or commits may be passed as input objects. source trees to be combined together. The merge base is not included in this set. True if the merge was completed without conflicts; false if the merge strategy cannot handle this merge or there were conflicts preventing it from automatically resolving all paths. one of the input objects is not a commit, but the strategy requires it to be a commit. one or more sources could not be read, or outputs could not be written to the Repository. Create an iterator to walk the merge base of two commits. Index of the first commit in . Index of the second commit in . the new iterator one of the input objects is not a commit. objects are missing or multiple merge bases were found. Open an iterator over a tree. the tree to scan; must be a tree (not a ). An iterator for the tree. the input object is not a tree. the tree object is not found or cannot be read. Execute the merge. This method is called from after the , and have been populated. true if the merge was completed without conflicts; false if the merge strategy cannot handle this merge or there were conflicts preventing it from automatically resolving all paths. one of the input objects is not a commit, but the strategy requires it to be a commit. one or more sources could not be read, or outputs could not be written to the Repository. Resulting tree, if returned true. The repository this merger operates on. A for computing merge bases, or listing incoming commits. The original objects supplied in the merge; this can be any . If [i] is a commit, this is the commit. The trees matching every entry in . The result of merging a number of objects. These sequences have one common predecessor sequence. The result of a merge is a list of MergeChunks. Each MergeChunk contains either a range (a subsequence) from one of the merged sequences, a range from the common predecessor or a conflicting range from one of the merged sequences. A conflict will be reported as multiple chunks, one for each conflicting range. The first chunk for a conflict is marked specially to distinguish the border between two consecutive conflicts. This class does not know anything about how to present the merge result to the end-user. MergeFormatters have to be used to construct something human readable. Creates a new empty MergeResult contains the common predecessor sequence at position 0 followed by the merged sequences. This list should not be modified anymore during the lifetime of this . Adds a new range from one of the merged sequences or from the common predecessor. This method can add conflicting and non-conflicting ranges controlled by the conflictState parameter determines from which sequence this range comes. An index of x specifies the x+1 element in the list of sequences specified to the constructor the first element from the specified sequence which should be included in the merge result. Indexes start with 0. specifies the end of the range to be added. The element this index points to is the first element which not added to the merge result. All elements between begin (including begin) and this element are added. when set to NO_CONLICT a non-conflicting range is added. This will end implicitly all open conflicts added before. Returns the common predecessor sequence and the merged sequence in one list. The common predecessor is is the first element in the list the common predecessor at position 0 followed by the merged sequences. an iterator over the MergeChunks. The iterator does not support the remove operation true if this merge result contains conflicts A method of combining two or more trees together to form an output tree. Different strategies may employ different techniques for deciding which paths (and ObjectIds) to carry from the input trees into the final output tree. Simple strategy that sets the output tree to the first input tree. Simple strategy that sets the output tree to the second input tree. Simple strategy to merge paths, without simultaneous edits. Register a merge strategy so it can later be obtained by name. the strategy to register. a strategy by the same name has already been registered. Register a merge strategy so it can later be obtained by name. name the strategy can be looked up under. the strategy to register. a strategy by the same name has already been registered. Locate a strategy by name. name of the strategy to locate. The strategy instance; null if no strategy matches the name. Get all registered strategies. The registered strategy instances. No inherit order is returned; the caller may modify (and/or sort) the returned array if necessary to obtain a reasonable ordering. Create a new merge instance. repository database the merger will read from, and eventually write results back to. the new merge instance which implements this strategy. default name of this strategy implementation. Trivial merge strategy to make the resulting tree exactly match an input. This strategy can be used to cauterize an entire side branch of history, by setting the output tree to one of the inputs, and ignoring any of the paths of the other inputs. Create a new merge strategy to select a specific input tree. name of this strategy. the position of the input tree to accept as the result. Merges two commits together in-memory, ignoring any working directory. The strategy chooses a path from one of the two input trees if the path is unchanged in the other relative to their common merge base tree. This is a trivial 3-way merge (at the file path level only). Modifications of the same file path (content and/or file mode) by both input trees will cause a merge conflict, as this strategy does not attempt to merge file contents. A merge strategy to merge 2 trees, using a common base ancestor tree. A merge of 2 trees, using a common base ancestor tree. Create a new merge instance for a repository. The repository this merger will Read and write data on. Set the common ancestor tree. Common base treeish; null to automatically compute the common base from the input commits during . The object is not a . The object does not exist. The object could not be read. Merge together two objects. Any tree-ish may be supplied as inputs. Commits and/or tags pointing at trees or commits may be passed as input objects. source tree to be combined together. source tree to be combined together. true if the merge was completed without conflicts; false if the merge strategy cannot handle this merge or there were conflicts preventing it from automatically resolving all paths. one of the input objects is not a commit, but the strategy requires it to be a commit. one or more sources could not be read, or outputs could not be written to the Repository. Create an iterator to walk the merge base. An iterator over the caller-specified merge base, or the natural merge base of the two input commits. Part of a "GIT binary patch" to describe the pre-image or post-image Offset within {@link #file}.buf to the "literal" or "delta " line. Position 1 past the end of this hunk within {@link #file}'s buf. Type of the data meaning. Inflated length of the data. @return header for the file this hunk applies to @return the byte array holding this hunk's patch script. @return offset the start of this hunk in {@link #getBuffer()}. @return offset one past the end of the hunk in {@link #getBuffer()}. @return type of this binary hunk @return inflated size of this hunk's data Type of information stored in a binary hunk. The full content is stored, deflated. A Git pack-style delta is stored, deflated. A file in the Git "diff --cc" or "diff --combined" format. A combined diff shows an n-way comparison between two or more ancestors and the final revision. Its primary function is to perform code reviews on a merge which introduces changes not in any ancestor. Patch header describing an action for a single file path. Convert the patch script for this file into a string. The default character encoding is assumed for both the old and new files. The patch script, as a Unicode string. Convert the patch script for this file into a string. hint character set to decode the old lines with. hint character set to decode the new lines with. the patch script, as a Unicode string. Convert the patch script for this file into a string. optional array to suggest the character set to use when decoding each file's line. If supplied the array must have a length of + 1 representing the old revision character sets and the new revision character set. the patch script, as a Unicode string. The old file mode, if described in the patch The type of change this patch makes on Returns similarity score between and if is or . Get the old object id from the index. The object id; null if there is no index line Get the new object id from the index. The object id; null if there is no index line Style of patch used to modify this file True if this patch modifies metadata about a file If a , the new-image delta/literal If a , the old-image delta/literal Returns a list describing the content edits performed on this file. Parse a "diff --git" or "diff --cc" line. first character After the "diff --git " or "diff --cc " part. one past the last position to parse. first character After the LF at the end of the line; -1 on error. Determine if this is a patch hunk header. the buffer to scan first position in the buffer to evaluate last position to consider; usually the end of the buffer (buf.length) or the first position on the next line. This is only used to avoid very long runs of '@' from killing the scan loop. the number of "ancestor revisions" in the hunk header. A traditional two-way diff ("@@ -...") returns 1; a combined diff for a 3 way-merge returns 3. If this is not a hunk header, 0 is returned instead. The byte array holding this file's patch script. Offset the start of this file's script in Offset one past the end of the file script. Get the old name associated with this file. The meaning of the old name can differ depending on the semantic meaning of this patch:
  • file add: always /dev/null
  • file modify: always
  • file delete: always the file being deleted
  • file copy: source file the copy originates from
  • file rename: source file the rename originates from
Old name for this file.
Get the new name associated with this file. The meaning of the new name can differ depending on the semantic meaning of this patch:
  • file add: always the file being created
  • file modify: always
  • file delete: always /dev/null
  • file copy: destination file the copy ends up at
  • file rename: destination file the rename ends up at
The new file mode, if described in the patch Gets the hunks altering this file; in order of appearance in patch General type of change a single file-level patch describes. Add a new file to the project Modify an existing file in the project (content and/or mode) Delete an existing file from the project Rename an existing file to a new location Copy an existing file to a new location, keeping the original Type of patch used by this file. A traditional unified diff style patch of a text file. An empty patch with a message "Binary files ... differ" A Git binary patch, holding pre and post image deltas Get the file mode of the first parent. Get the file mode of the nth ancestor @param nthParent the ancestor to get the mode of @return the mode of the requested ancestor. @return get the object id of the first parent. Get the ObjectId of the nth ancestor @param nthParent the ancestor to get the object id of @return the id of the requested ancestor. Number of ancestor revisions mentioned in this diff. Hunk header for a hunk appearing in a "diff --cc" style patch. Hunk header describing the layout of a single block of lines. Returns a list describing the content edits performed within the hunk. Header for the file this hunk applies to. The byte array holding this hunk's patch script. Offset within to the "@@ -" line. Position 1 past the end of this hunk within 's buffer. First line number in the post-image file where the hunk starts. Total number of post-image lines this hunk covers (context + inserted) Total number of lines of context appearing in this hunk. Gets the data related to the nth ancestor The ancestor to get the old image data of The image data of the requested ancestor. An error in a patch script. The severity of the error. A message describing the error. The byte buffer holding the patch script. Byte offset within where the error is Line of the patch script the error appears on. Classification of an error. The error is unexpected, but can be worked around. The error indicates the script is severely flawed. Details about an old image of the file. Returns the of the pre-image file. Returns the of this hunk. Return the first line number the hunk starts on in this file. rReturn the total number of lines this hunk covers in this file. Returns the number of lines deleted by the post-image from this file. Returns the number of lines added by the post-image not in this file. A parsed collection of s from a unified diff patch file. Create an empty patch. Add a single file to this patch. Typically files should be added by parsing the text through one of this class's parse methods. @param fh the header of the file. @return list of files described in the patch, in occurrence order. Add a formatting error to this patch script. @param err the error description. @return collection of formatting errors, if any. Parse a patch received from an InputStream. Multiple parse calls on the same instance will concatenate the patch data, but each parse input must start with a valid file header (don't split a single file across parse calls). @param is the stream to Read the patch data from. The stream is Read until EOF is reached. @throws IOException there was an error reading from the input stream. Parse a patch stored in a byte[]. Multiple parse calls on the same instance will concatenate the patch data, but each parse input must start with a valid file header (don't split a single file across parse calls). @param buf the buffer to parse. @param ptr starting position to parse from. @param end 1 past the last position to end parsing. The total length to be parsed is end - ptr. The build number if the system is Windows Server 2003 R2; otherwise, 0. Basic commit graph renderer for graphical user interfaces. Lanes are drawn as columns left-to-right in the graph, and the commit short message is drawn to the right of the lane lines for this cell. It is assumed that the commits are being drawn as rows of some sort of table. Client applications can subclass this implementation to provide the necessary drawing primitives required to display a commit graph. Most of the graph layout is handled by this class, allowing applications to implement only a handful of primitive stubs. This class is suitable for us within an AWT TableCellRenderer or within a SWT PaintListener registered on a Table instance. It is meant to rubber stamp the graphics necessary for one row of a plotted commit list. Subclasses should call {@link #paintCommit(PlotCommit, int)} after they have otherwise configured their instance to draw one commit into the current location. All drawing methods assume the coordinate space for the current commit's cell starts at (upper left corner is) 0,0. If this is not true (like say in SWT) the implementation must perform the cell offset computations within the various draw methods. type of color object used by the graphics library. Paint one commit using the underlying graphics library. the commit to render in this cell. Must not be null. total height (in pixels) of this cell. Draw a decoration for the Ref ref at x,y left top A peeled ref width of label in pixels Obtain the color reference used to paint this lane. Colors returned by this method will be passed to the other drawing primitives, so the color returned should be application specific. If a null lane is supplied the return value must still be acceptable to a drawing method. Usually this means the implementation should return a default color. the current lane. May be null. graphics specific color reference. Must be a valid color. Draw a single line within this cell. the color to use while drawing the line. starting X coordinate, 0 based. starting Y coordinate, 0 based. ending X coordinate, 0 based. ending Y coordinate, 0 based. number of pixels wide for the line. Always at least 1. Draw a single commit dot. Usually the commit dot is a filled oval in blue, then a drawn oval in black, using the same coordinates for both operations. upper left of the oval's bounding box. upper left of the oval's bounding box. width of the oval's bounding box. height of the oval's bounding box. Draw a single boundary commit (aka uninteresting commit) dot. Usually a boundary commit dot is a light gray oval with a white center. upper left of the oval's bounding box. upper left of the oval's bounding box. width of the oval's bounding box. height of the oval's bounding box. Draw a single line of text. The font and colors used to render the text are left up to the implementation. the text to draw. Does not contain LFs. first pixel from the left that the text can be drawn at. Character data must not appear before this position. pixel coordinate of the centerline of the text. Implementations must adjust this coordinate to account for the way their implementation handles font rendering. A commit reference to a commit in the DAG. A commit reference to a commit in the DAG. Base object type accessed during revision walking. A (possibly mutable) SHA-1 abstraction. If this is an instance of the concept of equality with this instance can alter at any time, if this instance is modified to represent a different object name. Compare to object identifier byte sequences for equality. the first identifier to compare. Must not be null. the second identifier to compare. Must not be null. Determine if this ObjectId has exactly the same value as another. the other id to compare to. May be null. true only if both ObjectIds have identical bits. Copy this ObjectId to an output writer in hex format. the stream to copy to. Copy this ObjectId to a StringBuilder in hex format. temporary char array to buffer construct into before writing. Must be at least large enough to hold 2 digits for each byte of object id (40 characters or larger). the string to append onto. Copy this ObjectId to an output writer in hex format. temporary char array to buffer construct into before writing. Must be at least large enough to hold 2 digits for each byte of object id (40 characters or larger). the stream to copy to. Copy this ObjectId to an output writer in hex format. the stream to copy to. Copy this ObjectId to a byte array. the buffer to copy to. the offset within b to write at. Copy this ObjectId to a int array. the buffer to copy to. the offset within b to write at. Return unique abbreviation (prefix) of this object SHA-1. This method is a utility for abbreviate(repo, 8). repository for checking uniqueness within. SHA-1 abbreviation. Return unique abbreviation (prefix) of this object SHA-1. Current implementation is not guaranteeing uniqueness, it just returns fixed-length prefix of SHA-1 string. repository for checking uniqueness within. minimum length of the abbreviated string. SHA-1 abbreviation. For ObjectIdMap A discriminator usable for a fan-out style map Compare this ObjectId to another and obtain a sort ordering. the other id to compare to. Must not be null. < 0 if this id comes before other; 0 if this id is equal to other; > 0 if this id comes after other. Tests if this ObjectId starts with the given abbreviation. the abbreviation. True if this ObjectId begins with the abbreviation; else false. Obtain an immutable copy of this current object name value. Only returns this if this instance is an unsubclassed instance of {@link ObjectId}; otherwise a new instance is returned holding the same value. This method is useful to shed any additional memory that may be tied to the subclass, yet retain the unique identity of the object id for future lookups within maps and repositories. an immutable copy, using the smallest memory footprint possible. Obtain an immutable copy of this current object name value. See if this is a possibly subclassed (but immutable) identity and the application needs a lightweight identity only reference. an immutable copy. May be this if this is already an immutable instance. string form of the SHA-1, in lower case hexadecimal. Determines whether the specified objects are equal. true if the specified objects are equal; otherwise, false. The first object of type to compare. The second object of type to compare. Returns a hash code for the specified object. A hash code for the specified object. The for which a hash code is to be returned. The type of is a reference type and is null. Test a string of characters to verify it is a hex format. If true the string can be parsed with . the string to test. true if the string can converted into an . Convert an ObjectId into a hex string representation. The id to convert. May be null. The hex string conversion of this id's content. Compare to object identifier byte sequences for equality. the first buffer to compare against. Must have at least 20 bytes from position ai through the end of the buffer. first offset within firstBuffer to begin testing. the second buffer to compare against. Must have at least 2 bytes from position bi through the end of the buffer. first offset within secondBuffer to begin testing. return true if the two identifiers are the same. Convert an ObjectId from raw binary representation. The raw byte buffer to read from. At least 20 bytes after must be available within this byte array. Position to read the first byte of data from. The converted object id. Convert an ObjectId from raw binary representation. The raw byte buffer to read from. At least 20 bytes must be available within this byte array. the converted object id. Get the name of this object. Unique hash of this object. Test to see if the flag has been set on this object. the flag to test. true if the flag has been added to this object; false if not. Test to see if any flag in the set has been set on this object. the flags to test. true if any flag in the set has been added to this object; false if not. Test to see if all flags in the set have been set on this object. the flags to test. true if all flags of the set have been added to this object; false if some or none have been added. Add a flag to this object. If the flag is already set on this object then the method has no effect. The flag to mark on this object, for later testing. Add a set of flags to this object. The set of flags to mark on this object, for later testing. Remove a flag from this object. If the flag is not set on this object then the method has no effect. The flag to remove from this object. Remove a set of flags from this object. The flag to remove from this object. Release as much memory as possible from this object. Buffer to Append a debug description of core RevFlags onto. Get Git object type. See . Create a new commit reference. object name for the commit. Carry a RevFlag set on this commit to its parents. If this commit is parsed, has parents, and has the supplied flag set on it we automatically add it to the parents, grand-parents, and so on until an unparsed commit or a commit with no parents is discovered. This permits applications to force a flag through the history chain when necessary. The single flag value to carry back onto parents. Parse this commit buffer for display. revision walker owning this reference. Parsed commit. Get the nth parent from this commit's parent list. the specified parent Parent index to obtain. Must be in the range 0 through -1. An invalid parent index was specified. Parse the author identity from the raw buffer. This method parses and returns the content of the author line, after taking the commit's character set into account and decoding the author name and email address. This method is fairly expensive and produces a new PersonIdent instance on each invocation. Callers should invoke this method only if they are certain they will be outputting the result, and should cache the return value for as long as necessary to use all information from it. implementations should try to use to scan the instead, as this will allow faster evaluation of commits. Identity of the author (name, email) and the time the commit was made by the author; null if no author line was found. Parse the committer identity from the raw buffer. This method parses and returns the content of the committer line, after taking the commit's character set into account and decoding the committer name and email address. This method is fairly expensive and produces a new PersonIdent instance on each invocation. Callers should invoke this method only if they are certain they will be outputting the result, and should cache the return value for as long as necessary to use all information from it. implementations should try to use to scan the instead, as this will allow faster evaluation of commits. Identity of the committer (name, email) and the time the commit was made by the committer; null if no committer line was found. Parse the complete commit message and decode it to a string. This method parses and returns the message portion of the commit buffer, After taking the commit's character set into account and decoding the buffer using that character set. This method is a fairly expensive operation and produces a new string on each invocation. Decoded commit message as a string. Never null. Parse the commit message and return the first "line" of it. The first line is everything up to the first pair of LFs. This is the "oneline" format, suitable for output in a single line display. This method parses and returns the message portion of the commit buffer, after taking the commit's character set into account and decoding the buffer using that character set. This method is a fairly expensive operation and produces a new string on each invocation. Decoded commit message as a string. Never null. The returned string does not contain any LFs, even if the first paragraph spanned multiple lines. Embedded LFs are converted to spaces. Parse the footer lines (e.g. "Signed-off-by") for machine processing. This method splits all of the footer lines out of the last paragraph of the commit message, providing each line as a key-value pair, ordered by the order of the line's appearance in the commit message itself. A footer line's key must match the pattern {@code ^[A-Za-z0-9-]+:}, while the value is free-form, but must not contain an LF. Very common keys seen in the wild are:
  • {@code Signed-off-by} (agrees to Developer Certificate of Origin)
  • {@code Acked-by} (thinks change looks sane in context)
  • {@code Reported-by} (originally found the issue this change fixes)
  • {@code Tested-by} (validated change fixes the issue for them)
  • {@code CC}, {@code Cc} (copy on all email related to this change)
  • {@code Bug} (link to project's bug tracking system)
Ordered list of footer lines; empty list if no footers found.
Get the values of all footer lines with the given key. footer key to find values of, case insensitive. values of footers with key of , ordered by their order of appearance. Duplicates may be returned if the same footer appeared more than once. Empty list if no footers appear with the specified key, or there are no footers at all. Get the values of all footer lines with the given key. footer key to find values of, case insensitive. values of footers with key of , ordered by their order of appearance. Duplicates may be returned if the same footer appeared more than once. Empty list if no footers appear with the specified key, or there are no footers at all. Reset this commit to allow another RevWalk with the same instances. Subclasses must call base.reset() to ensure the basic information can be correctly cleared out. Gets the time from the "committer " line of the buffer. Obtain an array of all parents (NOTE - THIS IS NOT A COPY). This method is exposed only to provide very fast, efficient access to this commit's parent list. Applications relying on this list should be very careful to ensure they do not modify its contents during their use of it. Get a reference to this commit's tree. Gets the number of parent commits listed in this commit. Obtain the raw unparsed commit body (NOTE - THIS IS NOT A COPY). This method is exposed only to provide very fast, efficient access to this commit's message buffer within a RevFilter. Applications relying on this buffer should be very careful to ensure they do not modify its contents during their use of it. This property returns the raw unparsed commit body. This is NOT A COPY. Altering the contents of this buffer may alter the walker's knowledge of this commit, and the results it produces. Determine the encoding of the commit message buffer. Locates the "encoding" header (if present) and then returns the proper character set to apply to this buffer to evaluate its contents as character data. If no encoding header is present, is assumed. The preferred encoding of . Obtain the lane this commit has been plotted into. the assigned lane for this commit. Create a new commit. the identity of this commit. the tags associated with this commit, null for no tags Get the number of child commits listed in this commit. number of children; always a positive value but can be 0. Get the nth child from this commit's child list. child index to obtain. Must be in the range 0 through () - 1 the specified child. Determine if the given commit is a child (descendant) of this commit. the commit to test. true if the given commit built on top of this commit. An ordered list of subclasses. Commits are allocated into lanes as they enter the list, based upon their connections between descendant (child) commits and ancestor (parent) commits. The source of the list must be a {@link PlotWalk} and {@link #fillTo(int)} must be used to populate the list. An ordered list of subclasses. type of subclass of RevCommit the list is storing. An ordered list of subclasses. Type of subclass of RevObject the list is storing. Create an empty object list. Items stored in this list. If = 0 this block holds the list elements; otherwise it holds pointers to other {@link Block} instances which use a shift that is smaller. Current number of elements in the list. One level of contents, either an intermediate level or a leaf level. Returns an enumerator that iterates through the collection. A that can be used to iterate through the collection. 1 Returns an enumerator that iterates through a collection. An object that can be used to iterate through the collection. 2 Apply a flag to all commits matching the specified filter. applyFlag(matching, flag, 0, size()), but without the incremental behavior. the filter to test commits with. If the filter includes a commit it will have the flag set; if the filter does not include the commit the flag will be unset. revision filter needed to Read additional objects, but an error occurred while reading the pack files or loose objects of the repository. Apply a flag to all commits matching the specified filter. This version allows incremental testing and application, such as from a background thread that needs to periodically halt processing and send updates to the UI. the filter to test commits with. If the filter includes a commit it will have the flag set; if the filter does not include the commit the flag will be unset. the flag to Apply (or remove). Applications are responsible for allocating this flag from the source RevWalk. first commit within the list to begin testing at, inclusive. Must not be negative, but may be beyond the end of the list. last commit within the list to end testing at, exclusive. If smaller than or equal to rangeBegin then no commits will be tested. Revision filter needed to Read additional objects, but an error occurred while reading the pack files or loose objects of the repository. Remove the given flag from all commits. Same as clearFlag(flag, 0, size()), but without the incremental behavior. the flag to remove. Applications are responsible for allocating this flag from the source . Remove the given flag from all commits. This method is actually implemented in terms of: applyFlag(RevFilter.NONE, flag, rangeBegin, rangeEnd). The flag to remove. Applications are responsible for allocating this flag from the source . First commit within the list to begin testing at, inclusive. Must not be negative, but may be beyond the end of the list. Last commit within the list to end testing at, exclusive. If smaller than or equal to rangeBegin then no commits will be tested. Find the next commit that has the given flag set. the flag to test commits against. First commit index to test at. Applications may wish to begin at 0, to test the first commit in the list. Index of the first commit at or After index begin that has the specified flag set on it; -1 if no match is found. Find the next commit that has the given flag set. the flag to test commits against. First commit index to test at. Applications may wish to begin at size()-1, to test the last commit in the list. Index of the first commit at or before index begin that has the specified flag set on it; -1 if no match is found. Set the revision walker this list populates itself from. the walker to populate from. Ensure this list contains at least a specified number of commits. The revision walker specified by is pumped until the given number of commits are contained in this list. If there are fewer total commits available from the walk then the method will return early. Callers can test the size of the list by to determine if the high water mark specified was met. Number of commits the caller wants this list to contain when the fill operation is complete. Optional callback invoked when commits enter the list by fillTo. This method is only called during . the list position this object will appear at. the object being added (or set) into the list. Is this list still pending more items? true if might be able to extend the list size when called. Find the set of lanes passing through a commit's row. Lanes passing through a commit are lanes that the commit is not directly on, but that need to travel through this commit to connect a descendant (child) commit to an ancestor (parent) commit. Typically these lanes will be drawn as lines in the passed commit's box, and the passed commit won't appear to be connected to those lines. This method modifies the passed collection by adding the lanes in any order. the commit the caller needs to get the lanes from. collection to add the passing lanes into. a new Lane appropriate for this particular PlotList. Return colors and other reusable information to the plotter when a lane is no longer needed. A line space within the graph. Commits are strung onto a lane. For many UIs a lane represents a column. Logical location of this lane within the graphing plane. location of this lane, 0 through the maximum number of lanes. Specialized RevWalk for visualization of a commit graph. Walks a commit graph and produces the matching commits in order. A RevWalk instance can only be used once to generate results. Running a second time requires creating a new RevWalk instance, or invoking before starting again. Resetting an existing instance may be faster for some applications as commit body parsing can be avoided on the later invocations. RevWalk instances are not thread-safe. Applications must either restrict usage of a RevWalk instance to a single thread, or implement their own synchronization at a higher level. Multiple simultaneous RevWalk instances per are permitted, even from concurrent threads. Equality of s from two different RevWalk instances is never true, even if their s are equal (and thus they describe the same commit). The offered iterator is over the list of RevCommits described by the configuration of this instance. Applications should restrict themselves to using either the provided Iterator or , but never use both on the same RevWalk at the same time. The Iterator may buffer RevCommits, while does not. Set on objects whose important header data has been loaded. For a RevCommit this indicates we have pulled apart the tree and parent references from the raw bytes available in the repository and translated those to our own local RevTree and RevCommit instances. The raw buffer is also available for message and other header filtering. For a RevTag this indicates we have pulled part the tag references to find out who the tag refers to, and what that object's type is. Set on RevCommit instances added to our queue. We use this flag to avoid adding the same commit instance twice to our queue, especially if we reached it by more than one path. Set on RevCommit instances the caller does not want output. We flag commits as uninteresting if the caller does not want commits reachable from a commit given to . This flag is always carried into the commit's parents and is a key part of the "rev-list B --not A" feature; A is marked UNINTERESTING. Set on a RevCommit that can collapse out of the history. If the concluded that this commit matches his parents' for all of the paths that the filter is interested in then we mark the commit REWRITE. Later we can rewrite the parents of a REWRITE child to remove chains of REWRITE commits before we produce the child to the application. Temporary mark for use within generators or filters. This mark is only for local use within a single scope. If someone sets the mark they must unset it before any other code can see the mark. Temporary mark for use within . This mark indicates the commit could not produce when it wanted to, as at least one child was behind it. Commits with this flag are delayed until all children have been output first. Create a new revision walker for a given repository. The repository the walker will obtain data from. Mark a commit to start graph traversal from. Callers are encouraged to use to obtain the commit reference, rather than , as this method requires the commit to be parsed before it can be added as a root for the traversal. The method will automatically parse an unparsed commit, but error handling may be more difficult for the application to explain why a is not actually a commit. The object pool of this walker would also be 'poisoned' by the non-commit RevCommit. The commit to start traversing from. The commit passed must be from this same revision walker. The commit supplied is not available from the object database. This usually indicates the supplied commit is invalid, but the reference was constructed during an earlier invocation to . The object was not parsed yet and it was discovered during parsing that it is not actually a commit. This usually indicates the caller supplied a non-commit SHA-1 to . Mark a commit to start graph traversal from. Callers are encouraged to use to obtain the commit reference, rather than , as this method requires the commit to be parsed before it can be added as a root for the traversal. The method will automatically parse an unparsed commit, but error handling may be more difficult for the application to explain why a is not actually a commit. The object pool of this walker would also be 'poisoned' by the non-commit RevCommit. Commits to start traversing from. The commits passed must be from this same revision walker. The commit supplied is not available from the object database. This usually indicates the supplied commit is invalid, but the reference was constructed during an earlier invocation to . The object was not parsed yet and it was discovered during parsing that it is not actually a commit. This usually indicates the caller supplied a non-commit SHA-1 to . Mark a commit to not produce in the output. Uninteresting commits denote not just themselves but also their entire ancestry chain, back until the merge base of an uninteresting commit and an otherwise interesting commit. Callers are encouraged to use to obtain the commit reference, rather than , as this method requires the commit to be parsed before it can be added as a root for the traversal. The method will automatically parse an unparsed commit, but error handling may be more difficult for the application to explain why a RevCommit is not actually a commit. The object pool of this walker would also be 'poisoned' by the non-commit RevCommit. The commit to start traversing from. The commit passed must be from this same revision walker. The commit supplied is not available from the object database. This usually indicates the supplied commit is invalid, but the reference was constructed during an earlier invocation to . the object was not parsed yet and it was discovered during parsing that it is not actually a commit. This usually indicates the caller supplied a non-commit SHA-1 to . a pack file or loose object could not be read. Determine if a commit is reachable from another commit. A commit base is an ancestor of tip if we can find a path of commits that leads from tip and ends at base. This utility function resets the walker, inserts the two supplied commits, and then executes a walk until an answer can be obtained. Currently allocated RevFlags that have been added to RevCommit instances will be retained through the reset. commit the caller thinks is reachable from tip. commit to start iteration from, and which is most likely a descendant (child) of base. true if there is a path directly from tip to base (and thus base is fully merged into tip); false otherwise. one or or more of the next commit's parents are not available from the object database, but were thought to be candidates for traversal. This usually indicates a broken link. one or or more of the next commit's parents are not actually commit objects. a pack file or loose object could not be read. Pop the next most recent commit. Next most recent commit; null if traversal is over. one or or more of the next commit's parents are not available from the object database, but were thought to be candidates for traversal. This usually indicates a broken link. one or or more of the next commit's parents are not actually commit objects. a pack file or loose object could not be read. Check whether the provided sorting strategy is enabled. a sorting strategy to look for. True if this strategy is enabled, false otherwise Select a single sorting strategy for the returned commits. Disables all sorting strategies, then enables only the single strategy supplied by the caller. a sorting strategy to enable. Add or remove a sorting strategy for the returned commits. Multiple strategies can be applied at once, in which case some strategies may take precedence over others. As an example, must take precedence over , otherwise it cannot enforce its ordering. A sorting strategy to enable or disable. true if this strategy should be used, false if it should be removed. Get the currently configured commit filter. Return the current filter. Never null as a filter is always needed. Set the commit filter for this walker. Multiple filters may be combined by constructing an arbitrary tree of or instances to describe the boolean expression required by the application. Custom filter implementations may also be constructed by applications. Note that filters are not thread-safe and may not be shared by concurrent RevWalk instances. Every RevWalk must be supplied its own unique filter, unless the filter implementation specifically states it is (and always will be) thread-safe. Callers may use to create a unique filter tree for this RevWalk instance. The new filter. If null the special filter will be used instead, as it matches every commit. Get the tree filter used to simplify commits by modified paths. The current filter. Never null as a filter is always needed. If no filter is being applied is returned. Set the tree filter used to simplify commits by modified paths. If null or the path limiter is removed. Commits will not be simplified. If non-null and not then the tree filter will be installed and commits will have their ancestry simplified to hide commits that do not contain tree entries matched by the filter. Usually callers should be inserting a filter graph including along with one or more instances. New filter. If null the special filter will be used instead, as it matches everything. Should the body of a commit or tag be retained after parsing its headers? Usually the body is always retained, but some application code might not care and would prefer to discard the body of a commit as early as possible, to reduce memory usage. true if the body should be retained; false it is discarded. Set whether or not the body of a commit or tag is retained. If a body of a commit or tag is not retained, the application must call before the body can be safely accessed through the type specific access methods. True to retain bodies; false to discard them early. Locate a reference to a blob without loading it. The blob may or may not exist in the repository. It is impossible to tell from this method's return value. name of the blob object. Reference to the blob object. Never null. Locate a reference to a tree without loading it. The tree may or may not exist in the repository. It is impossible to tell from this method's return value. Name of the tree object. Reference to the tree object. Never null. Locate a reference to a commit without loading it. The commit may or may not exist in the repository. It is impossible to tell from this method's return value. name of the commit object. reference to the commit object. Never null. Locate a reference to any object without loading it. The object may or may not exist in the repository. It is impossible to tell from this method's return value. name of the object. type of the object. Must be a valid Git object type. Reference to the object. Never null. Locate a reference to a commit and immediately parse its content. Unlike this method only returns successfully if the commit object exists, is verified to be a commit, and was parsed without error. name of the commit object. reference to the commit object. Never null. the supplied commit does not exist. the supplied id is not a commit or an annotated tag. a pack file or loose object could not be read. Locate a reference to a tree. This method only returns successfully if the tree object exists, is verified to be a tree. Name of the tree object, or a commit or annotated tag that may reference a tree. Reference to the tree object. Never null. The supplied tree does not exist. The supplied id is not a tree, a commit or an annotated tag. A pack file or loose object could not be read. Locate a reference to any object and immediately parse its headers. This method only returns successfully if the object exists and was parsed without error. Parsing an object can be expensive as the type must be determined. For blobs this may mean the blob content was unpacked unnecessarily, and thrown away. Name of the object. Reference to the object. Never null. the supplied does not exist. a pack file or loose object could not be read. Ensure the object's critical headers have been parsed. This method only returns successfully if the object exists and was parsed without error. The object the caller needs to be parsed. The supplied does not exist. A pack file or loose object could not be read. * Ensure the object's fully body content is available. This method only returns successfully if the object exists and was parsed without error. the object the caller needs to be parsed. the supplied does not exist. a pack file or loose object could not be read. Create a new flag for application use during walking. Applications are only assured to be able to create 24 unique flags on any given revision walker instance. Any flags beyond 24 are offered only if the implementation has extra free space within its internal storage. description of the flag, primarily useful for debugging. newly constructed flag instance. too many flags have been reserved on this revision walker. Automatically carry a flag from a child commit to its parents. A carried flag is copied from the child commit onto its parents when the child commit is popped from the lowest level of walk's internal graph. The flag to carry onto parents, if set on a descendant. Automatically carry flags from a child commit to its parents. A carried flag is copied from the child commit onto its parents when the child commit is popped from the lowest level of walk's internal graph. The flags to carry onto parents, if set on a descendant. Allow a flag to be recycled for a different use. Recycled flags always come back as a different Java object instance when assigned again by . If the flag was previously being carried, the carrying request is removed. Disposing of a carried flag while a traversal is in progress has an undefined behavior. the to recycle. Resets internal state and allows this instance to be used again. Unlike previously acquired RevObject (and RevCommit) instances are not invalidated. RevFlag instances are not invalidated, but are removed from all RevObjects. Resets internal state and allows this instance to be used again. Unlike previously acquired RevObject (and RevCommit) instances are not invalidated. RevFlag instances are not invalidated, but are removed from all RevObjects. application flags that should not be cleared from existing commit objects. Resets internal state and allows this instance to be used again. Unlike previously acquired RevObject (and RevCommit) instances are not invalidated. RevFlag instances are not invalidated, but are removed from all RevObjects. application flags that should not be cleared from existing commit objects. Resets internal state and allows this instance to be used again. Unlike previously acquired RevObject (and RevCommit) instances are not invalidated. RevFlag instances are not invalidated, but are removed from all RevObjects. application flags that should not be cleared from existing commit objects. Returns an Iterator over the commits of this walker. The returned iterator is only useful for one walk. If this RevWalk gets reset a new iterator must be obtained to walk over the new results. Applications must not use both the Iterator and the API at the same time. Pick one API and use that for the entire walk. If a checked exception is thrown during the walk (see ) it is rethrown from the Iterator as a . an iterator over this walker's commits. Throws an exception if we have started producing output. Construct a new unparsed commit for the given object. the object this walker requires a commit reference for. a new unparsed reference for the object. Dispose all internal state and invalidate all RevObject instances. All RevObject (and thus RevCommit, etc.) instances previously acquired from this RevWalk are invalidated by a dispose call. Applications must not retain or use RevObject instances obtained prior to the dispose call. All RevFlag instances are also invalidated, and must not be reused. Get the repository this walker loads objects from. Obtain the sort types applied to the commits returned. The sorting strategies employed. At least one strategy is always used, but that strategy may be . Set on objects whose important header data has been loaded. For a RevCommit this indicates we have pulled apart the tree and parent references from the raw bytes available in the repository and translated those to our own local RevTree and RevCommit instances. The raw buffer is also available for message and other header filtering. For a RevTag this indicates we have pulled part the tag references to find out who the tag refers to, and what that object's type is. Set on RevCommit instances added to our queue. We use this flag to avoid adding the same commit instance twice to our queue, especially if we reached it by more than one path. Set on RevCommit instances the caller does not want output. We flag commits as uninteresting if the caller does not want commits reachable from a commit given to . This flag is always carried into the commit's parents and is a key part of the "rev-list B --not A" feature; A is marked UNINTERESTING. Set on a RevCommit that can collapse out of the history. If the concluded that this commit matches his parents' for all of the paths that the filter is interested in then we mark the commit REWRITE. Later we can rewrite the parents of a REWRITE child to remove chains of REWRITE commits before we produce the child to the application. Temporary mark for use within generators or filters. This mark is only for local use within a single scope. If someone sets the mark they must unset it before any other code can see the mark. Temporary mark for use within {@link TopoSortGenerator}. This mark indicates the commit could not produce when it wanted to, as at least one child was behind it. Commits with this flag are delayed until all children have been output first. Create a new revision walker for a given repository. the repository the walker will obtain data from. the list of knows tags referring to this commit Includes a commit only if all subfilters include the same commit. Classic shortcut behavior is used, so evaluation of the method stops as soon as a false result is obtained. Applications can improve filtering performance by placing faster filters that are more likely to reject a result earlier in the list. Selects interesting revisions during walking. This is an abstract interface. Applications may implement a subclass, or use one of the predefined implementations already available within this package. Filters may be chained together using and to create complex boolean expressions. Applications should install the filter on a RevWalk by prior to starting traversal. Unless specifically noted otherwise a RevFilter implementation is not thread safe and may not be shared by different RevWalk instances at the same time. This restriction allows RevFilter implementations to cache state within their instances during if it is beneficial to their implementation. Deep clones created by may be used to construct a thread-safe copy of an existing filter. Message filters:
  • Author name/email:
  • Committer name/email:
  • Message body:
Merge filters:
  • Skip all merges: .
Boolean modifiers:
  • AND:
  • OR:
  • NOT:
Default filter that always returns true (thread safe). Default filter that always returns false (thread safe). Excludes commits with more than one parent (thread safe). Selects only merge bases of the starting points (thread safe). This is a special case filter that cannot be combined with any other filter. Its include method always throws an exception as context information beyond the arguments is necessary to determine if the supplied commit is a merge base. Create a new filter that does the opposite of this filter. A new filter that includes commits this filter rejects. Determine if the supplied commit should be included in results. The active walker this filter is being invoked from within. The commit currently being tested. The commit has been parsed and its body is available for inspection. true to include this commit in the results; false to have this commit be omitted entirely from the results. The filter knows for certain that no additional commits can ever match, and the current commit doesn't match either. The walk is halted and no more results are provided. An object the filter needs to consult to determine its answer does not exist in the Git repository the Walker is operating on. Filtering this commit is impossible without the object. An object the filter needed to consult was not of the expected object type. This usually indicates a corrupt repository, as an object link is referencing the wrong type. A loose object or pack file could not be Read to obtain data necessary for the filter to make its decision. Clone this revision filter, including its parameters. This is a deep Clone. If this filter embeds objects or other filters it must also Clone those, to ensure the instances do not share mutable data. Another copy of this filter, suitable for another thread. Default filter that always returns false (thread safe). Excludes commits with more than one parent (thread safe). Selects only merge bases of the starting points (thread safe). This is a special case filter that cannot be combined with any other filter. Its include method always throws an exception as context information beyond the arguments is necessary to determine if the supplied commit is a merge base. Create a filter with two filters, both of which must match. First filter to test. Second filter to test. A filter that must match both input filters. Create a filter around many filters, all of which must match. List of filters to match against. Must contain at least 2 filters. A filter that must match all input filters. Create a filter around many filters, all of which must match. List of filters to match against. Must contain at least 2 filters. A filter that must match all input filters. Matches only commits whose author name matches the pattern. Create a new author filter. An optimized substring search may be automatically selected if the pattern does not contain any regular expression meta-characters. The search is performed using a case-insensitive comparison. The character encoding of the commit message itself is not respected. The filter matches on raw UTF-8 byte sequences. Regular expression pattern to match. A new filter that matches the given expression against the author name and address of a commit. Abstract filter that searches text using extended regular expressions. Encode a string pattern for faster matching on byte arrays. Force the characters to our funny UTF-8 only convention that we use on raw buffers. This avoids needing to perform character set decodes on the individual commit buffers. original pattern string supplied by the user or the application. Same pattern, but re-encoded to match our funny raw UTF-8 character sequence . Construct a new pattern matching filter. Text of the pattern. Callers may want to surround their pattern with ".*" on either end to allow matching in the middle of the string. Should .* be wrapped around the pattern of ^ and $ are missing? Most users will want this set. should be applied to the pattern before compiling it? flags from to control how matching performs. Obtain the raw text to match against. Current commit being evaluated. Sequence for the commit's content that we need to match on. Get the pattern this filter uses. The pattern this filter is applying to candidate strings. Abstract filter that searches text using only substring search. Can this string be safely handled by a substring filter? the pattern text proposed by the user. True if a substring filter can perform this pattern match; false if must be used instead. Construct a new matching filter. text to locate. This should be a safe string as described by the as regular expression meta characters are treated as literals. Obtain the raw text to match against. Current commit being evaluated. Sequence for the commit's content that we need to match on. Matches only commits whose committer name matches the pattern. Create a new committer filter. An optimized substring search may be automatically selected if the pattern does not contain any regular expression meta-characters. The search is performed using a case-insensitive comparison. The character encoding of the commit message itself is not respected. The filter matches on raw UTF-8 byte sequences. Regular expression pattern to match. A new filter that matches the given expression against the author name and address of a commit. Selects commits based upon the commit time field. Create a new filter to select commits before a given date/time. the point in time to cut on. a new filter to select commits on or before . Create a new filter to select commits After a given date/time. the point in time to cut on. a new filter to select commits on or After . Create a new filter to select commits after or equal a given date/time since and before or equal a given date/time until. the point in time to cut on. the point in time to cut off. a new filter to select commits between the given date/times. git internal time (seconds since epoch) git internal time (seconds since epoch) Matches only commits whose message matches the pattern. Create a message filter. An optimized substring search may be automatically selected if the pattern does not contain any regular expression meta-characters. The search is performed using a case-insensitive comparison. The character encoding of the commit message itself is not respected. The filter matches on raw UTF-8 byte sequences. Regular expression pattern to match. A new filter that matches the given expression against the message body of the commit. Includes a commit only if the subfilter does not include the commit. Create a filter that negates the result of another filter. Filter to negate. A filter that does the reverse of a. Includes a commit if any subfilters include the same commit. Classic shortcut behavior is used, so evaluation of the method stops as soon as a true result is obtained. Applications can improve filtering performance by placing faster filters that are more likely to accept a result earlier in the list. Create a filter with two filters, one of which must match. First filter to test. Second filter to test. A filter that must match at least one input filter. Create a filter around many filters, one of which must match. List of filters to match against. Must contain at least 2 filters. A filter that must match at least one input filter. Create a filter around many filters, one of which must match. List of filters to match against. Must contain at least 2 filters. A filter that must match at least one input filter. Matches only commits with some/all RevFlags already set. Create a new filter that tests for a single flag. The flag to test. Filter that selects only commits with flag . Create a new filter that tests all flags in a set. Set of flags to test. Filter that selects only commits with all flags in . Create a new filter that tests all flags in a set. Set of flags to test. filter that selects only commits with all flags in . Create a new filter that tests for any flag in a set. Set of flags to test. Filter that selects only commits with any flag in a. Create a new filter that tests for any flag in a set. Set of flags to test. Filter that selects only commits with any flag in a. Produces commits for RevWalk to return to applications. Implementations of this basic class provide the real work behind RevWalk. Conceptually a Generator is an iterator or a queue, it returns commits until there are no more relevant. Generators may be piped/stacked together to Create a more complex set of operations. @see PendingGenerator @see StartGenerator Connect the supplied queue to this generator's own free list (if any). Another FIFO queue that wants to share our queue's free list. Return the next commit to the application, or the next generator. Next available commit; null if no more are to be returned. * Obtain flags describing the output behavior of this generator. Commits are sorted by commit date and time, descending. Output may have marked on it. Output needs . Topological ordering is enforced (all children before parents). Output may have marked on it. Add a commit to the queue. This method always adds the commit, even if it is already in the queue or previously was in the queue but has already been removed. To control queue admission use . Commit to add. Add a commit if it does not have a flag set yet, then set the flag. This method permits the application to test if the commit has the given flag; if it does not already have the flag than the commit is added to the queue and the flag is set. This later will prevent the commit from being added twice. @param c commit to add. @param queueControl flag that controls admission to the queue. Add a commit's parents if one does not have a flag set yet. This method permits the application to test if the commit has the given flag; if it does not already have the flag than the commit is added to the queue and the flag is set. This later will prevent the commit from being added twice. commit whose parents should be added. flag that controls admission to the queue. Remove all entries from this queue. Current output flags set for this generator instance. Create an empty queue. Next block in our chain of blocks; null if we are the last. Our table of queued objects. Next valid entry in {@link #objects}. Next free entry in {@link #objects} for addition at. Create an empty revision queue. Create an empty revision queue. Reconfigure this queue to share the same free list as another. Multiple revision queues can be connected to the same free list, making it less expensive for applications to shuttle commits between them. This method arranges for the receiver to take from / return to the same free list as the supplied queue. Free lists are not thread-safe. Applications must ensure that all queues sharing the same free list are doing so from only a single thread. the other queue we will steal entries from. Next free entry in for addition at. Next valid entry in . Our table of queued commits. Next block in our chain of blocks; null if we are the last. A queue of commits sorted by commit time order. Create an empty date queue. Peek at the Next commit, without removing it. The Next available commit; null if there are no commits left. Delays commits to be at least {@link PendingGenerator#OVER_SCAN} late. This helps to "fix up" weird corner cases resulting from clock skew, by slowing down what we produce to the caller we get a better chance to ensure PendingGenerator reached back far enough in the graph to correctly mark commits {@link RevWalk#UNINTERESTING} if necessary. This generator should appear before {@link FixUninterestingGenerator} if the lower level {@link #pending} isn't already fully buffered. A queue of commits in FIFO order. Create an empty FIFO queue. Insert the commit pointer at the front of the queue. The commit to insert into the queue. Filters out commits marked . This generator is only in front of another generator that has fully buffered commits, such that we are called only After the has exhausted its input queue and given up. It skips over any uninteresting commits that may have leaked out of the PendingGenerator due to clock skew being detected in the commit objects. Case insensitive key for a . Standard Signed-off-by Standard Acked-by Standard CC Create a key for a specific footer line. Name of the footer line. Single line at the end of a message, such as a "Signed-off-by: someone". These footer lines tend to be used to represent additional information about a commit, like the path it followed through reviewers before finally being accepted into the project's main repository as an immutable commit. Key to test this line's key name against. true if code key.Name.Equals(Key, StringComparison.InvariantCultureIgnoreCase)). Extract the email address (if present) from the footer. If there is an email address looking string inside of angle brackets (e.g. "<a@b>"), the return value is the part extracted from inside the brackets. If no brackets are found, then is returned if the value contains an '@' sign. Otherwise, null. email address appearing in the value of this footer, or null. Key name of this footer; that is the text before the ":" on the line footer's line. The text is decoded according to the commit's specified (or assumed) character encoding. Value of this footer; that is the text after the ":" and any leading whitespace has been skipped. May be the empty string if the footer has no value (line ended with ":"). The text is decoded according to the commit's specified (or assumed) character encoding. A queue of commits in LIFO order. Create an empty LIFO queue. Computes the merge base(s) of the starting commits. This generator is selected if the RevFilter is only . To compute the merge base we assign a temporary flag to each of the starting commits. The maximum number of starting commits is bounded by the number of free flags available in the RevWalk when the generator is initialized. These flags will be automatically released on the next reset of the RevWalk, but not until then, as they are assigned to commits throughout the history. Several internal flags are reused here for a different purpose, but this should not have any impact as this generator should be run alone, and without any other generators wrapped around it. Specialized subclass of RevWalk to include trees, blobs and tags. Unlike RevWalk this subclass is able to remember starting roots that include annotated tags, or arbitrary trees or blobs. Once commit generation is complete and all commits have been popped by the application, individual annotated tag, tree and blob objects can be popped through the additional method . Tree and blob objects reachable from interesting commits are automatically scheduled for inclusion in the results of , returning each object exactly once. Objects are sorted and returned according to the the commits that reference them and the order they appear within a tree. Ordering can be affected by changing the used to order the commits that are returned first. Indicates a non-RevCommit is in . We can safely reuse here for the same value as it is only set on RevCommit and never has RevCommit instances inserted into it. Create a new revision and object walker for a given repository. The repository the walker will obtain data from. Mark an object or commit to start graph traversal from. Callers are encouraged to use instead of , as this method requires the object to be parsed before it can be added as a root for the traversal. The method will automatically parse an unparsed object, but error handling may be more difficult for the application to explain why a RevObject is not actually valid. The object pool of this walker would also be 'poisoned' by the invalid . This method will automatically call if passed RevCommit instance, or a that directly (or indirectly) references a . The object to start traversing from. The object passed must be from this same revision walker. The object supplied is not available from the object database. This usually indicates the supplied object is invalid, but the reference was constructed during an earlier invocation to . The object was not parsed yet and it was discovered during parsing that it is not actually the type of the instance passed in. This usually indicates the caller used the wrong type in a call. A pack file or loose object could not be Read. Mark an object to not produce in the output. Uninteresting objects denote not just themselves but also their entire reachable chain, back until the merge base of an uninteresting commit and an otherwise interesting commit. Callers are encouraged to use instead of , as this method requires the object to be parsed before it can be added as a root for the traversal. The method will automatically parse an unparsed object, but error handling may be more difficult for the application to explain why a RevObject is not actually valid. The object pool of this walker would also be 'poisoned' by the invalid . This method will automatically call if passed RevCommit instance, or a that directly (or indirectly) references a . The object to start traversing from. The object passed must be from this same revision walker. The object supplied is not available from the object database. This usually indicates the supplied object is invalid, but the reference was constructed during an earlier invocation to . The object was not parsed yet and it was discovered during parsing that it is not actually the type of the instance passed in. This usually indicates the caller used the wrong type in a call. A pack file or loose object could not be Read. Pop the next most recent object. next most recent object; null if traversal is over. One or or more of the next objects are not available from the object database, but were thought to be candidates for traversal. This usually indicates a broken link. One or or more of the objects in a tree do not match the type indicated. A pack file or loose object could not be Read. Verify all interesting objects are available, and reachable. Callers should populate starting points and ending points with and and then use this method to verify all objects between those two points exist in the repository and are readable. This method returns successfully if everything is connected; it throws an exception if there is a connectivity problem. The exception message provides some detail about the connectivity failure. One or or more of the next objects are not available from the object database, but were thought to be candidates for traversal. This usually indicates a broken link. One or or more of the objects in a tree do not match the type indicated. A pack file or loose object could not be Read. Get the current object's complete path. This method is not very efficient and is primarily meant for debugging and output generation. Applications should try to avoid calling it, and if invoked do so only once per interesting entry, where the name is absolutely required for correct function. Complete path of the current entry, from the root of the repository. If the current entry is in a subtree there will be at least one '/' in the returned string. Null if the current entry has no path, such as for annotated tags or root level trees. Default (and first pass) RevCommit Generator implementation for RevWalk. This generator starts from a set of one or more commits and process them in descending (newest to oldest) commit time order. Commits automatically cause their parents to be enqueued for further processing, allowing the entire commit graph to be walked. A may be used to select a subset of the commits and return them to the caller. Number of additional commits to scan After we think we are done. This small buffer of commits is scanned to ensure we didn't miss anything as a result of clock skew when the commits were made. We need to set our constant to 1 additional commit due to the use of a pre-increment operator when accessing the value. Last commit produced to the caller from {@link #Next()}. Number of commits we have remaining in our over-scan allotment. Only relevant if there are {@link #UNINTERESTING} commits in the {@link #_pending} queue. A binary file, or a symbolic link. Create a new blob reference. object name for the blob. Application level mark bit for s. Uninteresting by . We flag commits as uninteresting if the caller does not want commits reachable from a commit to . This flag is always carried into the commit's parents and is a key part of the "rev-list B --not A" feature; A is marked UNINTERESTING. This is a static flag. Its RevWalk is not available. Get the revision walk instance this flag was created from. Multiple application level mark bits for s. Create a set of flags. Create a set of flags. the set to copy flags from. Create a set of flags. the collection to copy flags from. Sorting strategies supported by {@link RevWalk} and {@link ObjectWalk}. No specific sorting is requested. Applications should not rely upon the ordering produced by this strategy. Any ordering in the output is caused by low level implementation details and may change without notice. Sort by commit time, descending (newest first, oldest last). This strategy can be combined with {@link #TOPO}. Topological sorting (all children before parents). This strategy can be combined with {@link #COMMIT_TIME_DESC}. Flip the output into the reverse ordering. This strategy can be combined with the others described by this type as it is usually performed at the very end. Include {@link RevFlag#UNINTERESTING} boundary commits After all others. In {@link ObjectWalk}, objects associated with such commits (trees, blobs), and all other objects marked explicitly as UNINTERESTING are also included. A boundary commit is a UNINTERESTING parent of an interesting commit that was previously output. An annotated tag. Create a new tag reference. Object name for the tag. Parse the tagger identity from the raw buffer. This method parses and returns the content of the tagger line, After taking the tag's character set into account and decoding the tagger name and email address. This method is fairly expensive and produces a new PersonIdent instance on each invocation. Callers should invoke this method only if they are certain they will be outputting the result, and should cache the return value for as long as necessary to use all information from it. Identity of the tagger (name, email) and the time the tag was made by the tagger; null if no tagger line was found. Parse the complete tag message and decode it to a string. This method parses and returns the message portion of the tag buffer, After taking the tag's character set into account and decoding the buffer using that character set. This method is a fairly expensive operation and produces a new string on each invocation. Decoded tag message as a string. Never null. Parse the tag message and return the first "line" of it. The first line is everything up to the first pair of LFs. This is the "oneline" format, suitable for output in a single line display. This method parses and returns the message portion of the tag buffer, After taking the tag's character set into account and decoding the buffer using that character set. This method is a fairly expensive operation and produces a new string on each invocation. Decoded tag message as a string. Never null. The returned string does not contain any LFs, even if the first paragraph spanned multiple lines. Embedded LFs are converted to spaces. Parse this tag buffer for display. revision walker owning this reference. parsed tag. Get a reference to the @object this tag was placed on. Object this tag refers to. Get the name of this tag, from the tag header. Name of the tag, according to the tag header. A reference to a tree of subtrees/files. Create a new tree reference. Object name for the tree. Replaces a 's parents until not colored with . Before a is returned to the caller its parents are updated to Create a dense DAG. Instead of reporting the actual parents as recorded when the commit was created the returned commit will reflect the Next closest commit that matched the revision walker's filters. This generator is the second phase of a path limited revision walk and assumes it is receiving RevCommits from , After they have been fully buffered by . The full buffering is necessary to allow the simple loop used within our own to pull completely through a strand of colored commits and come up with a simplification that makes the DAG dense. Not fully buffering the commits first would cause this loop to abort early, due to commits not being parsed and colored correctly. First phase of a path limited revision walk. This filter is ANDed to evaluate After all other filters and ties the configured into the revision walking process. Each commit is differenced concurrently against all of its parents to look for tree entries that are interesting to the TreeFilter. If none are found the commit is colored with , allowing a later pass implemented by to remove those colored commits from the DAG. Initial RevWalk generator that bootstraps a new walk. Initially RevWalk starts with this generator as its chosen implementation. The first request for a from the instance calls to our method, and we replace ourselves with the best implementation available based upon the current configuration. Sorts commits in topological order. Create a new sorter and completely spin the generator. When the constructor completes the supplied generator will have no commits remaining, as all of the commits will be held inside of this generator's internal buffer. Generator to pull all commits out of, and into this buffer. Base helper class for implementing operations connections. Represent connection for operation on a remote repository. Currently all operations on remote repository (fetch and push) provide information about remote refs. Every connection is able to be closed and should be closed - this is a connection client responsibility. Get a single advertised ref by name. The name supplied should be valid ref name. To get a peeled value for a ref (aka refs/tags/v1.0^{}) use the base name (without the ^{} suffix) and look at the peeled object id. name of the ref to obtain. the requested ref; null if the remote did not advertise this ref. Close any resources used by this connection. If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository. Get the complete map of refs advertised as available for fetching or pushing. Returns available/advertised refs: map of refname to ref. Never null. Not modifiable. The collection can be empty if the remote side has no refs (it is an empty/newly created repository). Get the complete list of refs advertised as available for fetching or pushing. The returned refs may appear in any order. If the caller needs these to be sorted, they should be copied into a new array or List and then sorted by the caller as necessary. Returns available/advertised refs. Never null. Not modifiable. The collection can be empty if the remote side has no refs (it is an empty/newly created repository). Denote the list of refs available on the remote repository. Implementors should invoke this method once they have obtained the refs that are available from the remote repository. the complete list of refs the remote has to offer. This map will be wrapped in an unmodifiable way to protect it, but it does not get copied. Helper method for ensuring one-operation per connection. Check whether operation was already marked as started, and mark it as started. Base helper class for fetch connection implementations. Provides some common typical structures and methods used during fetch connection. Implementors of fetch over pack-based protocols should consider using instead. Lists known refs from the remote and copies objects of selected refs. A fetch connection typically connects to the git-upload-pack service running where the remote repository is stored. This provides a one-way object transfer service to copy objects from the remote repository into this local repository. Instances of a FetchConnection must be created by a that implements a specific object transfer protocol that both sides of the connection understand. FetchConnection instances are not thread safe and may be accessed by only one thread at a time. Fetch objects we don't have but that are reachable from advertised refs.

Only one call per connection is allowed. Subsequent calls will result in .

Implementations are free to use network connections as necessary to efficiently (for both client and server) transfer objects from the remote repository into this repository. When possible implementations should avoid replacing/overwriting/duplicating an object already available in the local destination repository. Locally available objects and packs should always be preferred over remotely available objects and packs. should be honored if applicable.
progress monitor to inform the end-user about the amount of work completed, or to indicate cancellation. Implementations should poll the monitor at regular intervals to look for cancellation requests from the user. one or more refs advertised by this connection that the caller wants to store locally. additional objects known to exist in the destination repository, especially if they aren't yet reachable by the ref database. Connections should take this set as an addition to what is reachable through all Refs, not in replace of it.
Set the lock message used when holding a pack out of garbage collection. Callers that set a lock message must ensure they call after , even if an exception was thrown, and release the locks that are held. message to use when holding a pack in place. Did the last get tags? Some Git aware transports are able to implicitly grab an annotated tag if or was selected and the object the tag peels to (references) was transferred as part of the last call. If it is possible for such tags to have been included in the transfer this method returns true, allowing the caller to attempt tag discovery. By returning only true/false (and not the actual list of tags obtained) the transport itself does not need to be aware of whether or not tags were included in the transfer. Returns true if the last fetch call implicitly included tag objects; false if tags were not implicitly obtained. Did the last validate graph? Some transports walk the object graph on the client side, with the client looking for what objects it is missing and requesting them individually from the remote peer. By virtue of completing the fetch call the client implicitly tested the object connectivity, as every object in the graph was either already local or was requested successfully from the peer. In such transports this method returns true. Some transports assume the remote peer knows the Git object graph and is able to supply a fully connected graph to the client (although it may only be transferring the parts the client does not yet have). Its faster to assume such remote peers are well behaved and send the correct response to the client. In such transports this method returns false. Returns true if the last fetch had to perform a connectivity check on the client side in order to succeed; false if the last fetch assumed the remote peer supplied a complete graph. All locks created by the last call. Returns collection (possibly empty) of locks created by the last call to fetch. The caller must release these after refs are updated in order to safely permit garbage collection. Implementation of without checking for multiple fetch. as in as in as in Default implementation of - returning false. Base helper class for pack-based operations implementations. Provides partial implementation of pack-protocol - refs advertising and capabilities support, and some other helper methods. The repository this transport fetches into, or pushes out of. Remote repository location. A transport connected to . Buffered output stream sending to the remote. Buffered input stream reading from the remote. Packet line decoder around . Packet line encoder around . Send before closing ? Capability tokens advertised by the remote side. Extra objects the remote has, but which aren't offered as refs. Create an exception to indicate problems finding a remote repository. The caller is expected to throw the returned exception. Subclasses may override this method to provide better diagnostics. a TransportException saying a repository cannot be found and possibly why. Fetch implementation using the native Git pack transfer service. This is the canonical implementation for transferring objects from the remote repository to the local repository by talking to the 'git-upload-pack' service. Objects are packed on the remote side into a pack file and then sent down the pipe to us. This connection requires only a bi-directional pipe or socket, and thus is easily wrapped up into a local process pipe, anonymous TCP socket, or a command executed through an SSH tunnel. Concrete implementations should just call and methods in constructor or before any use. They should also handle resources releasing in method if needed. Maximum number of 'have' lines to send before giving up. During we send at most this many commits to the remote peer as 'have' lines without an ACK response before we give up. Amount of data the client sends before starting to read. Any output stream given to the client must be able to buffer this many bytes before the client will stop writing and start reading from the input stream. If the output stream blocks before this many bytes are in the send queue, the system will deadlock. All commits that are immediately reachable by a local ref. Marks an object as having all its dependencies. Marks a commit known to both sides of the connection. Marks a commit listed in the advertised refs. Parses a section of the configuration into an application model object. Instances must implement hashCode and equals such that model objects can be cached by using the as a key of a Dictionary. As the itself is used as the key of the internal Dictionary applications should be careful to ensure the SectionParser key does not retain unnecessary application state which may cause memory to be held longer than expected. type of the application model created by the parser. Git style .config, .gitconfig, .gitmodules file. Immutable current state of the configuration data. This state is copy-on-write. It should always contain an immutable list of the configuration keys/values. Magic value indicating a missing entry. This value is tested for reference equality in some contexts, so we must ensure it is a special copy of the empty string. It also must be treated like the empty string. Create a configuration with no default fallback. Create an empty configuration with a fallback for missing keys. the base configuration to be consulted when a key is missing from this configuration instance. Escape the value before saving The value to escape. The escaped value. Obtain an integer value from the configuration. Section the key is grouped within. Name of the key to get. Default value to return if no value was present. An integer value from the configuration, or . Obtain an integer value from the configuration. Section the key is grouped within. Subsection name, such a remote or branch name. Name of the key to get. Default value to return if no value was present. An integer value from the configuration, or . Obtain an integer value from the configuration. Section the key is grouped within. Subsection name, such a remote or branch name. Name of the key to get. Default value to return if no value was present. An integer value from the configuration, or . Get a boolean value from the git config. Section the key is grouped within. Name of the key to get. Default value to return if no value was present. True if any value or is true, false for missing or explicit false. Get a boolean value from the git config. Section the key is grouped within. Subsection name, such a remote or branch name. Name of the key to get. Default value to return if no value was present. True if any value or defaultValue is true, false for missing or explicit false. Get string value. The section. The subsection for the value. The key name. A value from git config. Get a list of string values If this instance was created with a base, the base's values are returned first (if any). The section. The subsection for the value. The key name. Array of zero or more values from the configuration. Section to search for. set of all subsections of specified section within this configuration and its base configuration; may be empty if no subsection exists. Obtain a handle to a parsed set of configuration values. Parser which can create the model if it is not already available in this configuration file. The parser is also used as the key into a cache and must obey the hashCode and equals contract in order to reuse a parsed model. The parsed object instance, which is cached inside this config. Type of configuration model to return. Remove a cached configuration object. If the associated configuration object has not yet been cached, this method has no effect. Parser used to obtain the configuration object. Add or modify a configuration value. The parameters will result in a configuration entry like this.
            [section "subsection"]
            name = value
            
Section name, e.g "branch" Optional subsection value, e.g. a branch name. Parameter name, e.g. "filemode". Parameter value.
Add or modify a configuration value. The parameters will result in a configuration entry like this.
            [section "subsection"]
            name = value
            
Section name, e.g "branch" Optional subsection value, e.g. a branch name. Parameter name, e.g. "filemode". Parameter value.
Add or modify a configuration value. The parameters will result in a configuration entry like this.
            [section "subsection"]
            name = value
            
Section name, e.g "branch" Optional subsection value, e.g. a branch name. Parameter name, e.g. "filemode". Parameter value.
Add or modify a configuration value. The parameters will result in a configuration entry like this.
            [section "subsection"]
            name = value
            
Section name, e.g "branch" Optional subsection value, e.g. a branch name. Parameter name, e.g. "filemode". Parameter value.
Remove a configuration value. Section name, e.g "branch". Optional subsection value, e.g. a branch name. Parameter name, e.g. "filemode". Remove all configuration values under a single section. section name, e.g "branch" optional subsection value, e.g. a branch name Set a configuration value.
            [section "subsection"]
            name = value
            
Section name, e.g "branch". Optional subsection value, e.g. a branch name. Parameter name, e.g. "filemode". List of zero or more values for this key.
This configuration, formatted as a Git style text file. Clear this configuration and reset to the contents of the parsed string. Git style text file listing configuration properties. The text supplied is not formatted correctly. No changes were made to this. The configuration file entry. The key name. The text content before entry. The section name for the entry. Subsection name. The text content after entry. The value Parses a section of the configuration into an application model object. Instances must implement hashCode and equals such that model objects can be cached by using the as a key of a Dictionary. As the itself is used as the key of the internal Dictionary applications should be careful to ensure the SectionParser key does not retain unnecessary application state which may cause memory to be held longer than expected. type of the application model created by the parser. Create a model object from a configuration. The configuration to read values from. The application model instance. Push implementation using the native Git pack transfer service. This is the canonical implementation for transferring objects to the remote repository from the local repository by talking to the 'git-receive-pack' service. Objects are packed on the local side into a pack file and then sent to the remote repository. This connection requires only a bi-directional pipe or socket, and thus is easily wrapped up into a local process pipe, anonymous TCP socket, or a command executed through an SSH tunnel. This implementation honors option. Concrete implementations should just call and methods in constructor or before any use. They should also handle resources releasing in method if needed. Lists known refs from the remote and sends objects to the remote. A push connection typically connects to the git-receive-pack service running where the remote repository is stored. This provides a one-way object transfer service to copy objects from the local repository into the remote repository, as well as a way to modify the refs stored by the remote repository. Instances of a PushConnection must be created by a {@link Transport} that implements a specific object transfer protocol that both sides of the connection understand. PushConnection instances are not thread safe and may be accessed by only one thread at a time. Pushes to the remote repository basing on provided specification. This possibly result in update/creation/deletion of refs on remote repository and sending objects that remote repository need to have a consistent objects graph from new refs. Only one call per connection is allowed. Subsequent calls will result in . Implementation may use local repository to send a minimum set of objects needed by remote repository in efficient way. should be honored if applicable. refUpdates should be filled with information about status of each update. progress monitor to update the end-user about the amount of work completed, or to indicate cancellation. Implementors should poll the monitor at regular intervals to look for cancellation requests from the user. map of remote refnames to remote refs update specifications/statuses. Can't be empty. This indicate what refs caller want to update on remote side. Only refs updates with should passed. Implementation must ensure that and appropriate status with optional message should be set during call. No refUpdate with or can be leaved by implementation after return from this call. Objects could not be copied due to a network failure, critical protocol error, or error on remote side, or connection was already used for push - new connection must be created. Non-critical errors concerning only isolated refs should be placed in refUpdates. Time in milliseconds spent transferring the pack data. Fetch connection for bundle based classes. It used by instances of Creates a Git bundle file, for sneaker-net transport to another system. Bundles generated by this class can be later read in from a file URI using the bundle transport, or from an application controlled buffer by the more generic . Applications creating bundles need to call one or more include calls to reflect which objects should be available as refs in the bundle for the other side to fetch. At least one include is required to create a valid bundle file, and duplicate names are not permitted. Optional assume calls can be made to declare commits which the recipient must have in order to fetch from the bundle file. Objects reachable from these assumed commits can be used as delta bases in order to reduce the overall bundle size. Create a writer for a bundle. repository where objects are stored. operations progress monitor. Include an object (and everything reachable from it) in the bundle. name the recipient can discover this object as from the bundle's list of advertised refs . The name must be a valid ref format and must not have already been included in this bundle writer. object to pack. Multiple refs may point to the same object. Include a single ref (a name/object pair) in the bundle. This is a utility function for: include(r.getName(), r.getObjectId()). the ref to include. Assume a commit is available on the recipient's side. In order to fetch from a bundle the recipient must have any assumed commit. Each assumed commit is explicitly recorded in the bundle header to permit the recipient to validate it has these objects. the commit to assume being available. This commit should be parsed and not disposed in order to maximize the amount of debugging information available in the bundle stream. Generate and write the bundle to the output stream. This method can only be called once per BundleWriter instance. @param os the stream the bundle is written to. If the stream is not buffered it will be buffered by the writer. Caller is responsible for closing the stream. @throws IOException an error occurred reading a local object's data to include in the bundle, or writing compressed object data to the output stream. Basic daemon for the anonymous git:// transport protocol. Configure a daemon to listen on any available network port. Configure a new daemon for the specified network address. Address to listen for connections on. If null, any available port will be chosen on all network interfaces. * Lookup a supported service so it can be reconfigured. Name of the service; e.g. "receive-pack"/"git-receive-pack" or "upload-pack"/"git-upload-pack". The service; null if this daemon implementation doesn't support the requested service type. Add a single repository to the set that is exported by this daemon. The existence (or lack-thereof) of git-daemon-export-ok is ignored by this method. The repository is always published. name the repository will be published under. the repository instance. Recursively export all Git repositories within a directory. the directory to export. This directory must not itself be a git repository, but any directory below it which has a file named git-daemon-export-ok will be published. Start this daemon on a background thread. the server socket could not be opened. the daemon is already running. true if this daemon is receiving connections. Stop this daemon. Loads known hosts and private keys from $HOME/.ssh. This is the default implementation used by JGit and provides most of the compatibility necessary to match OpenSSH, a popular implementation of SSH used by C Git. If user interactivity is required by SSH (e.g. to obtain a password), the connection will immediately fail. The base session factory that loads known hosts and private keys from $HOME/.ssh. This is the default implementation used by JGit and provides most of the compatibility necessary to match OpenSSH, a popular implementation of SSH used by C Git. The factory does not provide UI behavior. Override the method to supply appropriate {@link UserInfo} to the session. Creates and destroys SSH connections to a remote system. Different implementations of the session factory may be used to control communicating with the end-user as well as reading their personal SSH configuration settings, such as known hosts and private keys. A must be returned to the factory that created it. Callers are encouraged to retain the SshSessionFactory for the duration of the period they are using the Session. Get the currently configured factory. A factory is always available. By default the factory will read from the user's $HOME/.ssh and assume OpenSSH compatibility. Change the JVM-wide factory to a different implementation. factory for future sessions to be created through. If null the default factory will be restored. Open (or reuse) a session to a host. A reasonable UserInfo that can interact with the end-user (if necessary) is installed on the returned session by this method. The caller must connect the session by invoking connect() if it has not already been connected. username to authenticate as. If null a reasonable default must be selected by the implementation. This may be System.getProperty("user.name"). optional user account password or passphrase. If not null a UserInfo that supplies this value to the SSH library will be configured. hostname (or IP address) to connect to. Must not be null. port number the server is listening for connections on. May be <= 0 to indicate the IANA registered port of 22 should be used. a session that can contact the remote host. Close (or recycle) a session to a host. a session previously obtained from this factory's method. Create a new JSch session for the requested address. host configuration login to authenticate as. server name to connect to. port number of the SSH daemon (typically 22). new session instance, but otherwise unconfigured. Provide additional configuration for the session based on the host information. This method could be used to supply {@link UserInfo}. host configuration session to configure Obtain the JSch used to create new sessions. host configuration the JSch instance to use. Returns the new default JSch implementation the new default JSch implementation Transport we will fetch over. List of things we want to fetch from the remote repository. Set of refs we will actually wind up asking to obtain. Objects we know we have locally. Updates to local tracking branches (if any). Records to be recorded into FETCH_HEAD. Final status after a successful fetch from a remote repository. Class holding result of operation on remote repository. This includes refs advertised by remote repo and local tracking refs updates. Get a single advertised ref by name. The name supplied should be valid ref name. To get a peeled value for a ref (aka refs/tags/v1.0^{}) use the base name (without the ^{} suffix) and look at the peeled object id. name of the ref to obtain. the requested ref; null if the remote did not advertise this ref. Get the status for a specific local tracking ref update. name of the local ref (e.g. "refs/remotes/origin/master"). status of the local ref; null if this local ref was not touched during this operation. Get the URI this result came from. Each transport instance connects to at most one URI at any point in time. Returns the URI describing the location of the remote repository. Get the complete list of refs advertised by the remote. The returned refs may appear in any order. If the caller needs these to be sorted, they should be copied into a new array or List and then sorted by the caller as necessary. Returns available/advertised refs. Never null. Not modifiable. The collection can be empty if the remote side has no refs (it is an empty/newly created repository). Get the status of all local tracking refs that were updated. unmodifiable collection of local updates. Never null. Empty if there were no local tracking refs updated. The base class for transports that use HTTP as underlying protocol. This class allows customizing HTTP connection settings. Connects two Git repositories together and copies objects between them. A transport can be used for either fetching (copying objects into the caller's repository from the remote repository) or pushing (copying objects into the remote repository from the caller's repository). Each transport implementation is responsible for the details associated with establishing the network connection(s) necessary for the copy, as well as actually shuffling data back and forth. Transport instances and the connections they Create are not thread-safe. Callers must ensure a transport is accessed by only one thread at a time. Default setting for option. Default setting for option. Open a new transport instance to connect two repositories. This method assumes . existing local repository. location of the remote repository - may be URI or remote configuration name. the new transport instance. Never null. In case of multiple URIs in remote configuration, only the first is chosen. Open a new transport instance to connect two repositories. existing local repository. location of the remote repository - may be URI or remote configuration name. planned use of the returned Transport; the URI may differ based on the type of connection desired. the new transport instance. Never null. In case of multiple URIs in remote configuration, only the first is chosen. Open new transport instances to connect two repositories. This method assumes . existing local repository. location of the remote repository - may be URI or remote configuration name. the list of new transport instances for every URI in remote configuration. Open new transport instances to connect two repositories. existing local repository. location of the remote repository - may be URI or remote configuration name. planned use of the returned Transport; the URI may differ based on the type of connection desired. the list of new transport instances for every URI in remote configuration. Open a new transport instance to connect two repositories. This method assumes . existing local repository. configuration describing how to connect to the remote repository. the new transport instance. Never null. In case of multiple URIs in remote configuration, only the first is chosen. Open a new transport instance to connect two repositories. existing local repository. configuration describing how to connect to the remote repository. planned use of the returned Transport; the URI may differ based on the type of connection desired. Open a new transport instance to connect two repositories. This method assumes . existing local repository. configuration describing how to connect to the remote repository. the list of new transport instances for every URI in remote configuration. Open new transport instances to connect two repositories. existing local repository. configuration describing how to connect to the remote repository. planned use of the returned Transport; the URI may differ based on the type of connection desired. the list of new transport instances for every URI in remote configuration. Open a new transport instance to connect two repositories. existing local repository. location of the remote repository. the new transport instance. Never null. Convert push remote refs update specification from form to . Conversion expands wildcards by matching source part to local refs. expectedOldObjectId in RemoteRefUpdate is always set as null. Tracking branch is configured if RefSpec destination matches source of any fetch ref spec for this transport remote configuration. local database. collection of RefSpec to convert. fetch specifications used for finding localtracking refs. May be null or empty collection. collection of set up . Specification for fetch or push operations, to fetch or push all tags. Acts as --tags. Specification for push operation, to push all refs under refs/heads. Acts as --all The repository this transport fetches into, or pushes out of. The URI used to create this transport. Name of the upload pack program, if it must be executed. Specifications to apply during fetch. How should handle tags. We default to so as to avoid fetching annotated tags during one-shot fetches used for later merges. This prevents dragging down tags from repositories that we do not have established tracking branches for. If we do not track the source repository, we most likely do not care about any tags it publishes. Should fetch request thin-pack if remote repository can produce it. Name of the receive pack program, if it must be executed. Specifications to apply during push. Should push produce thin-pack when sending objects to remote repository. Should push just check for operation result, not really push. Should an incoming (fetch) transfer validate objects? Should refs no longer on the source be pruned from the destination? Timeout in seconds to wait before aborting an IO read or write. Create a new transport instance. the repository this instance will fetch into, or push out of. This must be the repository passed to . the URI used to access the remote repository. This must be the URI passed to . Apply provided remote configuration on this transport. configuration to apply on this transport. Fetch objects and refs from the remote repository to the local one. This is a utility function providing standard fetch behavior. Local tracking refs associated with the remote repository are automatically updated if this transport was created from a with fetch RefSpecs defined. progress monitor to inform the user about our processing activity. Must not be null. Use if progress updates are not interesting or necessary. specification of refs to fetch locally. May be null or the empty collection to use the specifications from the RemoteConfig. Source for each RefSpec can't be null. information describing the tracking refs updated. Push objects and refs from the local repository to the remote one. This is a utility function providing standard push behavior. It updates remote refs and send there necessary objects according to remote ref update specification. After successful remote ref update, associated locally stored tracking branch is updated if set up accordingly. Detailed operation result is provided after execution. For setting up remote ref update specification from ref spec, see helper method , predefined refspecs (, ) or consider using directly for more possibilities. When is true, result of this operation is just estimation of real operation result, no real action is performed. progress monitor to inform the user about our processing activity. Must not be null. Use if progress updates are not interesting or necessary. specification of refs to push. May be null or the empty collection to use the specifications from the RemoteConfig converted by . No more than 1 RemoteRefUpdate with the same remoteName is allowed. These objects are modified during this call. information about results of remote refs updates, tracking refs updates and refs advertised by remote repository. Convert push remote refs update specification from form to . Conversion expands wildcards by matching source part to local refs. expectedOldObjectId in RemoteRefUpdate is always set as null. Tracking branch is configured if RefSpec destination matches source of any fetch ref spec for this transport remote configuration. Conversion is performed for context of this transport (database, fetch specifications). collection of RefSpec to convert. collection of set up . Begins a new connection for fetching from the remote repository. a fresh connection to fetch from the remote repository. Begins a new connection for pushing into the remote repository. a fresh connection to push into the remote repository. Close any resources used by this transport. If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository. Get the URI this transport connects to. Each transport instance connects to at most one URI at any point in time. Returns the URI describing the location of the remote repository. name of the remote executable providing upload-pack service (typically "git-upload-pack"). description of how annotated tags should be treated during fetch. thin-pack preference for fetch operation. Default setting is: . true to enable checking received objects; false to assume all received objects are valid. remote executable providing receive-pack service for pack transports. Default setting is: thin-pack preference for push operation. Default setting is: . true when push should produce thin-pack in pack transports; false when it shouldn't. Whether or not to remove refs which no longer exist in the source. If true, refs at the destination repository (local for fetch, remote for push) are deleted if they no longer exist on the source side (remote for fetch, local for push). False by default, as this may cause data to become unreachable, and eventually be deleted on the next GC. true if push operation should just check for possible result and not really update remote refs, false otherwise - when push should act normally. number of seconds to wait (with no data transfer occurring) before aborting an IO read or write operation with this remote. Type of operation a Transport is being opened for. Transport is to fetch objects locally. Transport is to push objects remotely. Create a new transport instance. the repository this instance will fetch into, or push out of. This must be the repository passed to The URI used to access the remote repository. This must be the URI passed to . Indexes Git pack files for local use. Progress message when reading raw data from the pack. Progress message when computing names of delta compressed objects. Size of the internal stream buffer. If callers are going to be supplying IndexPack a BufferedInputStream they should use this buffer size as the size of the buffer for that BufferedInputStream, and any other its may be wrapping. This way the buffers will cascade efficiently and only the IndexPack buffer will be receiving the bulk of the data stream. Create an index pack instance to load a new pack into a repository. The received pack data and generated index will be saved to temporary files within the repository's objects directory. To use the data contained within them call once the indexing is complete. the repository that will receive the new pack. stream to read the pack data from. If the stream is buffered use as the buffer size for the stream. a new index pack instance. Object database used for loading existing objects If this is the last byte of the original checksum. Create a new pack indexer utility. stream to read the pack data from. If the stream is buffered use as the buffer size for the stream. Set the pack index file format version this instance will create. the version to write. The special version 0 designates the oldest (most compatible) format available for the objects. Configure this index pack instance to make a thin pack complete. Thin packs are sometimes used during network transfers to allow a delta to be sent without a base object. Such packs are not permitted on disk. They can be fixed by copying the base object onto the end of the pack. true to enable fixing a thin pack. Configure this index pack instance to keep an empty pack. By default an empty pack (a pack with no objects) is not kept, as doing so is completely pointless. With no objects in the pack there is no data stored by it, so the pack is unnecessary. true to enable keeping an empty pack. Configure this index pack instance to keep track of new objects. By default an index pack doesn't save the new objects that were created when it was instantiated. Setting this flag to {@code true} allows the caller to use {@link #getNewObjectIds()} to retrieve that list. True to enable keeping track of new objects. Configure this index pack instance to keep track of the objects assumed for delta bases. By default an index pack doesn't save the objects that were used as delta bases. Setting this flag to {@code true} will allow the caller to use getBaseObjectIds() to retrieve that list. True to enable keeping track of delta bases. the new objects that were sent by the user the set of objects the incoming pack assumed for delta purposes Configure the checker used to validate received objects. Usually object checking isn't necessary, as Git implementations only create valid objects in pack files. However, additional checking may be useful if processing data from an untrusted source. the checker instance; null to disable object checking. Configure the checker used to validate received objects. Usually object checking isn't necessary, as Git implementations only create valid objects in pack files. However, additional checking may be useful if processing data from an untrusted source. This is shorthand for:
            setObjectChecker(on ? new ObjectChecker() : null);
            
true to enable the default checker; false to disable it.
Consume data from the input stream until the packfile is indexed. progress feedback Cleanup all resources associated with our input parsing. Read one entire object or delta from the input. Current position of within the entire file. Consume exactly one byte from the buffer and return it. Consume exactly one byte from the buffer and return it. Consume cnt byte from the buffer. Ensure at least need bytes are available in in . Ensure at least need bytes are available in in . Store consumed bytes in up to . Rename the pack to it's final name and location and open it. If the call completes successfully the repository this IndexPack instance was created with will have the objects in the pack available for reading and use, without needing to scan for packs. Rename the pack to it's final name and location and open it. If the call completes successfully the repository this IndexPack instance was created with will have the objects in the pack available for reading and use, without needing to scan for packs. message to place in the pack-*.keep file. If null, no lock will be created, and this method returns null. the pack lock object, if lockMessage is not null. Marker interface an object transport using Git pack transfers. Implementations of PackTransport setup connections and move objects back and forth by creating pack files on the source side and indexing them on the receiving side. @see BasePackFetchConnection @see BasePackPushConnection A simple no-op hook. Hook invoked by {@link ReceivePack} after all updates are executed. The hook is called after all commands have been processed. Only commands with a status of {@link ReceiveCommand.Result#OK} are passed into the hook. To get all commands within the hook, see {@link ReceivePack#getAllCommands()}. Any post-receive hook implementation should not update the status of a command, as the command has already completed or failed, and the status has already been returned to the client. Hooks should execute quickly, as they block the server and the client from completing the connection. Invoked after all commands are executed and status has been returned. the process handling the current receive. Hooks may obtain details about the destination repository through this handle. unmodifiable set of successfully completed commands. May be the empty set. A simple no-op hook. Hook invoked by before any updates are executed. The hook is called with any commands that are deemed valid after parsing them from the client and applying the standard receive configuration options to them:
  • receive.denyDenyDeletes
  • receive.denyNonFastForwards
This means the hook will not receive a non-fast-forward update command if denyNonFastForwards is set to true in the configuration file. To get all commands within the hook, see . As the hook is invoked prior to the commands being executed, the hook may choose to block any command by setting its result status with . The hook may also choose to perform the command itself (or merely pretend that it has performed the command), by setting the result status to . Hooks should run quickly, as they block the caller thread and the client process from completing. Hooks may send optional messages back to the client via methods on . Implementors should be aware that not all network transports support this output, so some (or all) messages may simply be discarded. These messages should be advisory only.
Invoked just before commands are executed. See the class description for how this method can impact execution. the process handling the current receive. Hooks may obtain details about the destination repository through this handle. unmodifiable set of valid commands still pending execution. May be the empty set. Marker interface for transports that supports fetching from a git bundle (sneaker-net object transport). Push support for a bundle is complex, as one does not have a peer to communicate with to decide what the peer already knows. So push is not supported by the bundle transport. Marker interface for an object transport walking transport. Implementations of WalkTransport transfer individual objects one at a time from the loose objects directory, or entire packs if the source side does not have the object as a loose object. WalkTransports are not as efficient as {@link PackTransport} instances, but can be useful in situations where a pack transport is not acceptable. see Simple Map<long,Object> helper for . type of the value instance Simple configuration parser for the OpenSSH ~/.ssh/config file. Since JSch does not (currently) have the ability to parse an OpenSSH configuration file this is a simple parser to read that file and make the critical options available to {@link SshSessionFactory}. IANA assigned port number for SSH. Obtain the user's configuration data. The configuration file is always returned to the caller, even if no file exists in the user's home directory at the time the call was made. Lookup requests are cached and are automatically updated if the user modifies the configuration file since the last time it was cached. a caching reader of the user's configuration file. The user's home directory, as key files may be relative to here. The .ssh/config file we read and monitor for updates. Modification time of when loaded. Cached entries read out of the configuration file. Locate the configuration for a specific host request. the name the user has supplied to the SSH tool. This may be a real host name, or it may just be a "Host" block in the configuration file. configuration for the requested name. Never null. Configuration of one "Host" block in the configuration file. If returned from some or all of the properties may not be populated. The properties which are not populated should be defaulted by the caller. When returned from any wildcard entries which appear later in the configuration file will have been already merged into this block. the value StrictHostKeyChecking property, the valid values are "yes" (unknown hosts are not accepted), "no" (unknown hosts are always accepted), and "ask" (user should be asked before accepting the host) the real IP address or host name to connect to; never null. the real port number to connect to; never 0. path of the private key file to use for authentication; null if the caller should use default authentication strategies. the real user name to connect as; never null. the preferred authentication methods, separated by commas if more than one authentication method is preferred. true if batch (non-interactive) mode is preferred for this host connection. Description of an object stored in a pack file, including offset. When objects are stored in packs Git needs the ObjectId and the offset (starting position of the object data) to perform random-access reads of objects from the pack. This extension of ObjectId includes the offset. Create a new structure to remember information about an object. The identity of the object the new instance tracks. offset in pack when object has been already written, or 0 if it has not been written yet the 32 bit CRC checksum for the packed data. checksum of all packed data (including object type code, inflated length and delta base reference) as computed by NAK ACK ACK + continue ACK + common ACK + ready Write Git style pkt-line formatting to an output stream. This class is not thread safe and may issue multiple writes to the underlying stream for each method call made. This class performs no buffering on its own. This makes it suitable to interleave writes performed by this class with writes performed directly against the underlying OutputStream. Create a new packet line writer. stream Write a UTF-8 encoded string as a single length-delimited packet. string to write. Write a binary packet to the stream. the packet to write; the length of the packet is equal to the size of the byte array. Write a packet end marker, sometimes referred to as a flush command. Technically this is a magical packet type which can be detected separately from an empty string or an empty packet. Implicitly performs a flush on the underlying OutputStream to ensure the peer will receive all data written thus far. Flush the underlying OutputStream. Performs a flush on the underlying OutputStream to ensure the peer will receive all data written thus far. Class performing push operation on remote repository. Task name for used during opening connection. Transport used to perform this operation. Push operation connection created to perform this operation Refs to update on remote side. Revision walker for checking some updates properties. Create process for specified transport and refs updates specification. transport between remote and local repository, used to Create connection. specification of refs updates (and local tracking branches). Perform push operation between local and remote repository - set remote refs appropriately, send needed objects and update local tracking refs. When is true, result of this operation is just estimation of real operation result, no real action is performed. Progress monitor used for feedback about operation. result of push operation with complete status description. When push operation is not supported by provided transport. When some error occurred during operation, like I/O, protocol error, or local database consistency error. Result of push operation to the remote repository. Holding information of and remote refs updates status. see Get status of specific remote ref update by remote ref name. Together with it provide full description/status of this ref update. remote ref name status of remote ref update A command being processed by . This command instance roughly translates to the server side representation of the created by the client. Create a new command for . the old object id; must not be null. Use to indicate a ref creation. the new object id; must not be null. Use to indicate a ref deletion. name of the ref being affected. the old value the client thinks the ref has. the requested new value for this ref. the name of the ref being updated. the type of this command; see . the ref, if this was advertised by the connection. the current status code of this command. the message associated with a failure status. Set the status of this command. the new status code for this command. Set the status of this command. the new status code for this command. optional message explaining the new status. Type of operation requested. Create a new ref; the ref must not already exist. Update an existing ref with a fast-forward update. During a fast-forward update no changes will be lost; only new commits are inserted into the ref. Update an existing ref by potentially discarding objects. The current value of the ref is not fully reachable from the new value of the ref, so a successful command may result in one or more objects becoming unreachable. Delete an existing ref; the ref should already exist. Result of the update command. The command has not yet been attempted by the server. The server is configured to deny creation of this ref. The server is configured to deny deletion of this ref. The update is a non-fast-forward update and isn't permitted. The update affects HEAD and cannot be permitted. One or more objects aren't in the repository. This is severe indication of either repository corruption on the server side, or a bug in the client wherein the client did not supply all required objects during the pack transfer. Other failure; see . The ref could not be locked and updated atomically; try again. The change was completed successfully. Implements the server side of a push connection, receiving objects. Database we write the stored objects into. Revision traversal support over . Is the client connection a bi-directional socket or pipe? If true, this class assumes it can perform multiple read and write cycles with the client over the input and output streams. This matches the functionality available with a standard TCP/IP connection, or a local operating system or in-memory pipe. If false, this class runs in a read everything then output results mode, making it suitable for single round-trip systems RPCs such as HTTP. Should an incoming transfer validate objects? Should an incoming transfer permit create requests? Should an incoming transfer permit delete requests? Should an incoming transfer permit non-fast-forward requests? Identity to record action as within the reflog. Filter used while advertising the refs to the client. Hook to validate the update commands before execution. Hook to report on the commands after execution. The refs we advertised as existing at the start of the connection. Capabilities requested by the client. Commands to execute, as received by the client. An exception caught while unpacking and fsck'ing the objects. if has Lock around the received pack file, while updating refs. Create a new pack receive for an open repository. the destination repository. Returns the repository this receive completes into. Returns the RevWalk instance used by this connection. Returns all refs which were advertised to the client. Configure this receive pack instance to keep track of the objects assumed for delta bases. By default a receive pack doesn't save the objects that were used as delta bases. Setting this flag to {@code true} will allow the caller to use to retrieve that list. true to enable keeping track of delta bases. the set of objects the incoming pack assumed for delta purposes Configure this receive pack instance to keep track of new objects. By default a receive pack doesn't save the new objects that were created when it was instantiated. Setting this flag to {@code true} allows the caller to use {@link #getNewObjectIds()} to retrieve that list. true to enable keeping track of new objects. the new objects that were sent by the user true if this class expects a bi-directional pipe opened between the client and itself. The default is true. if true, this class will assume the socket is a fully bidirectional pipe between the two peers and takes advantage of that by first transmitting the known refs, then waiting to read commands. If false, this class assumes it must read the commands before writing output and does not perform the initial advertising. Returns true if this instance will verify received objects are formatted correctly. Validating objects requires more CPU time on this side of the connection. true to enable checking received objects; false to assume all received objects are valid. Returns true if the client can request refs to be created. true to permit create ref commands to be processed. Returns true if the client can request refs to be deleted. true to permit delete ref commands to be processed. Returns true if the client can request non-fast-forward updates of a ref, possibly making objects unreachable. true to permit the client to ask for non-fast-forward updates of an existing ref. Returns identity of the user making the changes in the reflog. Set the identity of the user appearing in the affected reflogs. The timestamp portion of the identity is ignored. A new identity with the current timestamp will be created automatically when the updates occur and the log records are written. identity of the user. If null the identity will be automatically determined based on the repository configuration. the filter used while advertising the refs to the client Set the filter used while advertising the refs to the client. Only refs allowed by this filter will be shown to the client. Clients may still attempt to create or update a reference hidden by the configured . These attempts should be rejected by a matching . the filter; may be null to show all refs. the hook invoked before updates occur. Set the hook which is invoked prior to commands being executed. Only valid commands (those which have no obvious errors according to the received input and this instance's configuration) are passed into the hook. The hook may mark a command with a result of any value other than to block its execution. The hook may be called with an empty command collection if the current set is completely invalid. the hook instance; may be null to disable the hook. the hook invoked after updates occur. Only successful commands (type is ) are passed into the Set the hook which is invoked after commands are executed. hook. The hook may be called with an empty command collection if the current set all resulted in an error. the hook instance; may be null to disable the hook. all of the command received by the current request. Send an error message to the client, if it supports receiving them. If the client doesn't support receiving messages, the message will be discarded, with no other indication to the caller or to the client. s should always try to use with a result status of to indicate any reasons for rejecting an update. Messages attached to a command are much more likely to be returned to the client. string describing the problem identified by the hook. The string must not end with an LF, and must not contain an LF. Send a message to the client, if it supports receiving them. If the client doesn't support receiving messages, the message will be discarded, with no other indication to the caller or to the client. string describing the problem identified by the hook. The string must not end with an LF, and must not contain an LF. Execute the receive task on the socket. Raw input to read client commands and pack data from. Caller must ensure the input is buffered, otherwise read performance may suffer. Response back to the Git network client. Caller must ensure the output is buffered, otherwise write performance may suffer. Secondary "notice" channel to send additional messages out through. When run over SSH this should be tied back to the standard error channel of the command execution. For most other network connections this should be null. Generate an advertisement of available refs and capabilities. the advertisement formatter. Support for the start of and . Initialize a new advertisement formatter. the RevWalk used to parse objects that are advertised. flag marked on any advertised objects parsed out of the 's object pool, permitting the caller to later quickly determine if an object was advertised (or not). Toggle tag peeling. This method must be invoked prior to any of the following: , , . true to show the dereferenced value of a tag as the special ref $tag^{} ; false to omit it from the output. Add one protocol capability to the initial advertisement. This method must be invoked prior to any of the following: , , . the name of a single protocol capability supported by the caller. The set of capabilities are sent to the client in the advertisement, allowing the client to later selectively enable features it recognizes. Format an advertisement for the supplied refs. zero or more refs to format for the client. The collection is sorted before display if necessary, and therefore may appear in any order. Advertise one object is available using the magic .have. The magic .have advertisement is not available for fetching by a client, but can be used by a client when considering a delta base candidate before transferring data in a push. Within the record created by this method the ref name is simply the invalid string .have. identity of the object that is assumed to exist. Include references of alternate repositories as {@code .have} lines. true if no advertisements have been sent yet. Advertise one object under a specific name. If the advertised object is a tag, this method does not advertise the peeled version of it. the object to advertise. name of the reference to advertise the object as, can be any string not including the NUL byte. Write a single advertisement line. the advertisement line to be written. The line always ends with LF. Never null or the empty string. Mark the end of the advertisements. Advertiser which frames lines in a {@link PacketLineOut} format. Create a new advertiser for the supplied stream. the output stream. The default filter, allows all refs to be shown. Filters the list of refs that are advertised to the client. The filter is called by {@link ReceivePack} and {@link UploadPack} to ensure that the refs are filtered before they are advertised to the client. This can be used by applications to control visibility of certain refs based on a custom set of rules. Filters a {@code Map} of refs before it is advertised to the client. the refs which this method need to consider. the filtered map of refs. Describes how refs in one repository copy into another repository. A ref specification provides matching support and limited rules to rewrite a reference in one repository to another reference in another repository. Suffix for wildcard ref spec component, that indicate matching all refs with specified prefix. Check whether provided string is a wildcard ref spec component. ref spec component - string to test. Can be null. true if provided string is a wildcard ref spec component. Construct an empty RefSpec. A newly created empty RefSpec is not suitable for use in most applications, as at least one field must be set to match a source name. Parse a ref specification for use during transport operations. Specifications are typically one of the following forms:
  • refs/head/master
  • refs/head/master:refs/remotes/origin/master
  • refs/head/*:refs/remotes/origin/*
  • +refs/head/master
  • +refs/head/master:refs/remotes/origin/master
  • +refs/head/*:refs/remotes/origin/*
  • :refs/head/master
string describing the specification.
Create a new RefSpec with a different force update setting. new value for force update in the returned instance. a new RefSpec with force update as specified. Create a new RefSpec with a different source name setting. new value for source in the returned instance. a new RefSpec with source as specified. Create a new RefSpec with a different destination name setting. new value for destination in the returned instance. a new RefSpec with destination as specified. Create a new RefSpec with a different source/destination name setting. new value for source in the returned instance. new value for destination in the returned instance. a new RefSpec with destination as specified. Does this specification's source description match the ref name? ref name that should be tested. true if the names match; false otherwise. Does this specification's source description match the ref? ref whose name should be tested. true if the names match; false otherwise. Does this specification's destination description match the ref name? ref name that should be tested. true if the names match; false otherwise. Does this specification's destination description match the ref? ref whose name should be tested. true if the names match; false otherwise. Expand this specification to exactly match a ref name. Callers must first verify the passed ref name matches this specification, otherwise expansion results may be unpredictable. a ref name that matched our source specification. Could be a wildcard also. a new specification expanded from provided ref name. Result specification is wildcard if and only if provided ref name is wildcard. Expand this specification to exactly match a ref. Callers must first verify the passed ref matches this specification, otherwise expansion results may be unpredictable. a ref that matched our source specification. Could be a wildcard also. a new specification expanded from provided ref name. Result specification is wildcard if and only if provided ref name is wildcard. Expand this specification to exactly match a ref name. Callers must first verify the passed ref name matches this specification, otherwise expansion results may be unpredictable. a ref name that matched our destination specification. Could be a wildcard also. a new specification expanded from provided ref name. Result specification is wildcard if and only if provided ref name is wildcard. Expand this specification to exactly match a ref. Callers must first verify the passed ref matches this specification, otherwise expansion results may be unpredictable. a ref that matched our destination specification. a new specification expanded from provided ref name. Result specification is wildcard if and only if provided ref name is wildcard. Check if this specification wants to forcefully update the destination. Returns true if this specification asks for updates without merge tests. Check if this specification is actually a wildcard pattern. If this is a wildcard pattern then the source and destination names returned by and will not be actual ref names, but instead will be patterns. Returns true if this specification could match more than one ref. Get the source ref description. During a fetch this is the name of the ref on the remote repository we are fetching from. During a push this is the name of the ref on the local repository we are pushing out from. Returns name (or wildcard pattern) to match the source ref. Get the destination ref description. During a fetch this is the local tracking branch that will be updated with the new ObjectId after fetching is complete. During a push this is the remote ref that will be updated by the remote's receive-pack process. If null during a fetch no tracking branch should be updated and the ObjectId should be stored transiently in order to prepare a merge. If null during a push, use instead. Returns name (or wildcard) pattern to match the destination ref. A remembered remote repository, including URLs and RefSpecs. A remote configuration remembers one or more URLs for a frequently accessed remote repository as well as zero or more fetch and push specifications describing how refs should be transferred between this repository and the remote repository. Default value for if not specified. Default value for if not specified. Parse all remote blocks in an existing configuration file, looking for remotes configuration. The existing configuration to get the remote settings from. The configuration must already be loaded into memory. All remotes configurations existing in provided repository configuration. Returned configurations are ordered lexicographically by names. Parse a remote block from an existing configuration file. This constructor succeeds even if the requested remote is not defined within the supplied configuration file. If that occurs then there will be no URIs and no ref specifications known to the new instance. the existing configuration to get the remote settings from. The configuration must already be loaded into memory. subsection key indicating the name of this remote. Update this remote's definition within the configuration. the configuration file to store ourselves into. Add a new URI to the end of the list of URIs. the new URI to add to this remote. true if the URI was added; false if it already exists. Remove a URI from the list of URIs. the URI to remove from this remote. true if the URI was added; false if it already exists. Add a new push-only URI to the end of the list of URIs. the new URI to add to this remote. true if the URI was added; false if it already exists. Remove a push-only URI from the list of URIs. the URI to remove from this remote. true if the URI was added; false if it already exists. Add a new fetch RefSpec to this remote. the new specification to add. true if the specification was added; false if it already exists. Override existing fetch specifications with new ones. list of fetch specifications to set. List is copied, it can be modified after this call. Override existing push specifications with new ones. list of push specifications to set. List is copied, it can be modified after this call. Remove a fetch RefSpec from this remote. the specification to remove. true if the specification existed and was removed. Add a new push RefSpec to this remote. the new specification to add. true if the specification was added; false if it already exists. Remove a push RefSpec from this remote. the specification to remove. true if the specification existed and was removed. Set the description of how annotated tags should be treated on fetch. method to use when handling annotated tags. local name this remote configuration is recognized as all configured URIs under this remote all configured push-only URIs under this remote. Remembered specifications for fetching from a repository. Remembered specifications for pushing to a repository. Override for the location of 'git-upload-pack' on the remote system. This value is only useful for an SSH style connection, where Git is asking the remote system to execute a program that provides the necessary network protocol. returns location of 'git-upload-pack' on the remote system. If no location has been configured the default of 'git-upload-pack' is returned instead. Override for the location of 'git-receive-pack' on the remote system. This value is only useful for an SSH style connection, where Git is asking the remote system to execute a program that provides the necessary network protocol. returns location of 'git-receive-pack' on the remote system. If no location has been configured the default of 'git-receive-pack' is returned instead. Get the description of how annotated tags should be treated during fetch. returns option indicating the behavior of annotated tags in fetch. mirror flag to automatically delete remote refs. true if pushing to the remote automatically deletes remote refs timeout before willing to abort an IO call. number of seconds to wait (with no data transfer occurring) before aborting an IO read or write operation with this remote. A timeout of 0 will block indefinitely. Represent request and status of a remote ref update. Specification is provided by client, while status is handled by class, being read-only for client. Client can create instances of this class directly, basing on user specification and advertised refs ({@link Connection} or through helper methods. Apply this specification on remote repository using method. Construct remote ref update request by providing an update specification. Object is created with default {@link Status#NOT_ATTEMPTED} status and no message. local repository to push from. source revision - any string resolvable by . This resolves to the new object that the caller want remote ref to be after update. Use null or string for delete request. full name of a remote ref to update, e.g. "refs/heads/master" (no wildcard, no short name). true when caller want remote ref to be updated regardless whether it is fast-forward update (old object is ancestor of new object). optional full name of a local stored tracking branch, to update after push, e.g. "refs/remotes/zawir/dirty" (no wildcard, no short name); null if no local tracking branch should be updated. optional object id that caller is expecting, requiring to be advertised by remote side before update; update will take place ONLY if remote side advertise exactly this expected id; null if caller doesn't care what object id remote side advertise. Use {@link ObjectId#zeroId()} when expecting no remote ref with this name. Create a new instance of this object basing on existing instance for configuration. State (like , ) of base object is not shared. Expected old object id is set up from scratch, as this constructor may be used for 2-stage push: first one being dry run, second one being actual push. configuration base. new expected object id value. Update locally stored tracking branch with the new object. walker used for checking update properties. expectedOldObjectId required to be advertised by remote side, as set in constructor; may be null. true if some object is required to be advertised by remote side, as set in constructor; false otherwise. newObjectId for remote ref, as set in constructor. true if this update is deleting update; false otherwise. name of remote ref to update, as set in constructor. local tracking branch update if localName was set in constructor. source revision as specified by user (in constructor), could be any string parseable by ; can be null if specified that way in constructor - this stands for delete request. true if user specified a local tracking branch for remote update; false otherwise. true if user specified a local tracking branch for remote update; false otherwise. status of remote ref update operation. Check whether update was fast-forward. Note that this result is meaningful only after successful update (when status is . true if update was fast-forward; false otherwise. message describing reasons of status when needed/possible; may be null. Represent current status of a remote ref update. Push process hasn't yet attempted to update this ref. This is the default status, prior to push process execution. Remote ref was up to date, there was no need to update anything. Remote ref update was rejected, as it would cause non fast-forward update. Remote ref update was rejected, because remote side doesn't support/allow deleting refs. Remote ref update was rejected, because old object id on remote repository wasn't the same as defined expected old object. Remote ref update was rejected for other reason, possibly described in . Remote ref didn't exist. Can occur on delete request of a non existing ref. Push process is awaiting update report from remote repository. This is a temporary state or state after critical error in push process. Remote ref was successfully updated. Multiplexes data and progress messages. This stream is buffered at packet sizes, so the caller doesn't need to wrap it in yet another buffered stream. Number of bytes in that are valid data. Initialized to if there is no application data in the buffer, as the packet header always appears at the start of the buffer. Create a new stream to write side band packets. channel number to prefix all packets with, so the remote side can demultiplex the stream and get back the original data. Must be in the range [0, 255]. maximum size of a data packet within the stream. The remote side needs to agree to the packet size to prevent buffer overflows. Must be in the range [HDR_SIZE + 1, MAX_BUF). stream that the packets are written onto. This stream should be attached to a SideBandInputStream on the remote side. We are forced to implement this interface member even though we don't need it We are forced to implement this interface member even though we don't need it We are forced to implement this interface member even though we don't need it We are forced to implement this interface member even though we don't need it We are forced to implement this interface member even though we don't need it We are forced to implement this interface member even though we don't need it We are forced to implement this interface member even though we don't need it We are forced to implement this interface member even though we don't need it Write progress messages out to the sideband channel. The base class for transports that use SSH protocol. This class allows customizing SSH connection settings. The base class for transports based on TCP sockets. This class holds settings common for all TCP based transports. Create a new transport instance. The repository this instance will fetch into, or push out of. This must be the repository passed to . the URI used to access the remote repository. This must be the URI passed to . Create a new transport instance. the repository this instance will fetch into, or push out of. This must be the repository passed to . the URI used to access the remote repository. This must be the URI passed to {@link #open(Repository, URIish)}. Initialize SSH session The open SSH session the SSH session factory that will be used for creating SSH sessions Specification of annotated tag behavior during fetch. Automatically follow tags if we fetch the thing they point at. This is the default behavior and tries to balance the benefit of having an annotated tag against the cost of possibly objects that are only on branches we care nothing about. Annotated tags are fetched only if we can prove that we already have (or will have when the fetch completes) the object the annotated tag peels (dereferences) to. Never fetch tags, even if we have the thing it points at. This option must be requested by the user and always avoids fetching annotated tags. It is most useful if the location you are fetching from publishes annotated tags, but you are not interested in the tags and only want their branches. Always fetch tags, even if we do not have the thing it points at. Unlike {@link #AUTO_FOLLOW} the tag is always obtained. This may cause hundreds of megabytes of objects to be fetched if the receiving repository does not yet have the necessary dependencies. Convert a command line/configuration file text into a value instance. the configuration file text value. the option that matches the passed parameter. Command line/configuration file text for this value. Update of a locally stored tracking branch. the name of the remote ref. Usually this is of the form "refs/heads/master". Get the name of the local tracking ref. Usually this is of the form "refs/remotes/origin/master". Get the new value the ref will be (or was) updated to. Null if the caller has not configured it. The old value of the ref, prior to the update being attempted. This value may differ before and after the update method. Initially it is populated with the value of the ref before the lock is taken, but the old value may change if someone else modified the ref between the time we last read it and when the ref was locked for update. Returns the value of the ref prior to the update being attempted; null if the updated has not been attempted yet. the status of this update. Single shot fetch from a streamed Git bundle. The bundle is Read from an unbuffered input stream, which limits the transport to opening at most one FetchConnection before needing to recreate the transport instance. Create a new transport to fetch objects from a streamed bundle. The stream can be unbuffered (buffering is automatically provided internally to smooth out short reads) and unpositionable (the stream is Read from only once, sequentially). When the FetchConnection or the this instance is closed the supplied input stream is also automatically closed. This frees callers from needing to keep track of the supplied stream. repository the fetched objects will be loaded into. symbolic name of the source of the stream. The URI can reference a non-existent resource. It is used only for exception reporting. the stream to Read the bundle from. Transport through a git-daemon waiting for anonymous TCP connections. This transport supports the git:// protocol, usually run on the IANA registered port 9418. It is a popular means for distributing open source projects, as there are no authentication or authorization overheads. Transport through an SSH tunnel. The SSH transport requires the remote side to have Git installed, as the transport logs into the remote system and executes a Git helper program on the remote side to read (or write) the remote repository's files. This transport does not support direct SCP style of copying files, as it assumes there are Git specific smarts on the remote side to perform object enumeration, save file modification and hook execution. the error stream for the channel, the stream is used to detect specific error reasons for exceptions. Transport over HTTP and FTP protocols. If the transport is using HTTP and the remote HTTP service is Git-aware (speaks the "smart-http protocol") this client will automatically take advantage of the additional Git-specific HTTP extensions. If the remote service does not support these extensions, the client will degrade to direct file fetching. If the remote (server side) repository does not have the specialized Git support, object files are retrieved directly through standard HTTP GET (or binary FTP GET) requests. This make it easy to serve a Git repository through a standard web host provider that does not offer specific support for Git. Transfers object data through a dumb transport. Implementations are responsible for resolving path names relative to the objects/ subdirectory of a single remote Git repository or naked object database and make the content available as a Java input stream for reading during fetch. The actual object traversal logic to determine the names of files to retrieve is handled through the generic, protocol independent . Obtain the list of available packs (if any). Pack names should be the file name in the packs directory, that is pack-035760ab452d6eebd123add421f253ce7682355a.pack. Index names should not be included in the returned collection. list of pack names; null or empty list if none are available. Obtain alternate connections to alternate object databases (if any). Alternates are typically read from the file or . The content of each line must be resolved by the implementation and a new database reference should be returned to represent the additional location. Alternates may reuse the same network connection handle, however the fetch connection will each created alternate. list of additional object databases the caller could fetch from; null or empty list if none are configured. Open a single file for reading. Implementors should make every attempt possible to ensure {@link FileNotFoundException} is used when the remote object does not exist. However when fetching over HTTP some misconfigured servers may generate a 200 OK status message (rather than a 404 Not Found) with an HTML formatted message explaining the requested resource does not exist. Callers such as are prepared to handle this by validating the content received, and assuming content that fails to match its hash is an incorrectly phrased FileNotFoundException. location of the file to read, relative to this objects directory (e.g. cb/95df6ab7ae9e57571511ef451cf33767c26dd2 or pack/pack-035760ab452d6eebd123add421f253ce7682355a.pack). a stream to read from the file. Never null. Create a new connection for a discovered alternate object database This method is typically called by when subclasses us the generic alternate parsing logic for their implementation of . the location of the new alternate, relative to the current object database. a new database connection that can read from the specified alternate. Close any resources used by this connection. If the remote repository is contacted by a network socket this method must close that network socket, disconnecting the two peers. If the remote repository is actually local (same system) this method must close any open file handles used to read the "remote" repository. Delete a file from the object database. Path may start with ../ to request deletion of a file that resides in the repository itself. When possible empty directories must be removed, up to but not includin the current object database directory itself. This method does not support deletion of directories. name of the item to be removed, relative to the current object database. Open a remote file for writing. Path may start with ../ to request writing of a file that resides in the repository itself. The requested path may or may not exist. If the path already exists as a file the file should be truncated and completely replaced. This method creates any missing parent directories, if necessary. name of the file to write, relative to the current object database. (optional) progress monitor to post write completion to during the stream's close method. (optional) task name to display during the close method. stream to write into this file. Caller must close the stream to complete the write request. The stream is not buffered and each write may cause a network request/response so callers should buffer to smooth out small writes. Atomically write a remote file. This method attempts to perform as atomic of an update as it can, reducing (or eliminating) the time that clients might be able to see partial file content. This method is not suitable for very large transfers as the complete content must be passed as an argument. Path may start with ../ to request writing of a file that resides in the repository itself. The requested path may or may not exist. If the path already exists as a file the file should be truncated and completely replaced. This method creates any missing parent directories, if necessary. name of the file to write, relative to the current object database. complete new content of the file. Delete a loose ref from the remote repository. name of the ref within the ref space, for example refs/heads/pu. Delete a reflog from the remote repository. name of the ref within the ref space, for example refs/heads/pu. Overwrite (or create) a loose ref in the remote repository. This method creates any missing parent directories, if necessary. name of the ref within the ref space, for example refs/heads/pu. new value to store in this ref. Must not be null. Rebuild the for dumb transport clients. This method rebuilds the contents of the file to match the passed list of pack names. names of available pack files, in the order they should appear in the file. Valid pack name strings are of the form pack-035760ab452d6eebd123add421f253ce7682355a.pack. Open a buffered reader around a file. This is shorthand for calling and then wrapping it in a reader suitable for line oriented files like the alternates list. location of the file to read, relative to this objects directory (e.g. info/packs). a stream to read from the file. Never null. Read a standard Git alternates file to discover other object databases. This method is suitable for reading the standard formats of the alternates file, such as found in objects/info/alternates or objects/info/http-alternates within a Git repository. Alternates appear one per line, with paths expressed relative to this object database. location of the alternate file to read, relative to this object database (e.g. info/alternates). the list of discovered alternates. Empty list if the file exists, but no entries were discovered. Read a standard Git packed-refs file to discover known references. return collection of references. Any existing entries will be replaced if they are found in the packed-refs file. Implements the server side of a fetch connection, transmitting objects. Database we read the objects from. Revision traversal support over . Timeout in seconds to wait for client interaction. Is the client connection a bi-directional socket or pipe? If true, this class assumes it can perform multiple read and write cycles with the client over the input and output streams. This matches the functionality available with a standard TCP/IP connection, or a local operating system or in-memory pipe. If false, this class runs in a read everything then output results mode, making it suitable for single round-trip systems RPCs such as HTTP. The refs we advertised as existing at the start of the connection. Filter used while advertising the refs to the client. Capabilities requested by the client. Objects the client wants to obtain. Objects the client wants to obtain. Objects on both sides, these don't have to be sent. null if should be examined again. Marked on objects we sent in our advertisement list. Marked on objects the client has asked us to give them. Marked on objects both we and the client have. Marked on objects in . Create a new pack upload for an open repository. the source repository. true if this class expects a bi-directional pipe opened between the client and itself. The default is true. if true, this class will assume the socket is a fully bidirectional pipe between the two peers and takes advantage of that by first transmitting the known refs, then waiting to read commands. If false, this class assumes it must read the commands before writing output and does not perform the initial advertising. the filter used while advertising the refs to the client Set the filter used while advertising the refs to the client. Only refs allowed by this filter will be sent to the client. This can be used by a server to restrict the list of references the client can obtain through clone or fetch, effectively limiting the access to only certain refs. the filter; may be null to show all refs. Execute the upload task on the socket. raw input to read client commands from. Caller must ensure the input is buffered, otherwise read performance may suffer. response back to the Git network client, to write the pack data onto. Caller must ensure the output is buffered, otherwise write performance may suffer. secondary "notice" channel to send additional messages out through. When run over SSH this should be tied back to the standard error channel of the command execution. For most other network connections this should be null. Generate an advertisement of available refs and capabilities. the advertisement formatter. the repository this upload is reading from. the RevWalk instance used by this connection. number of seconds to wait (with no data transfer occurring) before aborting an IO read or write operation with the connected client. This URI like construct used for referencing Git archives over the net, as well as locally stored archives. The most important difference compared to RFC 2396 URI's is that no URI encoding/decoding ever takes place. A space or any special character is written as-is. Construct a URIish from a standard URL. The source URL to convert from. Parse and construct an from a string Create an empty, non-configured URI. Return a new URI matching this one, but with a different host. the new value for host. a new URI with the updated value. Return a new URI matching this one, but with a different scheme. the new value for scheme. a new URI with the updated value. Return a new URI matching this one, but with a different path. the new value for path. a new URI with the updated value. Return a new URI matching this one, but with a different user. the new value for user. a new URI with the updated value. Return a new URI matching this one, but with a different password. the new value for password. A new URI with the updated value. Return a new URI matching this one, but with a different port. The new value for port. A new URI with the updated value. Obtain the string form of the URI, with the password included. The URI, including its password field, if any. Get the "humanish" part of the path. Some examples of a 'humanish' part for a full path: /path/to/repo.git -> repo /path/to/repo.git/ -> repo /path/to/repo/.git -> repo /path/to/repo/ -> repo /path//to -> an empty string the "humanish" part of the path. May be an empty string. Never null. Returns true if this URI references a repository on another system. Generic fetch support for dumb transport protocols. Since there are no Git-specific smarts on the remote side of the connection the client side must determine which objects it needs to copy in order to completely fetch the requested refs and their history. The generic walk support in this class parses each individual object (once it has been copied to the local repository) and examines the list of objects that must also be copied to create a complete history. Objects which are already available locally are retained (and not copied), saving bandwidth for incremental fetches. Pack files are copied from the remote repository only as a last resort, as the entire pack must be copied locally in order to access any single object. This fetch connection does not actually perform the object data transfer. Instead it delegates the transfer to a , which knows how to read individual files from the remote repository and supply the data as a standard Java InputStream. The repository this transport fetches into, or pushes out of. If not null the validator for received objects. List of all remote repositories we may need to get objects out of. The first repository in the list is the one we were asked to fetch from; the remaining repositories point to the alternate locations we can fetch objects through. Most recently used item in . Objects whose direct dependents we know we have (or will have). Objects that have already entered . Commits that have already entered . Commits already reachable from all local refs. Objects we need to copy from the remote repository. Databases we have not yet obtained the list of packs from. Databases we have not yet obtained the alternates from. Packs we have discovered, but have not yet fetched locally. Packs whose indexes we have looked at in . We try to avoid getting duplicate copies of the same pack through multiple alternates by only looking at packs whose names are not yet in this collection. Errors received while trying to obtain an object. If the fetch winds up failing because we cannot locate a specific object then we need to report all errors related to that object back to the caller as there may be cascading failures. Generic push support for dumb transport protocols. Since there are no Git-specific smarts on the remote side of the connection the client side must handle everything on its own. The generic push support requires being able to delete, create and overwrite files on the remote side, as well as create any missing directories (if necessary). Typically this can be handled through an FTP style protocol. Objects not on the remote side are uploaded as pack files, using one pack file per invocation. This simplifies the implementation as only two data files need to be written to the remote repository. Push support supplied by this class is not multiuser safe. Concurrent pushes to the same repository may yield an inconsistent reference database which may confuse fetch clients. A single push is concurrently safe with multiple fetch requests, due to the careful order of operations used to update the repository. Clients fetching may receive transient failures due to short reads on certain files if the protocol does not support atomic file replacement. see . The repository this transport pushes out of. Location of the remote repository we are writing to. Database connection to the remote repository. Packs already known to reside in the remote repository. Complete listing of refs the remote will have after our push. Updates which require altering the packed-refs file to complete. If this collection is non-empty then any refs listed in with a storage class of will be written. Writes out refs to the and files. This class is abstract as the writing of the files must be handled by the caller. This is because it is used by transport classes as well. the complete set of references. This should have been computed by applying updates to the advertised refs already discovered. the complete set of references. This should have been computed by applying updates to the advertised refs already discovered. Rebuild the . This method rebuilds the contents of the file to match the passed list of references. Rebuild the file. This method rebuilds the contents of the file to match the passed list of references, including only those refs that have a storage type of . Handles actual writing of ref files to the git repository, which may differ slightly depending on the destination and transport. path to ref file. byte content of file to be written. Includes a tree entry only if all subfilters include the same tree entry. Classic shortcut behavior is used, so evaluation of the {@link TreeFilter#include(TreeWalk)} method stops as soon as a false result is obtained. Applications can improve filtering performance by placing faster filters that are more likely to reject a result earlier in the list. Selects interesting tree entries during walking. This is an abstract interface. Applications may implement a subclass, or use one of the predefined implementations already available within this package. Unless specifically noted otherwise a TreeFilter implementation is not thread safe and may not be shared by different TreeWalk instances at the same time. This restriction allows TreeFilter implementations to cache state within their instances during {@link #include(TreeWalk)} if it is beneficial to their implementation. Deep clones created by {@link #Clone()} may be used to construct a thread-safe copy of an existing filter. Path filters:
  • Matching pathname: {@link PathFilter}
Difference filters:
  • Only select differences: {@link #ANY_DIFF}.
Boolean modifiers:
  • AND: {@link AndTreeFilter}
  • OR: {@link OrTreeFilter}
  • NOT: {@link NotTreeFilter}
Selects all tree entries. Selects only tree entries which differ between at least 2 trees. This filter also prevents a TreeWalk from recursing into a subtree if all parent trees have the identical subtree at the same path. This dramatically improves walk performance as only the changed subtrees are entered into. If this filter is applied to a walker with only one tree it behaves like {@link #ALL}, or as though the walker was matching a virtual empty tree against the single tree it was actually given. Applications may wish to treat such a difference as "all names added". Create a new filter that does the opposite of this filter. @return a new filter that includes tree entries this filter rejects. Determine if the current entry is interesting to report. This method is consulted for subtree entries even if {@link TreeWalk#isRecursive()} is enabled. The consultation allows the filter to bypass subtree recursion on a case-by-case basis, even when recursion is enabled at the application level. @param walker the walker the filter needs to examine. @return true if the current entry should be seen by the application; false to hide the entry. @throws MissingObjectException an object the filter needs to consult to determine its answer does not exist in the Git repository the walker is operating on. Filtering this current walker entry is impossible without the object. @throws IncorrectObjectTypeException an object the filter needed to consult was not of the expected object type. This usually indicates a corrupt repository, as an object link is referencing the wrong type. @throws IOException a loose object or pack file could not be Read to obtain data necessary for the filter to make its decision. Does this tree filter require a recursive walk to match everything? If this tree filter is matching on full entry path names and its pattern is looking for a '/' then the filter would require a recursive TreeWalk to accurately make its decisions. The walker is not required to enable recursive behavior for any particular filter, this is only a hint. @return true if the filter would like to have the walker recurse into subtrees to make sure it matches everything correctly; false if the filter does not require entering subtrees. Clone this tree filter, including its parameters. This is a deep Clone. If this filter embeds objects or other filters it must also Clone those, to ensure the instances do not share mutable data. @return another copy of this filter, suitable for another thread. Create a filter with two filters, both of which must match. @param a first filter to test. @param b second filter to test. @return a filter that must match both input filters. Create a filter around many filters, all of which must match. @param list list of filters to match against. Must contain at least 2 filters. @return a filter that must match all input filters. Create a filter around many filters, all of which must match. @param list list of filters to match against. Must contain at least 2 filters. @return a filter that must match all input filters. Includes an entry only if the subfilter does not include the entry. Create a filter that negates the result of another filter. @param a filter to negate. @return a filter that does the reverse of a. Includes a tree entry if any subfilters include the same tree entry. Classic shortcut behavior is used, so evaluation of the {@link TreeFilter#include(TreeWalk)} method stops as soon as a true result is obtained. Applications can improve filtering performance by placing faster filters that are more likely to accept a result earlier in the list. Create a filter with two filters, one of which must match. @param a first filter to test. @param b second filter to test. @return a filter that must match at least one input filter. Create a filter around many filters, one of which must match. @param list list of filters to match against. Must contain at least 2 filters. @return a filter that must match at least one input filter. Create a filter around many filters, one of which must match. @param list list of filters to match against. Must contain at least 2 filters. @return a filter that must match at least one input filter. Includes tree entries only if they match the configured path. Applications should use {@link PathFilterGroup} to connect these into a tree filter graph, as the group supports breaking out of traversal once it is known the path can never match. Create a new tree filter for a user supplied path. Path strings are relative to the root of the repository. If the user's input should be assumed relative to a subdirectory of the repository the caller must prepend the subdirectory's path prior to creating the filter. Path strings use '/' to delimit directories on all platforms. @param path the path to filter on. Must not be the empty string. All trailing '/' characters will be trimmed before string's Length is checked or is used as part of the constructed filter. @return a new filter for the requested path. @throws ArgumentException the path supplied was the empty string. Includes tree entries only if they match one or more configured paths. Operates like {@link PathFilter} but causes the walk to abort as soon as the tree can no longer match any of the paths within the group. This may bypass the bool logic of a higher level AND or OR group, but does improve performance for the common case of examining one or more modified paths. This filter is effectively an OR group around paths, with the early abort feature described above. Create a collection of path filters from Java strings. Path strings are relative to the root of the repository. If the user's input should be assumed relative to a subdirectory of the repository the caller must prepend the subdirectory's path prior to creating the filter. Path strings use '/' to delimit directories on all platforms. Paths may appear in any order within the collection. Sorting may be done internally when the group is constructed if doing so will improve path matching performance. @param paths the paths to test against. Must have at least one entry. @return a new filter for the list of paths supplied. Create a collection of path filters. Paths may appear in any order within the collection. Sorting may be done internally when the group is constructed if doing so will improve path matching performance. @param paths the paths to test against. Must have at least one entry. @return a new filter for the list of paths supplied. Includes tree entries only if they match the configured path. Create a new tree filter for a user supplied path. Path strings use '/' to delimit directories on all platforms. @param path the path (suffix) to filter on. Must not be the empty string. @return a new filter for the requested path. @throws IllegalArgumentException the path supplied was the empty string. Parses raw Git trees from the canonical semi-text/semi-binary format. First offset within {@link #_raw} of the prior entry. First offset within {@link #_raw} of the current entry's data. Offset one past the current entry (first byte of next entry). Create a new parser. Create a new parser for a tree appearing in a subset of a repository. @param prefix position of this iterator in the repository tree. The value may be null or the empty array to indicate the prefix is the root of the repository. A trailing slash ('/') is automatically appended if the prefix does not end in '/'. @param repo repository to load the tree data from. @param treeId identity of the tree being parsed; used only in exception messages if data corruption is found. @param curs a window cursor to use during data access from the repository. @throws MissingObjectException the object supplied is not available from the repository. @throws IncorrectObjectTypeException the object supplied as an argument is not actually a tree and cannot be parsed as though it were a tree. @throws IOException a loose object or pack file could not be Read. Reset this parser to walk through the given tree data. @param treeData the raw tree content. Reset this parser to walk through the given tree. @param repo repository to load the tree data from. @param id identity of the tree being parsed; used only in exception messages if data corruption is found. @param curs window cursor to use during repository access. @return the root level parser. @throws MissingObjectException the object supplied is not available from the repository. @throws IncorrectObjectTypeException the object supplied as an argument is not actually a tree and cannot be parsed as though it were a tree. @throws IOException a loose object or pack file could not be Read. Return this iterator, or its parent, if the tree is at eof. Reset this parser to walk through the given tree. @param repo repository to load the tree data from. @param id identity of the tree being parsed; used only in exception messages if data corruption is found. @param curs window cursor to use during repository access. @throws MissingObjectException the object supplied is not available from the repository. @throws IncorrectObjectTypeException the object supplied as an argument is not actually a tree and cannot be parsed as though it were a tree. @throws IOException a loose object or pack file could not be Read. Back door to quickly Create a subtree iterator for any subtree. Don't use this unless you are ObjectWalk. The method is meant to be called only once the current entry has been identified as a tree and its identity has been converted into an ObjectId. @param repo repository to load the tree data from. @param id ObjectId of the tree to open. @param curs window cursor to use during repository access. @return a new parser that walks over the current subtree. @throws IOException a loose object or pack file could not be Read. Iterator over an empty tree (a directory with no files). Create a new iterator with no parent. Create an iterator for a subtree of an existing iterator. The caller is responsible for setting up the path of the child iterator. Parent tree iterator. Create an iterator for a subtree of an existing iterator. The caller is responsible for setting up the path of the child iterator. Parent tree iterator. Path array to be used by the child iterator. This path must contain the path from the top of the walk to the first child and must end with a '/'. position within where the child can insert its data. The value at [-1] must be '/'. Working directory iterator for standard Java IO. This iterator uses the standard java.io package to Read the specified working directory as part of a . Walks a working directory tree as part of a {@link TreeWalk}. Most applications will want to use the standard implementation of this iterator, {@link FileTreeIterator}, as that does all IO through the standard java.io package. Plugins for a Java based IDE may however wish to Create their own implementations of this class to allow traversal of the IDE's project space, as well as benefit from any caching the IDE may have. Size we perform file IO in if we have to Read and hash a file. An empty entry array, suitable for . The for the current entry. Index within that came from. Buffer used to perform computations. Digest computer for computations. File name character encoder. List of entries obtained from the subclass. Total number of _entries in that are valid. Current position within . Create a new iterator with no parent. Create a new iterator with no parent and a prefix. The prefix path supplied is inserted in front of all paths generated by this iterator. It is intended to be used when an iterator is being created for a subsection of an overall repository and needs to be combined with other iterators that are created to run over the entire repository namespace. Position of this iterator in the repository tree. The value may be null or the empty string to indicate the prefix is the root of the repository. A trailing slash ('/') is automatically appended if the prefix does not end in '/'. Create an iterator for a subtree of an existing iterator. Parent tree iterator. Get the byte Length of this entry. Size of this file, in bytes. Get the last modified time of this entry. Last modified time of this file, in milliseconds since the epoch (Jan 1, 1970 UTC). Constructor helper. Files in the subtree of the work tree this iterator operates on. Obtain the current entry from this iterator. A single entry within a working directory tree. Obtain an input stream to Read the file content. Efficient implementations are not required. The caller will usually obtain the stream only once per entry, if at all. The input stream should not use buffering if the implementation can avoid it. The caller will buffer as necessary to perform efficient block IO operations. The caller will close the stream once complete. A stream to Read from the file. Get the type of this entry. Note: Efficient implementation required. The implementation of this method must be efficient. If a subclass needs to compute the value they should cache the reference within an instance member instead. A file mode constant from . Get the byte Length of this entry. Note: Efficient implementation required. The implementation of this method must be efficient. If a subclass needs to compute the value they should cache the reference within an instance member instead. Get the last modified time of this entry. Note: Efficient implementation required. The implementation of this method must be efficient. If a subclass needs to compute the value they should cache the reference within an instance member instead. Get the name of this entry within its directory. Efficient implementations are not required. The caller will obtain the name only once and cache it once obtained. Create a new iterator to traverse the given directory and its children. The starting directory. This directory should correspond to the root of the repository. Create a new iterator to traverse a subdirectory. The parent iterator we were created from. The subdirectory. This should be a directory contained within the parent directory. Wrapper for a standard file Get the underlying file of this entry. Specialized TreeWalk to detect directory-file (D/F) name conflicts. Due to the way a Git tree is organized the standard {@link TreeWalk} won't easily find a D/F conflict when merging two or more trees together. In the standard TreeWalk the file will be returned first, and then much later the directory will be returned. This makes it impossible for the application to efficiently detect and handle the conflict. Using this walk implementation causes the directory to report earlier than usual, at the same time as the non-directory entry. This permits the application to handle the D/F conflict in a single step. The directory is returned only once, so it does not get returned later in the iteration. When a D/F conflict is detected {@link TreeWalk#isSubtree()} will return true and {@link TreeWalk#enterSubtree()} will recurse into the subtree, no matter which iterator originally supplied the subtree. Because conflicted directories report early, using this walk implementation to populate a {@link DirCacheBuilder} may cause the automatic resorting to run and fix the entry ordering. This walk implementation requires more CPU to implement a look-ahead and a look-behind to merge a D/F pair together, or to skip a previously reported directory. In typical Git repositories the look-ahead cost is 0 and the look-behind doesn't trigger, as users tend not to Create trees which contain both "foo" as a directory and "foo.c" as a file. In the worst-case however several thousand look-ahead steps per walk step may be necessary, making the overhead quite significant. Since this worst-case should never happen this walk implementation has made the time/space tradeoff in favor of more-time/less-space, as that better suits the typical case. Walks one or more {@link AbstractTreeIterator}s in parallel. This class can perform n-way differences across as many trees as necessary. Each tree added must have the same root as existing trees in the walk. A TreeWalk instance can only be used once to generate results. Running a second time requires creating a new TreeWalk instance, or invoking {@link #reset()} and adding new trees before starting again. Resetting an existing instance may be faster for some applications as some internal buffers may be recycled. TreeWalk instances are not thread-safe. Applications must either restrict usage of a TreeWalk instance to a single thread, or implement their own synchronization at a higher level. Multiple simultaneous TreeWalk instances per {@link Repository} are permitted, even from concurrent threads. Open a tree walk and filter to exactly one path. The returned tree walk is already positioned on the requested path, so the caller should not need to invoke {@link #next()} unless they are looking for a possible directory/file name conflict. @param db repository to Read tree object data from. @param path single path to advance the tree walk instance into. @param trees one or more trees to walk through, all with the same root. @return a new tree walk configured for exactly this one path; null if no path was found in any of the trees. @throws IOException reading a pack file or loose object failed. @throws CorruptObjectException an tree object could not be Read as its data stream did not appear to be a tree, or could not be inflated. @throws IncorrectObjectTypeException an object we expected to be a tree was not a tree. @throws MissingObjectException a tree object was not found. Open a tree walk and filter to exactly one path. The returned tree walk is already positioned on the requested path, so the caller should not need to invoke {@link #next()} unless they are looking for a possible directory/file name conflict. @param db repository to Read tree object data from. @param path single path to advance the tree walk instance into. @param tree the single tree to walk through. @return a new tree walk configured for exactly this one path; null if no path was found in any of the trees. @throws IOException reading a pack file or loose object failed. @throws CorruptObjectException an tree object could not be Read as its data stream did not appear to be a tree, or could not be inflated. @throws IncorrectObjectTypeException an object we expected to be a tree was not a tree. @throws MissingObjectException a tree object was not found. Create a new tree walker for a given repository. The repository the walker will obtain data from. Get the currently configured filter. @return the current filter. Never null as a filter is always needed. Set the tree entry filter for this walker. Multiple filters may be combined by constructing an arbitrary tree of AndTreeFilter or OrTreeFilter instances to describe the bool expression required by the application. Custom filter implementations may also be constructed by applications. Note that filters are not thread-safe and may not be shared by concurrent TreeWalk instances. Every TreeWalk must be supplied its own unique filter, unless the filter implementation specifically states it is (and always will be) thread-safe. Callers may use {@link TreeFilter#Clone()} to Create a unique filter tree for this TreeWalk instance. @param newFilter the new filter. If null the special {@link TreeFilter#ALL} filter will be used instead, as it matches every entry. @see org.spearce.jgit.treewalk.filter.AndTreeFilter @see org.spearce.jgit.treewalk.filter.OrTreeFilter Reset this walker so new tree iterators can be added to it. Reset this walker to run over a single existing tree. @param id the tree we need to parse. The walker will execute over this single tree if the reset is successful. @throws MissingObjectException the given tree object does not exist in this repository. @throws IncorrectObjectTypeException the given object id does not denote a tree, but instead names some other non-tree type of object. Note that commits are not trees, even if they are sometimes called a "tree-ish". @throws CorruptObjectException the object claimed to be a tree, but its contents did not appear to be a tree. The repository may have data corruption. @throws IOException a loose object or pack file could not be Read. Reset this walker to run over a set of existing trees. @param ids the trees we need to parse. The walker will execute over this many parallel trees if the reset is successful. @throws MissingObjectException the given tree object does not exist in this repository. @throws IncorrectObjectTypeException the given object id does not denote a tree, but instead names some other non-tree type of object. Note that commits are not trees, even if they are sometimes called a "tree-ish". @throws CorruptObjectException the object claimed to be a tree, but its contents did not appear to be a tree. The repository may have data corruption. @throws IOException a loose object or pack file could not be Read. Add an already existing tree object for walking. The position of this tree is returned to the caller, in case the caller has lost track of the order they added the trees into the walker. The tree must have the same root as existing trees in the walk. @param id identity of the tree object the caller wants walked. @return position of this tree within the walker. @throws MissingObjectException the given tree object does not exist in this repository. @throws IncorrectObjectTypeException the given object id does not denote a tree, but instead names some other non-tree type of object. Note that commits are not trees, even if they are sometimes called a "tree-ish". @throws CorruptObjectException the object claimed to be a tree, but its contents did not appear to be a tree. The repository may have data corruption. @throws IOException a loose object or pack file could not be Read. Add an already created tree iterator for walking. The position of this tree is returned to the caller, in case the caller has lost track of the order they added the trees into the walker. The tree which the iterator operates on must have the same root as existing trees in the walk. @param parentIterator an iterator to walk over. The iterator should be new, with no parent, and should still be positioned before the first entry. The tree which the iterator operates on must have the same root as other trees in the walk. @return position of this tree within the walker. @throws CorruptObjectException the iterator was unable to obtain its first entry, due to possible data corruption within the backing data store. Get the number of trees known to this walker. @return the total number of trees this walker is iterating over. Advance this walker to the next relevant entry. @return true if there is an entry available; false if all entries have been walked and the walk of this set of tree iterators is over. @throws MissingObjectException {@link #isRecursive()} was enabled, a subtree was found, but the subtree object does not exist in this repository. The repository may be missing objects. @throws IncorrectObjectTypeException {@link #isRecursive()} was enabled, a subtree was found, and the subtree id does not denote a tree, but instead names some other non-tree type of object. The repository may have data corruption. @throws CorruptObjectException the contents of a tree did not appear to be a tree. The repository may have data corruption. @throws IOException a loose object or pack file could not be Read. Obtain the tree iterator for the current entry. Entering into (or exiting out of) a subtree causes the current tree iterator instance to be changed for the nth tree. This allows the tree iterators to manage only one list of items, with the diving handled by recursive trees. type of the tree iterator expected by the caller. tree to obtain the current iterator of. type of the tree iterator expected by the caller. The current iterator of the requested type; null if the tree has no entry to match the current path. Obtain the raw {@link FileMode} bits for the current entry. Every added tree supplies mode bits, even if the tree does not contain the current entry. In the latter case {@link FileMode#MISSING}'s mode bits (0) are returned. @param nth tree to obtain the mode bits from. @return mode bits for the current entry of the nth tree. @see FileMode#FromBits(int) Obtain the {@link FileMode} for the current entry. Every added tree supplies a mode, even if the tree does not contain the current entry. In the latter case {@link FileMode#MISSING} is returned. @param nth tree to obtain the mode from. @return mode for the current entry of the nth tree. Obtain the ObjectId for the current entry. Using this method to compare ObjectId values between trees of this walker is very inefficient. Applications should try to use {@link #idEqual(int, int)} or {@link #getObjectId(MutableObjectId, int)} whenever possible. Every tree supplies an object id, even if the tree does not contain the current entry. In the latter case {@link ObjectId#zeroId()} is returned. @param nth tree to obtain the object identifier from. @return object identifier for the current tree entry. @see #getObjectId(MutableObjectId, int) @see #idEqual(int, int) Obtain the ObjectId for the current entry. Every tree supplies an object id, even if the tree does not contain the current entry. In the latter case {@link ObjectId#zeroId()} is supplied. Applications should try to use {@link #idEqual(int, int)} when possible as it avoids conversion overheads. @param out buffer to copy the object id into. @param nth tree to obtain the object identifier from. @see #idEqual(int, int) Compare two tree's current ObjectId values for equality. @param nthA first tree to compare the object id from. @param nthB second tree to compare the object id from. @return result of getObjectId(nthA).Equals(getObjectId(nthB)). @see #getObjectId(int) Get the current entry's name within its parent tree. This method is not very efficient and is primarily meant for debugging and output generation. Applications should try to avoid calling it, and if invoked do so only once per interesting entry, where the name is absolutely required for correct function. @return name of the current entry within the parent tree (or directory). The name never includes a '/'. Get the current entry's complete path. This method is not very efficient and is primarily meant for debugging and output generation. Applications should try to avoid calling it, and if invoked do so only once per interesting entry, where the name is absolutely required for correct function. @return complete path of the current entry, from the root of the repository. If the current entry is in a subtree there will be at least one '/' in the returned string. Get the current entry's complete path as a UTF-8 byte array. @return complete path of the current entry, from the root of the repository. If the current entry is in a subtree there will be at least one '/' in the returned string. Test if the supplied path matches the current entry's path. This method tests that the supplied path is exactly equal to the current entry, or is one of its parent directories. It is faster to use this method then to use {@link #getPathString()} to first Create a string object, then test startsWith or some other type of string match function. @param p path buffer to test. Callers should ensure the path does not end with '/' prior to invocation. @param pLen number of bytes from buf to test. @return < 0 if p is before the current path; 0 if p matches the current path; 1 if the current path is past p and p will never match again on this tree walk. Test if the supplied path matches (being suffix of) the current entry's path. This method tests that the supplied path is exactly equal to the current entry, or is relative to one of entry's parent directories. It is faster to use this method then to use {@link #getPathString()} to first Create a String object, then test endsWith or some other type of string match function. @param p path buffer to test. @param pLen number of bytes from buf to test. @return true if p is suffix of the current path; false if otherwise Is the current entry a subtree? This method is faster then testing the raw mode bits of all trees to see if any of them are a subtree. If at least one is a subtree then this method will return true. @return true if {@link #enterSubtree()} will work on the current node. Is the current entry a subtree returned After its children? @return true if the current node is a tree that has been returned After its children were already processed. @see #isPostOrderTraversal() Enter into the current subtree. If the current entry is a subtree this method arranges for its children to be returned before the next sibling following the subtree is returned. @throws MissingObjectException a subtree was found, but the subtree object does not exist in this repository. The repository may be missing objects. @throws IncorrectObjectTypeException a subtree was found, and the subtree id does not denote a tree, but instead names some other non-tree type of object. The repository may have data corruption. @throws CorruptObjectException the contents of a tree did not appear to be a tree. The repository may have data corruption. @throws IOException a loose object or pack file could not be Read. Gets the repository this tree walker is reading from. Is this walker automatically entering into subtrees? If recursive mode is enabled the walker will hide subtree nodes from the calling application and will produce only file level nodes. If a tree (directory) is deleted then all of the file level nodes will appear to be deleted, recursively, through as many levels as necessary to account for all entries. Does this walker return a tree entry After it exits the subtree? If post order traversal is enabled then the walker will return a subtree After it has returned the last entry within that subtree. This may cause a subtree to be seen by the application twice if {@link #isRecursive()} is false, as the application will see it once, call {@link #enterSubtree()}, and then see it again as it leaves the subtree. If an application does not enable {@link #isRecursive()} and it does not call {@link #enterSubtree()} then the tree is returned only once as none of the children were processed. @return true if subtrees are returned After entries within the subtree. Get the current subtree depth of this walker. @return the current subtree depth of this walker. Create a new tree walker for a given repository. @param repo the repository the walker will obtain data from. Atomically set the value to the given updated value if the current value == the expected value. the expected value the expected value the new value true if successful. False return indicates that the actual value was not equal to the expected value. Set to the given value. the new value Get the current value. the current value Atomically add the given value to current value. the value to add the updated value Atomically increment by one the current value. the updated value Atomically decrement by one the current value. the updated value A normal Stream might provide a timeout on a specific read opreation. However, using StreamReader.ReadToEnd() on it can still get stuck for a long time. This class offers a timeout from the moment of it's construction to the read. Every read past the timeout from the stream's construction will fail. If the timeout elapsed while a read is in progress TimeoutStream is not responsible for aborting the read (there is no known good way in .NET to do it) See http://www.dotnet247.com/247reference/msgs/36/182553.aspx and http://www.google.co.il/search?q=cancel+async+Stream+read+.net Stream originalStream = GetStream(); StreamReader reader = new StreamReader(new TimeoutStream(originalStream, 5000)); // assuming the originalStream has a per-operation timeout, then ReadToEnd() // will return in (5000 + THAT_TIMEOUT) string foo = reader.ReadToEnd(); Assigns the specified int value to each element of the specified array of ints. type of the array's values the array to be filled the value to be stored in all elements of the array Assigns the specified int value to each element of the specified range of the specified array of ints. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.) type of the array's values the array to be filled the index of the first element (inclusive) to be filled with the specified value the index of the last element (exclusive) to be filled with the specified value the value to be stored in the specified range of elements of the array Implementation of EndianBitConverter which converts to/from big-endian byte arrays. Equivalent of System.BitConverter, but with either endianness. Indicates the byte order ("endianess") in which data is converted using this class. Different computer architectures store data using different byte orders. "Big-endian" means the most significant byte is on the left end of a word. "Little-endian" means the most significant byte is on the right end of a word. true if this converter is little-endian, false otherwise. Converts the specified double-precision floating point number to a 64-bit signed integer. Note: the endianness of this converter does not affect the returned value. The number to convert. A 64-bit signed integer whose value is equivalent to value. Converts the specified 64-bit signed integer to a double-precision floating point number. Note: the endianness of this converter does not affect the returned value. The number to convert. A double-precision floating point number whose value is equivalent to value. Converts the specified single-precision floating point number to a 32-bit signed integer. Note: the endianness of this converter does not affect the returned value. The number to convert. A 32-bit signed integer whose value is equivalent to value. Converts the specified 32-bit signed integer to a single-precision floating point number. Note: the endianness of this converter does not affect the returned value. The number to convert. A single-precision floating point number whose value is equivalent to value. Returns a Boolean value converted from one byte at a specified position in a byte array. An array of bytes. The starting position within value. true if the byte at startIndex in value is nonzero; otherwise, false. Returns a Unicode character converted from two bytes at a specified position in a byte array. An array of bytes. The starting position within value. A character formed by two bytes beginning at startIndex. Returns a double-precision floating point number converted from eight bytes at a specified position in a byte array. An array of bytes. The starting position within value. A double precision floating point number formed by eight bytes beginning at startIndex. Returns a single-precision floating point number converted from four bytes at a specified position in a byte array. An array of bytes. The starting position within value. A single precision floating point number formed by four bytes beginning at startIndex. Returns a 16-bit signed integer converted from two bytes at a specified position in a byte array. An array of bytes. The starting position within value. A 16-bit signed integer formed by two bytes beginning at startIndex. Returns a 32-bit signed integer converted from four bytes at a specified position in a byte array. An array of bytes. The starting position within value. A 32-bit signed integer formed by four bytes beginning at startIndex. Returns a 64-bit signed integer converted from eight bytes at a specified position in a byte array. An array of bytes. The starting position within value. A 64-bit signed integer formed by eight bytes beginning at startIndex. Returns a 16-bit unsigned integer converted from two bytes at a specified position in a byte array. An array of bytes. The starting position within value. A 16-bit unsigned integer formed by two bytes beginning at startIndex. Returns a 32-bit unsigned integer converted from four bytes at a specified position in a byte array. An array of bytes. The starting position within value. A 32-bit unsigned integer formed by four bytes beginning at startIndex. Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a byte array. An array of bytes. The starting position within value. A 64-bit unsigned integer formed by eight bytes beginning at startIndex. Checks the given argument for validity. The byte array passed in The start index passed in The number of bytes required value is a null reference startIndex is less than zero or greater than the length of value minus bytesRequired. Checks the arguments for validity before calling FromBytes (which can therefore assume the arguments are valid). The bytes to convert after checking The index of the first byte to convert The number of bytes to convert Convert the given number of bytes from the given array, from the given start position, into a long, using the bytes as the least significant part of the long. By the time this is called, the arguments have been checked for validity. The bytes to convert The index of the first byte to convert The number of bytes to use in the conversion The converted number Returns a String converted from the elements of a byte array. An array of bytes. All the elements of value are converted. A String of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in value; for example, "7F-2C-4A". Returns a String converted from the elements of a byte array starting at a specified array position. An array of bytes. The starting position within value. The elements from array position startIndex to the end of the array are converted. A String of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in value; for example, "7F-2C-4A". Returns a String converted from a specified number of bytes at a specified position in a byte array. An array of bytes. The starting position within value. The number of bytes to convert. The length elements from array position startIndex are converted. A String of hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in value; for example, "7F-2C-4A". Returns a decimal value converted from sixteen bytes at a specified position in a byte array. An array of bytes. The starting position within value. A decimal formed by sixteen bytes beginning at startIndex. Returns the specified decimal value as an array of bytes. The number to convert. An array of bytes with length 16. Copies the specified decimal value into the specified byte array, beginning at the specified index. A character to convert. The byte array to copy the bytes into The first index into the array to copy the bytes into Returns an array with the given number of bytes formed from the least significant bytes of the specified value. This is used to implement the other GetBytes methods. The value to get bytes for The number of significant bytes to return Returns the specified Boolean value as an array of bytes. A Boolean value. An array of bytes with length 1. Returns the specified Unicode character value as an array of bytes. A character to convert. An array of bytes with length 2. Returns the specified double-precision floating point value as an array of bytes. The number to convert. An array of bytes with length 8. Returns the specified 16-bit signed integer value as an array of bytes. The number to convert. An array of bytes with length 2. Returns the specified 32-bit signed integer value as an array of bytes. The number to convert. An array of bytes with length 4. Returns the specified 64-bit signed integer value as an array of bytes. The number to convert. An array of bytes with length 8. Returns the specified single-precision floating point value as an array of bytes. The number to convert. An array of bytes with length 4. Returns the specified 16-bit unsigned integer value as an array of bytes. The number to convert. An array of bytes with length 2. Returns the specified 32-bit unsigned integer value as an array of bytes. The number to convert. An array of bytes with length 4. Returns the specified 64-bit unsigned integer value as an array of bytes. The number to convert. An array of bytes with length 8. Copies the given number of bytes from the least-specific end of the specified value into the specified byte array, beginning at the specified index. This is used to implement the other CopyBytes methods. The value to copy bytes for The number of significant bytes to copy The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the given number of bytes from the least-specific end of the specified value into the specified byte array, beginning at the specified index. This must be implemented in concrete derived classes, but the implementation may assume that the value will fit into the buffer. The value to copy bytes for The number of significant bytes to copy The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the specified Boolean value into the specified byte array, beginning at the specified index. A Boolean value. The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the specified Unicode character value into the specified byte array, beginning at the specified index. A character to convert. The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the specified double-precision floating point value into the specified byte array, beginning at the specified index. The number to convert. The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the specified 16-bit signed integer value into the specified byte array, beginning at the specified index. The number to convert. The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the specified 32-bit signed integer value into the specified byte array, beginning at the specified index. The number to convert. The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the specified 64-bit signed integer value into the specified byte array, beginning at the specified index. The number to convert. The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the specified single-precision floating point value into the specified byte array, beginning at the specified index. The number to convert. The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the specified 16-bit unsigned integer value into the specified byte array, beginning at the specified index. The number to convert. The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the specified 32-bit unsigned integer value into the specified byte array, beginning at the specified index. The number to convert. The byte array to copy the bytes into The first index into the array to copy the bytes into Copies the specified 64-bit unsigned integer value into the specified byte array, beginning at the specified index. The number to convert. The byte array to copy the bytes into The first index into the array to copy the bytes into Indicates the byte order ("endianess") in which data is converted using this class. Returns a little-endian bit converter instance. The same instance is always returned. Returns a big-endian bit converter instance. The same instance is always returned. Union used solely for the equivalent of DoubleToInt64Bits and vice versa. Int32 version of the value. Single version of the value. Creates an instance representing the given integer. The integer value of the new instance. Creates an instance representing the given floating point number. The floating point value of the new instance. Returns the value of the instance as an integer. Returns the value of the instance as a floating point number. Indicates the byte order ("endianess") in which data is converted using this class. Different computer architectures store data using different byte orders. "Big-endian" means the most significant byte is on the left end of a word. "Little-endian" means the most significant byte is on the right end of a word. true if this converter is little-endian, false otherwise. Copies the specified number of bytes from value to buffer, starting at index. The value to copy The number of bytes to copy The buffer to copy the bytes into The index to start at Returns a value built from the specified number of bytes from the given buffer, starting at index. The data in byte array format The first index to use The number of bytes to use The value built from the given bytes Indicates the byte order ("endianess") in which data is converted using this class. Gets the DateTime in the sortable ISO format. Gets the DateTimeOffset in the sortable ISO format. A light version of a std Java class that updates a hash while writing bytes to a stream. Equivalent of System.IO.BinaryReader, but with either endianness, depending on the EndianBitConverter it is constructed with. No data is buffered in the reader; the client may seek within the stream at will. Whether or not this reader has been disposed yet. Decoder to use for string conversions. Buffer used for temporary storage before conversion into primitives Buffer used for temporary storage when reading a single character Minimum number of bytes used to encode a character Equivalent of System.IO.BinaryWriter, but with either endianness, depending on the EndianBitConverter it is constructed with. Converter to use when reading data Stream to read data from Constructs a new binary reader with the given bit converter, reading to the given stream, using the given encoding. Converter to use when reading data Stream to read data from Encoding to use when reading character data Closes the reader, including the underlying stream.. Seeks within the stream. Offset to seek to. Origin of seek operation. Reads a single byte from the stream. The byte read Reads a single signed byte from the stream. The byte read Reads a boolean from the stream. 1 byte is read. The boolean read Reads a 16-bit signed integer from the stream, using the bit converter for this reader. 2 bytes are read. The 16-bit integer read Reads a 32-bit signed integer from the stream, using the bit converter for this reader. 4 bytes are read. The 32-bit integer read Reads a 64-bit signed integer from the stream, using the bit converter for this reader. 8 bytes are read. The 64-bit integer read Reads a 16-bit unsigned integer from the stream, using the bit converter for this reader. 2 bytes are read. The 16-bit unsigned integer read Reads a 32-bit unsigned integer from the stream, using the bit converter for this reader. 4 bytes are read. The 32-bit unsigned integer read Reads a 64-bit unsigned integer from the stream, using the bit converter for this reader. 8 bytes are read. The 64-bit unsigned integer read Reads a single-precision floating-point value from the stream, using the bit converter for this reader. 4 bytes are read. The floating point value read Reads a double-precision floating-point value from the stream, using the bit converter for this reader. 8 bytes are read. The floating point value read Reads a decimal value from the stream, using the bit converter for this reader. 16 bytes are read. The decimal value read Reads a single character from the stream, using the character encoding for this reader. If no characters have been fully read by the time the stream ends, -1 is returned. The character read, or -1 for end of stream. Reads the specified number of characters into the given buffer, starting at the given index. The buffer to copy data into The first index to copy data into The number of characters to read The number of characters actually read. This will only be less than the requested number of characters if the end of the stream is reached. Reads the specified number of bytes into the given buffer, starting at the given index. The buffer to copy data into The first index to copy data into The number of bytes to read The number of bytes actually read. This will only be less than the requested number of bytes if the end of the stream is reached. Reads the specified number of bytes, returning them in a new byte array. If not enough bytes are available before the end of the stream, this method will return what is available. The number of bytes to read The bytes read Reads the specified number of bytes, returning them in a new byte array. If not enough bytes are available before the end of the stream, this method will throw an IOException. The number of bytes to read The bytes read Reads a 7-bit encoded integer from the stream. This is stored with the least significant information first, with 7 bits of information per byte of value, and the top bit as a continuation flag. This method is not affected by the endianness of the bit converter. The 7-bit encoded integer read from the stream. Reads a 7-bit encoded integer from the stream. This is stored with the most significant information first, with 7 bits of information per byte of value, and the top bit as a continuation flag. This method is not affected by the endianness of the bit converter. The 7-bit encoded integer read from the stream. Reads a length-prefixed string from the stream, using the encoding for this reader. A 7-bit encoded integer is first read, which specifies the number of bytes to read from the stream. These bytes are then converted into a string with the encoding for this reader. The string read from the stream. Checks whether or not the reader has been disposed, throwing an exception if so. Reads the given number of bytes from the stream, throwing an exception if they can't all be read. Buffer to read into Number of bytes to read Reads the given number of bytes from the stream if possible, returning the number of bytes actually read, which may be less than requested if (and only if) the end of the stream is reached. Buffer to read into Number of bytes to read Number of bytes actually read Disposes of the underlying stream. The bit converter used to read values from the stream The encoding used to read strings Gets the underlying stream of the EndianBinaryReader. Equivalent of System.IO.BinaryWriter, but with either endianness, depending on the EndianBitConverter it is constructed with. Whether or not this writer has been disposed yet. Buffer used for temporary storage during conversion from primitives Buffer used for Write(char) Constructs a new binary writer with the given bit converter, writing to the given stream, using UTF-8 encoding. Converter to use when writing data Stream to write data to Constructs a new binary writer with the given bit converter, writing to the given stream, using the given encoding. Converter to use when writing data Stream to write data to Encoding to use when writing character data Closes the writer, including the underlying stream. Flushes the underlying stream. Seeks within the stream. Offset to seek to. Origin of seek operation. Writes a boolean value to the stream. 1 byte is written. The value to write Writes a 16-bit signed integer to the stream, using the bit converter for this writer. 2 bytes are written. The value to write Writes a 32-bit signed integer to the stream, using the bit converter for this writer. 4 bytes are written. The value to write Writes a 64-bit signed integer to the stream, using the bit converter for this writer. 8 bytes are written. The value to write Writes a 16-bit unsigned integer to the stream, using the bit converter for this writer. 2 bytes are written. The value to write Writes a 32-bit unsigned integer to the stream, using the bit converter for this writer. 4 bytes are written. The value to write Writes a 64-bit unsigned integer to the stream, using the bit converter for this writer. 8 bytes are written. The value to write Writes a single-precision floating-point value to the stream, using the bit converter for this writer. 4 bytes are written. The value to write Writes a double-precision floating-point value to the stream, using the bit converter for this writer. 8 bytes are written. The value to write Writes a decimal value to the stream, using the bit converter for this writer. 16 bytes are written. The value to write Writes a signed byte to the stream. The value to write Writes an unsigned byte to the stream. The value to write Writes an array of bytes to the stream. The values to write Writes a portion of an array of bytes to the stream. An array containing the bytes to write The index of the first byte to write within the array The number of bytes to write Writes a single character to the stream, using the encoding for this writer. The value to write Writes an array of characters to the stream, using the encoding for this writer. An array containing the characters to write Writes a string to the stream, using the encoding for this writer. The value to write. Must not be null. value is null Writes a 7-bit encoded integer from the stream. This is stored with the least significant information first, with 7 bits of information per byte of value, and the top bit as a continuation flag. The 7-bit encoded integer to write to the stream Checks whether or not the writer has been disposed, throwing an exception if so. Writes the specified number of bytes from the start of the given byte array, after checking whether or not the writer has been disposed. The array of bytes to write from The number of bytes to write Disposes of the underlying stream. The bit converter used to write values to the stream The encoding used to write strings Gets the underlying stream of the EndianBinaryWriter. Endianness of a converter Little endian - least significant byte first Big endian - most significant byte first Adds or replaces the a value based on a key. The dict. The key. The value. Adds or replaces the a value based on a key. The dict. The key. The value. the previous value of the specified key in this dictionary, or null if it did not have one. Returns a value from a dictionary or the values default Key Type Value Type dictionary to search Key to search for default(V) or item if Key is found Returns the time that the file denoted by this abstract pathname was last modified. A file A long value representing the time the file was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the file does not exist or if an I/O error occurs. Returns the time that the directory denoted by this abstract pathname was last modified. A directory A long value representing the time the directory was last modified, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970), or 0L if the directory does not exist or if an I/O error occurs. Does this operating system and JRE support the execute flag on files? @return true if this implementation can provide reasonably accurate executable bit information; false otherwise. Determine if the file is executable (or not). Not all platforms and JREs support executable flags on files. If the feature is unsupported this method will always return false. @param f abstract path to test. @return true if the file is believed to be executable by the user. Set a file to be executable by the user. Not all platforms and JREs support executable flags on files. If the feature is unsupported this method will always return false and no changes will be made to the file specified. @param f path to modify the executable status of. @param canExec true to enable execution; false to disable it. @return true if the change succeeded; false otherwise. Resolve this file to its actual path name that the JRE can use. This method can be relatively expensive. Computing a translation may require forking an external process per path name translated. Callers should try to minimize the number of translations necessary by caching the results. Not all platforms and JREs require path name translation. Currently only Cygwin on Win32 require translation for Cygwin based paths. @param dir directory relative to which the path name is. @param name path name to translate. @return the translated path. new File(dir,name) if this platform does not require path name translation. Resolve this file to its actual path name that the JRE can use. This method can be relatively expensive. Computing a translation may require forking an external process per path name translated. Callers should try to minimize the number of translations necessary by caching the results. Not all platforms and JREs require path name translation. Currently only Cygwin on Win32 require translation for Cygwin based paths. @param dir directory relative to which the path name is. @param name path name to translate. @return the translated path. new File(dir,name) if this platform does not require path name translation. Determine the user's home directory (location where preferences are). This method can be expensive on the first invocation if path name translation is required. Subsequent invocations return a cached result. Not all platforms and JREs require path name translation. Currently only Cygwin on Win32 requires translation of the Cygwin HOME directory. @return the user's home directory; null if the user does not have one. Determine the user's home directory (location where preferences are). @return the user's home directory; null if the user does not have one. Determine the global application directory (location where preferences are). Also known as the "all users" directory. This method can be expensive on the first invocation if path name translation is required. Subsequent invocations return a cached result. @return the user's home directory; null if the user does not have one. Returns the global (user-specific) path for application settings based on OS Value of the global path Determine the system-wide application directory (location where preferences are). Also known as the "all users" directory. This method can be expensive on the first invocation if path name translation is required. Subsequent invocations return a cached result. @return the user's home directory; null if the user does not have one. Returns the system-wide path for application settings based on OS Resembles Java's CharSequence interface computes the number of 1 bits in the two's complement binary representation of the integer computes the number of 0 bits to the right of the first 1 Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified int value. Returns 32 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero. A more efficient using a primitive integer array. Create an empty list with a default capacity. Create an empty list with the specified capacity. number of entries the list can initially hold. Number of entries in this list index to Read, must be in the range [0, ). the number at the specified index Empty this list Add an entry to the end of the list. The nbumber to add Assign an entry in the list. index to set, must be in the range [0, ). value to store at the position. Pad the list with entries. index position to stop filling at. 0 inserts no filler. 1 ensures the list has a size of 1, adding val if the list is currently empty. value to insert into padded positions. Input/Output utilities Read an entire local file into memory as a byte array. Location of the file to read. Complete contents of the requested local file. The file exists, but its contents cannot be read. Read an entire local file into memory as a byte array. Location of the file to read. Maximum number of bytes to Read, if the file is larger than this limit an IOException is thrown. Complete contents of the requested local file. The file exists, but its contents cannot be Read. Read the entire byte array into memory, or throw an exception. Input stream to read the data from. buffer that must be fully populated position within the buffer to start writing to. number of bytes that must be read. The stream ended before was fully populated. There was an error reading from the stream. Read the entire byte array into memory, or throw an exception. Stream to read the data from. Position to read from the file at. Buffer that must be fully populated, [off, off+len]. position within the buffer to start writing to. number of bytes that must be read. The ended before the requested number of bytes were read. The does not supports seeking. There was an error reading from the stream. Skip an entire region of an input stream. The input stream's position is moved forward by the number of requested bytes, discarding them from the input. This method does not return until the exact number of bytes requested has been skipped. The stream to skip bytes from. Total number of bytes to be discarded. Must be >= 0. The stream ended before the requested number of bytes were skipped. There was an error reading from the stream. Java style iterator with remove capability (which is not supported by IEnumerator). This iterator is able to iterate over a list without being corrupted by removal of elements via the remove() method. Implementation of EndianBitConverter which converts to/from little-endian byte arrays. Indicates the byte order ("endianess") in which data is converted using this class. Different computer architectures store data using different byte orders. "Big-endian" means the most significant byte is on the left end of a word. "Little-endian" means the most significant byte is on the right end of a word. true if this converter is little-endian, false otherwise. Copies the specified number of bytes from value to buffer, starting at index. The value to copy The number of bytes to copy The buffer to copy the bytes into The index to start at Returns a value built from the specified number of bytes from the given buffer, starting at index. The data in byte array format The first index to use The number of bytes to use The value built from the given bytes Indicates the byte order ("endianess") in which data is converted using this class. Empty this list Add an entry to the end of the list. @param n the number to add. Assign an entry in the list. @param index index to set, must be in the range [0, {@link #size()}). @param n value to store at the position. Pad the list with entries. @param toIndex index position to stop filling at. 0 inserts no filler. 1 ensures the list has a size of 1, adding val if the list is currently empty. @param val value to insert into padded positions. A boxed integer that can be modified. Current value of this boxed value. Conversion utilities for network byte order handling. Compare a 32 bit unsigned integer stored in a 32 bit signed integer. This function performs an unsigned compare operation, even though Java does not natively support unsigned integer values. Negative numbers are treated as larger than positive ones. the first value to compare. the second value to compare. return < 0 if a < b; 0 if a == b; > 0 if a > b. Convert sequence of 2 bytes (network byte order) into unsigned value. Buffer to acquire the 2 bytes of data from. Position within the buffer to begin reading from. This position and the next byte After it (for a total of 2 bytes) will be read. Unsigned integer value that matches the 16 bits Read. Convert sequence of 4 bytes (network byte order) into unsigned value. buffer to acquire the 4 bytes of data from. position within the buffer to begin reading from. This position and the next 3 bytes After it (for a total of 4 bytes) will be read. Unsigned integer value that matches the 32 bits Read. Convert sequence of 4 bytes (network byte order) into unsigned value. buffer to acquire the 4 bytes of data from. position within the buffer to begin reading from. This position and the next 3 bytes After it (for a total of 4 bytes) will be read. Unsigned integer value that matches the 32 bits Read. Convert sequence of 4 bytes (network byte order) into signed value. Buffer to acquire the 4 bytes of data from. position within the buffer to begin reading from. This position and the next 3 bytes After it (for a total of 4 bytes) will be read. Signed integer value that matches the 32 bits Read. Convert sequence of 8 bytes (network byte order) into unsigned value. buffer to acquire the 8 bytes of data from. Position within the buffer to begin reading from. This position and the next 7 bytes After it (for a total of 8 bytes) will be read. Unsigned integer value that matches the 64 bits read. This function takes two arguments; the integer value to be converted and the base value (2, 8, or 16) to which the number is converted to. the decimal the base of the output a string representation of the base number This function takes two arguments; a string value representing the binary, octal, or hexadecimal value and the corresponding integer base value respective to the first argument. For instance, if you pass the first argument value "1101", then the second argument should take the value "2". the string in base sBase notation the base to convert from decimal Write a 16 bit integer as a sequence of 2 bytes (network byte order). @param intbuf buffer to write the 2 bytes of data into. @param offset position within the buffer to begin writing to. This position and the next byte After it (for a total of 2 bytes) will be replaced. @param v the value to write. Write a 32 bit integer as a sequence of 4 bytes (network byte order). @param intbuf buffer to write the 4 bytes of data into. @param offset position within the buffer to begin writing to. This position and the next 3 bytes After it (for a total of 4 bytes) will be replaced. @param v the value to write. Write a 64 bit integer as a sequence of 8 bytes (network byte order). @param intbuf buffer to write the 48bytes of data into. @param offset position within the buffer to begin writing to. This position and the next 7 bytes After it (for a total of 8 bytes) will be replaced. @param v the value to write. Converts an unsigned byte (.NET default when reading files, for instance) to a signed byte The value to be converted. Basic implementation of the NestedDictionaryBase using an underlying Dictionary Base class used for a nested dictionary NOTE: You should overload the implicit operator for converting V to your class for best functionality Key Type Value Type Nested Dictionary Type (Typically inherits from NestedDictionaryBase) Basic implementation of the NestedDictionaryBase using an underlying SortedDictionary Delete file without complaining about readonly status Delete file without complaining about readonly status Computes relative path, where path is relative to reference_path Utility functions related to quoted string handling. Quoting style that obeys the rules Git applies to file names. Quoting style used by the Bourne shell. Quotes are unconditionally inserted during . This protects shell meta-characters like $ or ~ from being recognized as special. Bourne style, but permits ~user at the start of the string. Quote an input string by the quoting rules. If the input string does not require any quoting, the same String reference is returned to the caller. Otherwise a quoted string is returned, including the opening and closing quotation marks at the start and end of the string. If the style does not permit raw Unicode characters then the string will first be encoded in UTF-8, with unprintable sequences possibly escaped by the rules. any non-null Unicode string a quoted . See above for details. Clean a previously quoted input, decoding the result via UTF-8. This method must match quote such that: a.Equals(qequote(quote(a))); is true for any a. a Unicode string to remove quoting from. the cleaned string. Decode a previously quoted input, scanning a UTF-8 encoded buffer. This method must match quote such that: a.Equals(Dequote(Constants.encode(quote(a)))); is true for any a. This method removes any opening/closing quotation marks added by The input buffer to parse. First position within to scan. One position past in to scan. The cleaned string. . Quoting style used by the Bourne shell. Quotes are unconditionally inserted during . This protects shell meta-characters like $ or ~ from being recognized as special. Bourne style, but permits ~user at the start of the string. Quoting style that obeys the rules Git applies to file names A rough character sequence around a raw byte buffer. Characters are assumed to be 8-bit US-ASCII. A zero-Length character sequence. Create a rough character sequence around the raw byte buffer. @param buf buffer to scan. @param start starting position for the sequence. @param end ending position for the sequence. Determine if b[ptr] matches src. the buffer to scan. first position within b, this should match src[0]. the buffer to test for equality with b. ptr + src.Length if b[ptr..src.Length] == src; else -1. Format a base 10 numeric into a temporary buffer. Formatting is performed backwards. The method starts at offset o-1 and ends at o-1-digits, where digits is the number of positions necessary to store the base 10 value. The argument and return values from this method make it easy to chain writing, for example: byte[] tmp = new byte[64]; int ptr = tmp.Length; tmp[--ptr] = '\n'; ptr = RawParseUtils.formatBase10(tmp, ptr, 32); tmp[--ptr] = ' '; ptr = RawParseUtils.formatBase10(tmp, ptr, 18); tmp[--ptr] = 0; string str = new string(tmp, ptr, tmp.Length - ptr); buffer to write into. One offset past the location where writing will begin; writing proceeds towards lower index values. the value to store. the new offset value o. This is the position of the last byte written. Additional writing should start at one position earlier. Parse a base 10 numeric from a sequence of ASCII digits into an int. Digit sequences can begin with an optional run of spaces before the sequence, and may start with a '+' or a '-' to indicate sign position. Any other characters will cause the method to stop and return the current result to the caller. @param b buffer to scan. @param ptr position within buffer to start parsing digits at. @param ptrResult optional location to return the new ptr value through. If null the ptr value will be discarded. @return the value at this location; 0 if the location is not a valid numeric. Parse a base 10 numeric from a sequence of ASCII digits into a long. Digit sequences can begin with an optional run of spaces before the sequence, and may start with a '+' or a '-' to indicate sign position. Any other characters will cause the method to stop and return the current result to the caller. Buffer to scan. Position within buffer to start parsing digits at. Optional location to return the new ptr value through. If null the ptr value will be discarded. The value at this location; 0 if the location is not a valid numeric. Parse 4 character base 16 (hex) formatted string to unsigned integer. The number is read in network byte order, that is, most significant nibble first. buffer to parse digits from; positions [p, p+4] will be parsed. First position within the buffer to parse. The integer value. If the string is not hex formatted. Parse 8 character base 16 (hex) formatted string to unsigned integer. The number is read in network byte order, that is, most significant nibble first. Buffer to parse digits from; positions [p, p+8] will be parsed. First position within the buffer to parse. the integer value. if the string is not hex formatted. Parse a single hex digit to its numeric value (0-15). Hex character to parse. Numeric value, in the range 0-15. If the input digit is not a valid hex digit. Parse a Git style timezone string. The sequence "-0315" will be parsed as the numeric value -195, as the lower two positions count minutes, not 100ths of an hour. Buffer to scan. Position within buffer to start parsing digits at. the timezone at this location, expressed in minutes. Locate the first position after LF. buffer to scan. position within buffer to start looking for LF at. New position just after LF. Locate the first position After either the given character or LF. This method stops on the first match it finds from either chrA or '\n'. @param b buffer to scan. @param ptr position within buffer to start looking for chrA or LF at. @param chrA character to find. @return new position just After the first chrA or LF to be found. Locate the first position before a given character. @param b buffer to scan. @param ptr position within buffer to start looking for chrA at. @param chrA character to find. @return new position just before chrA, -1 for not found Locate the first position before the previous LF. This method stops on the first '\n' it finds. @param b buffer to scan. @param ptr position within buffer to start looking for LF at. @return new position just before the first LF found, -1 for not found Locate the previous position before either the given character or LF. This method stops on the first match it finds from either chrA or '\n'. @param b buffer to scan. @param ptr position within buffer to start looking for chrA or LF at. @param chrA character to find. @return new position just before the first chrA or LF to be found, -1 for not found Index the region between [ptr, end) to find line starts. The returned list is 1 indexed. Index 0 contains {@link Integer#MIN_VALUE} to pad the list out. Using a 1 indexed list means that line numbers can be directly accessed from the list, so list.get(1) (aka get line 1) returns ptr. The last element (index map.size()-1) always contains end. @param buf buffer to scan. @param ptr position within the buffer corresponding to the first byte of line 1. @param end 1 past the end of the content within buf. @return a line map indexing the start position of each line. Locate the "author " header line data. @param b buffer to scan. @param ptr position in buffer to start the scan at. Most callers should pass 0 to ensure the scan starts from the beginning of the commit buffer and does not accidentally look at message body. @return position just After the space in "author ", so the first character of the author's name. If no author header can be located -1 is returned. Locate the "committer " header line data. @param b buffer to scan. @param ptr position in buffer to start the scan at. Most callers should pass 0 to ensure the scan starts from the beginning of the commit buffer and does not accidentally look at message body. @return position just After the space in "committer ", so the first character of the committer's name. If no committer header can be located -1 is returned. Locate the "tagger " header line data. @param b buffer to scan. @param ptr position in buffer to start the scan at. Most callers should pass 0 to ensure the scan starts from the beginning of the tag buffer and does not accidentally look at message body. @return position just After the space in "tagger ", so the first character of the tagger's name. If no tagger header can be located -1 is returned. Locate the "encoding " header line. @param b buffer to scan. @param ptr position in buffer to start the scan at. Most callers should pass 0 to ensure the scan starts from the beginning of the buffer and does not accidentally look at the message body. @return position just After the space in "encoding ", so the first character of the encoding's name. If no encoding header can be located -1 is returned (and UTF-8 should be assumed). Parse the "encoding " header into a character set reference. Locates the "encoding " header (if present) by first calling {@link #encoding(byte[], int)} and then returns the proper character set to Apply to this buffer to evaluate its contents as character data. If no encoding header is present, {@link Constants#CHARSET} is assumed. @param b buffer to scan. @return the Java character set representation. Never null. Parse a name line (e.g. author, committer, tagger) into a PersonIdent. When passing in a value for nameB callers should use the return value of {@link #author(byte[], int)} or {@link #committer(byte[], int)}, as these methods provide the proper position within the buffer. @param raw the buffer to parse character data from. @param nameB first position of the identity information. This should be the first position After the space which delimits the header field name (e.g. "author" or "committer") from the rest of the identity line. @return the parsed identity. Never null. Parse a name data (e.g. as within a reflog) into a PersonIdent. When passing in a value for nameB callers should use the return value of {@link #author(byte[], int)} or {@link #committer(byte[], int)}, as these methods provide the proper position within the buffer. @param raw the buffer to parse character data from. @param nameB first position of the identity information. This should be the first position After the space which delimits the header field name (e.g. "author" or "committer") from the rest of the identity line. @return the parsed identity. Never null. Locate the end of a footer line key string. If the region at {@code raw[ptr]} matches {@code ^[A-Za-z0-9-]+:} (e.g. "Signed-off-by: A. U. Thor\n") then this method returns the position of the first ':'. If the region at {@code raw[ptr]} does not match {@code ^[A-Za-z0-9-]+:} then this method returns -1. @param raw buffer to scan. @param ptr first position within raw to consider as a footer line key. @return position of the ':' which terminates the footer line key if this is otherwise a valid footer line key; otherwise -1. Decode a buffer under UTF-8, if possible. If the byte stream cannot be decoded that way, the platform default is tried and if that too fails, the fail-safe ISO-8859-1 encoding is tried. @param buffer buffer to pull raw bytes from. @return a string representation of the range [start,end), After decoding the region through the specified character set. Decode a buffer under UTF-8, if possible. If the byte stream cannot be decoded that way, the platform default is tried and if that too fails, the fail-safe ISO-8859-1 encoding is tried. @param buffer buffer to pull raw bytes from. @param start start position in buffer @param end one position past the last location within the buffer to take data from. @return a string representation of the range [start,end), After decoding the region through the specified character set. Decode a buffer under the specified character set if possible. If the byte stream cannot be decoded that way, the platform default is tried and if that too fails, the fail-safe ISO-8859-1 encoding is tried. @param cs character set to use when decoding the buffer. @param buffer buffer to pull raw bytes from. @return a string representation of the range [start,end), After decoding the region through the specified character set. Decode a region of the buffer under the specified character set if possible. If the byte stream cannot be decoded that way, the platform default is tried and if that too fails, the fail-safe ISO-8859-1 encoding is tried. @param cs character set to use when decoding the buffer. @param buffer buffer to pull raw bytes from. @param start first position within the buffer to take data from. @param end one position past the last location within the buffer to take data from. @return a string representation of the range [start,end), After decoding the region through the specified character set. Decode a region of the buffer under the specified character set if possible. If the byte stream cannot be decoded that way, the platform default is tried and if that too fails, an exception is thrown. @param cs character set to use when decoding the buffer. @param buffer buffer to pull raw bytes from. @param start first position within the buffer to take data from. @param end one position past the last location within the buffer to take data from. @return a string representation of the range [start,end), After decoding the region through the specified character set. @throws CharacterCodingException the input is not in any of the tested character sets. Decode a region of the buffer under the ISO-8859-1 encoding. Each byte is treated as a single character in the 8859-1 character encoding, performing a raw binary->char conversion. @param buffer buffer to pull raw bytes from. @param start first position within the buffer to take data from. @param end one position past the last location within the buffer to take data from. @return a string representation of the range [start,end). Locate the position of the commit message body. @param b buffer to scan. @param ptr position in buffer to start the scan at. Most callers should pass 0 to ensure the scan starts from the beginning of the commit buffer. @return position of the user's message buffer. Locate the position of the tag message body. @param b buffer to scan. @param ptr position in buffer to start the scan at. Most callers should pass 0 to ensure the scan starts from the beginning of the tag buffer. @return position of the user's message buffer. Locate the end of a paragraph. A paragraph is ended by two consecutive LF bytes. @param b buffer to scan. @param start position in buffer to start the scan at. Most callers will want to pass the first position of the commit message (as found by {@link #commitMessage(byte[], int)}. @return position of the LF at the end of the paragraph; b.Length if no paragraph end could be located. Searches text using only substring search. Instances are thread-safe. Multiple concurrent threads may perform matches on different character sequences at the same time. Construct a new substring pattern. @param patternText text to locate. This should be a literal string, as no meta-characters are supported by this implementation. The string may not be the empty string. Match a character sequence against this pattern. @param rcs the sequence to match. Must not be null but the Length of the sequence is permitted to be 0. @return offset within rcs of the first occurrence of this pattern; -1 if this pattern does not appear at any position of rcs. Get the literal pattern string this instance searches for. @return the pattern string given to our constructor. Specialized variant of an ArrayList to support a {@code RefDatabase}. This list is a hybrid of a Map<String,Ref> and of a List<Ref>. It tracks reference instances by name by keeping them sorted and performing binary search to locate an entry. Lookup time is O(log N), but addition and removal is O(N + log N) due to the list expansion or contraction costs. This list type is copy-on-write. Mutation methods return a new copy of the list, leaving {@code this} unmodified. As a result we cannot easily implement the {@link java.util.List} interface contract. the type of reference being stored in the collection. an empty unmodifiable reference list. Initialize this list to use the same backing array as another list. the source list this cast as an immutable, standard {@link java.util.List}. number of items in this list. true if the size of this list is 0. Locate an entry by name. the name of the reference to find. the index the reference is at. If the entry is not present returns a negative value. The insertion position for the given name can be computed from {@code -(index + 1)}. Determine if a reference is present. name of the reference to find. true if the reference is present; false if it is not. Get a reference object by name. the name of the reference. the reference object; null if it does not exist in this list. Get the reference at a particular index. the index to obtain. Must be {@code 0 <= idx < size()}. the reference value, never null. Obtain a builder initialized with the first {@code n} elements. Copies the first {@code n} elements from this list into a new builder, which can be used by the caller to add additional elements. the number of elements to copy. a new builder with the first {@code n} elements already added. Obtain a new copy of the list after changing one element. This list instance is not affected by the replacement. Because this method copies the entire list, it runs in O(N) time. index of the element to change. the new value, must not be null. copy of this list, after replacing {@code idx} with {@code ref}. Add an item at a specific index. This list instance is not affected by the addition. Because this method copies the entire list, it runs in O(N) time. position to add the item at. If negative the method assumes it was a direct return value from and will adjust it to the correct position. the new reference to insert. copy of this list, after making space for and adding {@code ref}. Remove an item at a specific index. This list instance is not affected by the addition. Because this method copies the entire list, it runs in O(N) time. position to remove the item from. copy of this list, after making removing the item at {@code idx}. Store a reference, adding or replacing as necessary. This list instance is not affected by the store. The correct position is determined, and the item is added if missing, or replaced if existing. Because this method copies the entire list, it runs in O(N + log N) time. the reference to store. copy of this list, after performing the addition or replacement. Builder to facilitate fast construction of an immutable RefList. type of reference being stored. Create an empty list ready for items to be added. Create an empty list with at least the specified capacity. the new capacity. number of items in this builder's internal collection. Get the reference at a particular index. the index to obtain. Must be {@code 0 <= idx < size()}. the reference value, never null. Remove an item at a specific index. position to remove the item from. Add the reference to the end of the array. References must be added in sort order, or the array must be sorted after additions are complete using {@link #sort()}. Add all items from a source array. References must be added in sort order, or the array must be sorted after additions are complete using . the source array. position within {@code src} to start copying from. number of items to copy from {@code src}. Replace a single existing element. index, must have already been added previously. the new reference. Sort the list's backing array in-place. an unmodifiable list using this collection's backing array. Specialized Map to present a {@code RefDatabase} namespace. Although not declared as a {@link java.util.SortedMap}, iterators from this map's projections always return references in {@link RefComparator} ordering. The map's internal representation is a sorted array of {@link Ref} objects, which means lookup and replacement is O(log N), while insertion and removal can be as expensive as O(N + log N) while the list expands or contracts. Since this is not a general map implementation, all entries must be keyed by the reference name. This class is really intended as a helper for {@code RefDatabase}, which needs to perform a merge-join of three sorted {@link RefList}s in order to present the unified namespace of the packed-refs file, the loose refs/ directory tree, and the resolved form of any symbolic references. Prefix denoting the reference subspace this map contains. All reference names in this map must start with this prefix. If the prefix is not the empty string, it must end with a '/'. Immutable collection of the packed references at construction time. Immutable collection of the loose references at construction time. If an entry appears here and in {@link #packed}, this entry must take precedence, as its more current. Symbolic references in this collection are typically unresolved, so they only tell us who their target is, but not the current value of the target. Immutable collection of resolved symbolic references. This collection contains only the symbolic references we were able to resolve at map construction time. Other loose references must be read from {@link #loose}. Every entry in this list must be matched by an entry in {@code loose}, otherwise it might be omitted by the map. Construct an empty map with a small initial capacity. Construct a map to merge 3 collections together. prefix used to slice the lists down. Only references whose names start with this prefix will appear to reside in the map. Must not be null, use {@code ""} (the empty string) to select all list items. items from the packed reference list, this is the last list searched. items from the loose reference list, this list overrides {@code packed} if a name appears in both. resolved symbolic references. This list overrides the prior list {@code loose}, if an item appears in both. Items in this list must also appear in {@code loose}. Helper function to easily replace all occurences of the incompatible string.Substring method in ported java code The string from which a part has to extracted. The beginning index, inclusive. The ending index, exclusive. The specified substring. Compares two strings lexicographically. (cf. http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#compareTo(java.lang.String)) the reference string the string to be compared the value 0 if the string to compared with is equal to this string; a value less than 0 if this string is lexicographically less than the string to compare with; and a value greater than 0 if this string is lexicographically greater than the string to compare with. Miscellaneous string comparison utility methods. Convert the input to lowercase. This method does not honor the JVM locale, but instead always behaves as though it is in the US-ASCII locale. Only characters in the range 'A' through 'Z' are converted. All other characters are left as-is, even if they otherwise would have a lowercase character equivalent. the input character. lowercase version of the input. Convert the input string to lower case, according to the "C" locale. This method does not honor the JVM locale, but instead always behaves as though it is in the US-ASCII locale. Only characters in the range 'A' through 'Z' are converted, all other characters are left as-is, even if they otherwise would have a lowercase character equivalent. the input string. Must not be null. a copy of the input string, After converting characters in the range 'A'..'Z' to 'a'..'z'. Test if two strings are equal, ignoring case. This method does not honor the JVM locale, but instead always behaves as though it is in the US-ASCII locale. first string to compare. second string to compare. true if a equals b Parse a string as a standard Git boolean value. The terms {@code yes}, {@code true}, {@code 1}, {@code on} can all be used to mean {@code true}. The terms {@code no}, {@code false}, {@code 0}, {@code off} can all be used to mean {@code false}. Comparisons ignore case, via . the string to parse. the boolean interpretation of . A fully buffered output stream. Subclasses determine the behavior when the in-memory buffer capacity has been exceeded and additional bytes are still being received for output. Maximum number of bytes we will permit storing in memory. When this limit is reached the data will be shifted to a file on disk, preventing the JVM heap from growing out of control. If has been reached, remainder goes here. Create a new empty temporary buffer. maximum number of bytes to store in memory before entering the overflow output path. Copy all bytes remaining on the input stream into this buffer. the stream to Read from, until EOF is reached. Convert this buffer's contents into a contiguous byte array. The buffer is only complete After {@link #close()} has been invoked. the complete byte array; length matches . Send this buffer to an output stream. This method may only be invoked After {@link #close()} has completed normally, to ensure all data is completely transferred. stream to send this buffer's complete content to. if not null progress updates are sent here. Caller should initialize the task and the number of work units to /1024. Reset this buffer for reuse, purging all buffered content. Open the overflow output stream, so the remaining output can be stored. the output stream to receive the buffered content, followed by the remaining output. Clear this buffer so it has no data, and cannot be used again. Obtain the length (in bytes) of the buffer. The length is only accurate After has been invoked. A fully buffered output stream using local disk storage for large data. Initially this output stream buffers to memory and is therefore similar to ByteArrayOutputStream, but it shifts to using an on disk temporary file if the output gets too large. The content of this buffered stream may be sent to another OutputStream only after this stream has been properly closed by . Location of our temporary file if we are on disk; otherwise null. If we exceeded the {@link #inCoreLimit} we nulled out {@link #blocks} and created this file instead. All output goes here through {@link #overflow}. Create a new temporary buffer. Create a new temporary buffer, limiting memory usage. maximum number of bytes to store in memory. Storage beyond this limit will use the local file. A temporary buffer that will never exceed its in-memory limit. If the in-memory limit is reached an IOException is thrown, rather than attempting to spool to local disk. Create a new heap buffer with a maximum storage limit. maximum number of bytes that can be stored in this buffer. Storing beyond this many will cause an IOException to be thrown during write. An InputStream which reads from one or more InputStreams. This stream may enter into an EOF state, returning -1 from any of the read methods, and then later successfully read additional bytes if a new InputStream is added after reaching EOF. Currently this stream does not support the mark/reset APIs. If mark and later reset functionality is needed the caller should wrap this stream with a {@link java.io.BufferedInputStream}. Create an empty InputStream that is currently at EOF state. Create an InputStream that is a union of the individual streams. As each stream reaches EOF, it will be automatically closed before bytes from the next stream are read. streams to be pushed onto this stream. Add the given InputStream onto the end of the stream queue. When the stream reaches EOF it will be automatically closed. the stream to add; must not be null. Returns true if there are no more InputStreams in the stream queue. If this method returns true then all read methods will signal EOF by returning -1, until another InputStream has been pushed into the queue with . true if there are no more streams to read from. A prefix abbreviation of an {@link ObjectId}. Sometimes Git produces abbreviated SHA-1 strings, using sufficient leading digits from the ObjectId name to still be unique within the repository the string was generated from. These ids are likely to be unique for a useful period of time, especially if they contain at least 6-10 hex digits. This class converts the hex string into a binary form, to make it more efficient for matching against an object. Number of half-bytes used by this id. Convert an AbbreviatedObjectId from hex characters (US-ASCII). the US-ASCII buffer to read from. position to read the first character from. one past the last position to read (end-offset is the Length of the string). the converted object id. Convert an AbbreviatedObjectId from hex characters. the string to read from. Must be <= 40 characters. the converted object id. true if this ObjectId is actually a complete id. Return a complete ; null if is false. Compares this abbreviation to a full object id. the other object id. Return <0 if this abbreviation names an object that is less than other; 0 if this abbreviation exactly matches the first digits of other.name(); >0 if this abbreviation names an object that is after other. string form of the abbreviation, in lower case hexadecimal. Number of hex digits appearing in this id Visitor interface for traversing the index and two trees in parallel. When merging we deal with up to two tree nodes and a base node. Then we figure out what to do. A File argument is supplied to allow us to check for modifications in a work tree or update the file. Visit a blob, and corresponding tree and index entries. Visit a blob, and corresponding tree nodes and associated index entry. Invoked after handling all child nodes of a tree, during a three way merge Invoked after handling all child nodes of a tree, during two way merge. An ObjectDatabase of another . This {@code ObjectDatabase} wraps around another {@code Repository}'s object database, providing its contents to the caller, and closing the Repository when this database is closed. The primary user of this class is , when the {@code info/alternates} file points at the {@code objects/} directory of another repository. Abstraction of arbitrary object storage. An object database stores one or more Git objects, indexed by their unique . Optionally an object database can reference one or more alternates; other instances that are searched in addition to the current database. Databases are usually divided into two halves: a half that is considered to be fast to search, and a half that is considered to be slow to search. When alternates are present the fast half is fully searched (recursively through all alternates) before the slow half is considered. Constant indicating no alternate databases exist. Initialize a new database instance for access. Does this database exist yet? true if this database is already created; false if the caller should invoke to create this database location. Initialize a new object database at this location. Close any resources held by this database and its active alternates. Close any resources held by this database only; ignoring alternates. To fully close this database and its referenced alternates, the caller should instead invoke . Fully close all loaded alternates and clear the alternate list. Does the requested object exist in this database? Alternates (if present) are searched automatically. identity of the object to test for existence of. True if the specified object is stored in this database, or any of the alternate databases. Fast half of . Identity of the object to test for existence of. true if the specified object is stored in this database. Slow half of . Identity of the object to test for existence of. true if the specified object is stored in this database. Open an object from this database. Alternates (if present) are searched automatically. Temporary working space associated with the calling thread. Identity of the object to open. A for accessing the data of the named object, or null if the object does not exist. Fast half of . temporary working space associated with the calling thread. identity of the object to open. A for accessing the data of the named object, or null if the object does not exist. Slow half of . temporary working space associated with the calling thread. Name of the object to open. identity of the object to open. A for accessing the data of the named object, or null if the object does not exist. Open the object from all packs containing it. If any alternates are present, their packs are also considered. Result collection of loaders for this object, filled with loaders from all packs containing specified object Temporary working space associated with the calling thread. of object to search for. Open the object from all packs containing it. If any alternates are present, their packs are also considered. Result collection of loaders for this object, filled with loaders from all packs containing specified object. Temporary working space associated with the calling thread. of object to search for. true if the fast-half search should be tried again. Get the alternate databases known to this database. The alternate list. Never null, but may be an empty array. Load the list of alternate databases into memory. This method is invoked by if the alternate list has not yet been populated, or if has been called on this instance and the alternate list is needed again. If the alternate array is empty, implementors should consider using the constant . The alternate list for this database. The alternate list could not be accessed. The empty alternate array will be assumed by the caller. Close the list of alternates returned by . the alternate list, from . Create a new cached database instance over this database. This instance might optimize queries by caching some information about database. So some modifications done after instance creation might fail to be noticed. new cached database instance the alternate repository to wrap and export. the alternate repository objects are borrowed from. Recreate a stream from a base stream and a GIT pack delta. This entire class is heavily cribbed from patch-delta.c in the GIT project. The original delta patching code was written by Nicolas Pitre (<nico@cam.org>). Apply the changes defined by delta to the data in base, yielding a new array of bytes. some byte representing an object of some kind. A git pack delta defining the transform from one version to another. Patched base The configuration file based on the blobs stored in the repository. The constructor from a byte array the base configuration file the byte array, should be UTF-8 encoded text. The byte array is not a valid configuration format. * The constructor from object identifier the base configuration file the repository the object identifier the blob cannot be read from the repository. the blob is not a valid configuration format. The constructor from commit and path The base configuration file The commit that contains the object The path within the tree of the commit the path does not exist in the commit's tree. the tree and/or blob cannot be accessed. the blob is not a valid configuration format. A with an underlying byte array for storage. A window of data currently stored within a cache. All bytes in the window can be assumed to be "immediately available", that is they are very likely already in memory, unless the operating system's memory is very low and has paged part of this process out to disk. Therefore copying bytes from a window is very inexpensive. * Copy bytes from the window to a caller supplied buffer. offset within the file to start copying from. destination buffer to copy into. Offset within to start copying into. number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offset . Number of bytes actually copied; this may be less than if exceeded the number of bytes available. Copy bytes from the window to a caller supplied buffer. offset within the window to start copying from. destination buffer to copy into. offset within to start copying into. number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offset . Number of bytes actually copied; this may be less than if exceeded the number of bytes available. Pump bytes into the supplied inflater as input. offset within the file to start supplying input from. destination buffer the inflater should output decompressed data to. current offset within to inflate into. the inflater to feed input to. The caller is responsible for initializing the inflater as multiple windows may need to supply data to the same inflater to completely decompress something. Updated based on the number of bytes successfully copied into by . If the inflater is not yet finished then another window's data must still be supplied as input to finish decompression. the inflater encountered an invalid chunk of data. Data stream corruption is likely. Pump bytes into the supplied inflater as input. offset within the file to start supplying input from. destination buffer the inflater should output decompressed data to. current offset within to inflate into. the inflater to feed input to. The caller is responsible for initializing the inflater as multiple windows may need to supply data to the same inflater to completely decompress something. Updated based on the number of bytes successfully copied into by . If the inflater is not yet finished then another window's data must still be supplied as input to finish decompression. the inflater encountered an invalid chunk of data. Data stream corruption is likely. A window for accessing git packs using a for storage. wrapper providing temporary lookup caching. The base class for {@code ObjectDatabase}s that wrap other database instances and optimize querying for objects by caching some database dependent information. Instances of this class (or any of its subclasses) can be returned from the method . This class can be used in scenarios where the database does not change, or when changes in the database while some operation is in progress is an acceptable risk. The default implementation delegates all requests to the wrapped database. The instance might be indirectly invalidated if the wrapped instance is closed. Closing the delegating instance does not implies closing the wrapped instance. For alternative databases, cached instances are used as well. The wrapped database instance Create the delegating database instance the wrapped object database The cached instance of an . This class caches the list of loose objects in memory, so the file system is not queried with stat calls. The set that contains unpacked objects identifiers, it is created when the cached instance is created. The constructor the wrapped database Instances of this class represent a Commit object. It represents a snapshot in a Git repository, who created it and when. Create an empty commit object. More information must be fed to this object to make it useful. The repository with which to associate it. Create a commit associated with these parents and associate it with a repository. The repository to which this commit object belongs. Id's of the parent(s). Create a commit object with the specified id and data from an existing commit object in a repository. The repository to which this commit object belongs. Commit id. Raw commit object data. Persist this commit object Hash function used natively by Git for all objects. A Git object hash is 160 bits, i.e. 20 bytes. Changing this assumption is not going to be as easy as changing this declaration. A Git object can be expressed as a 40 character string of hexadecimal digits. Special name for the "HEAD" symbolic-ref. Text string that identifies an object as a commit. Commits connect trees into a string of project histories, where each commit is an assertion that the best way to continue is to use this other tree (set of files). Text string that identifies an object as a blob. Blobs store whole file revisions. They are used for any user file, as well as for symlinks. Blobs form the bulk of any project's storage space. Text string that identifies an object as a tree. Trees attach object ids (hashes) to names and file modes. The normal use for a tree is to store a version of a directory and its contents. Text string that identifies an object as an annotated tag. Annotated tags store a pointer to any other object, and an additional message. It is most commonly used to record a stable release of the project. An unknown or invalid object type code. In-pack object type: extended types. This header code is reserved for future expansion. It is currently undefined/unsupported. In-pack object type: commit. Indicates the associated object is a commit. This constant is fixed and is defined by the Git packfile format. In-pack object type: tree. Indicates the associated object is a tree. This constant is fixed and is defined by the Git packfile format. In-pack object type: blob. Indicates the associated object is a blob. This constant is fixed and is defined by the Git packfile format. In-pack object type: annotated tag. Indicates the associated object is an annotated tag. This constant is fixed and is defined by the Git packfile format. In-pack object type: reserved for future use. In-pack object type: offset delta Objects stored with this type actually have a different type which must be obtained from their delta base object. Delta objects store only the changes needed to apply to the base object in order to recover the original object. An offset delta uses a negative offset from the start of this object to refer to its delta base. The base object must exist in this packfile (even in the case of a thin pack). This constant is fixed and is defined by the Git packfile format. In-pack object type: reference delta Objects stored with this type actually have a different type which must be obtained from their delta base object. Delta objects store only the changes needed to apply to the base object in order to recover the original object. A reference delta uses a full object id (hash) to reference the delta base. The base object is allowed to be omitted from the packfile, but only in the case of a thin pack being transferred over the network. This constant is fixed and is defined by the Git packfile format. Default main branch name Prefix for branch refs Prefix for remotes refs Prefix for tag refs Prefix for any ref Logs folder name Info refs folder Packed refs file The environment variable that contains the system user name The environment variable that contains the author's name The environment variable that contains the author's email The environment variable that contains the commiter's name The environment variable that contains the commiter's email The environment variable that limits how close to the root of the file systems JGit will traverse when looking for a repository root. The environment variable that tells us which directory is the ".git" directory The environment variable that tells us which directory is the working directory. The environment variable that tells us which file holds the Git index. The environment variable that tells us where objects are stored The environment variable that tells us where to look for objects, besides the default objects directory. Default value for the user name if no other information is available Beginning of the common "Signed-off-by: " commit message line Default remote name used by clone, push and fetch operations Default name for the Git repository directory A bare repository typically ends with this string A gitignore file name Pack file signature that occurs at file header - identifies file as Git packfile formatted. This constant is fixed and is defined by the Git packfile format. Native character encoding for commit messages, file names... Create a new digest function for objects. A new digest object. Convert an OBJ_* type constant to a TYPE_* type constant. typeCode the type code, from a pack representation. The canonical string name of this type. Convert an OBJ_* type constant to an ASCII encoded string constant. The ASCII encoded string is often the canonical representation of the type within a loose object header, or within a tag header. typeCode the type code, from a pack representation. The canonical ASCII encoded name of this type. Parse an encoded type string into a type constant. this type string came from; may be null if that is not known at the time the parse is occurring. string version of the type code. Character immediately following the type string. Usually ' ' (space) or '\n' (line feed). Position within where the parse should start. Updated with the new position (just past when the parse is successful). A type code constant (one of , , , Convert an integer into its decimal representation. the integer to convert. Decimal representation of the input integer. The returned array is the smallest array that will hold the value. Convert a string to US-ASCII encoding. The string to convert. Must not contain any characters over 127 (outside of 7-bit ASCII). A byte array of the same Length as the input string, holding the same characters, in the same order. The input string contains one or more characters outside of the 7-bit ASCII character space. Convert a string to a byte array in UTF-8 character encoding. The string to convert. May contain any Unicode characters. A byte array representing the requested string, encoded using the default character encoding (UTF-8). Return whether to log all refUpdates Reader for a deltified object Stored in a pack file. Base class for a set of object loader classes for packed objects. Base class for a set of loaders for different representations of Git objects. New loaders are constructed for every object. Git in pack object type, see . Size of object in bytes Obtain a copy of the bytes of this object. Unlike this method returns an array that might be modified by the caller. The bytes of this object. Obtain a reference to the (possibly cached) bytes of this object. This method offers direct access to the internal caches, potentially saving on data copies between the internal cache and higher level code. Callers who receive this reference must not modify its contents. Changes (if made) will affect the cache but not the repository itself. A copy of the cached bytes of this object. Raw object type from object header, as stored in storage (pack, loose file). This may be different from result for packs (see ). Raw size of object from object header (pack, loose file). Interpretation of this value depends on . Force this object to be loaded into memory and pinned in this loader. Once materialized, subsequent get operations for the following methods will always succeed without raising an exception, as all information is pinned in memory by this loader instance.
  • {@link Type}
  • {@link Size}
  • {@link #getBytes()}, {@link #getCachedBytes}
  • {@link #getRawSize()}
  • {@link #getRawType()}
temporary thread storage during data access.
Peg the pack file open to support data copying. Applications trying to copy raw pack data should ensure the pack stays open and available throughout the entire copy. To do that use: loader.beginCopyRawData(); try { loader.CopyRawData(out, tmpbuf, curs); } finally { loader.endCopyRawData(); } This loader contains stale information and cannot be used. The most likely cause is the underlying pack file has been deleted, and the object has moved to another pack file. Release resources after . Copy raw object representation from storage to provided output stream. Copied data doesn't include object header. User must provide temporary buffer used during copying by underlying I/O layer. Output stream when data is copied. No buffering is guaranteed. Temporary buffer used during copying. Recommended size is at least few kB. temporary thread storage during data access. When the object cannot be read. Gets the offset of object header within pack file Gets the offset of object data within pack file Gets if this loader is capable of fast raw-data copying basing on compressed data checksum; false if raw-data copying needs uncompressing and compressing data Gets the id of delta base object for this object representation. It returns null if object is not stored as delta. Temporary thread storage during data access. The object loader for the base object Reads a deltified object which uses an to find its base. Bit pattern for {@link #TYPE_MASK} matching {@link #GITLINK}. Bit pattern for {@link #TYPE_MASK} matching {@link #MISSING}. Returns the number of bytes written by Bit pattern for {@link #TYPE_MASK} matching {@link #REGULAR_FILE}. A TreeVisitor is invoked depth first for every node in a tree and is expected to perform different actions. Visit to a tree node before child nodes are visited. Tree Visit to a tree node. after child nodes have been visited. Tree Visit to a blob. Blob Visit to a symlink. Symlink entry. Visit to a gitlink. Gitlink entry. 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
  • Path is the relative path in the workdir
  • stage is 0 (normally), but when merging 1 is the common ancestor version, 2 is 'our' version and 3 is 'their' version. A fully resolved merge only contains stage 0.
  • flags is the object type and information of validity
  • statdata is the size of this object and some other file system specifics, some of it ignored by JGit
  • SHA-1 represents the content of the references object
An index can also contain a tree cache which we ignore for now. We drop the tree cache when writing the index.
Stage 0 represents merged entries. Construct a Git index representation. Reread index data from disk if the index file has been changed Add the content of a file to the index. workdir the file a new or updated index entry for the path represented by f Add the content of a file to the index. workdir the file content of the file a new or updated index entry for the path represented by f Add the encoded filename and content of a file to the index. relative filename with respect to the working directory Remove a path from the index. workdir the file whose path shall be removed. true if such a path was found (and thus removed) Read the cache file into memory. Write content of index to disk. Read a Tree recursively into the index The tree to read Add tree entry to index tree entry new or modified index entry Check out content of the content represented by the index workdir Check out content of the specified index entry workdir index entry Construct and write tree out of index. SHA-1 of the constructed tree Look up an entry with the specified path. Index entry for the path or null if not in index. True if we have modified the index in memory since reading it from disk. 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. The index entries sorted An index entry Update this index entry with stat and SHA-1 information if it looks like the file has been modified in the workdir. file in work dir true if a change occurred Update this index entry with stat and SHA-1 information if it looks like the file has been modified in the workdir. file in work dir the new content of the file true if a change occurred Check if an entry's content is different from the cache, File status information is used and status is same we consider the file identical to the state in the working directory. Native git uses more stat fields than we have accessible in Java. working directory to compare content with true if content is most likely different. Check if an entry's content is different from the cache, File status information is used and status is same we consider the file identical to the state in the working directory. Native git uses more stat fields than we have accessible in Java. working directory to compare content with True if the actual file content should be checked if modification time differs. true if content is most likely different. true if this entry shall be assumed valid true if this entry should be checked for changes Set whether to always assume this entry valid true to ignore changes Set whether this entry must be checked Return raw file mode bits. See file mode bits path name for this entry path name for this entry as byte array, hopefully UTF-8 encoded the stage this entry is in size of disk object Evaluate if the given path is ignored. If not yet loaded this loads all .gitignore files on the path and respects them. relative path to a file in the repository Construct an indexdiff for diffing the workdir against the index. Construct an indexdiff for diffing the workdir against both the index and a tree. Run the diff operation. Until this is called, all lists will be empty true if anything is different between index, tree, and workdir List of files added to the index, not in the tree List of files changed from tree to index List of files removed from index, but in tree List of files in index, but not filesystem List of files modified on disk relative to the index List of files in index and have a merge conflict Returns the number of files checked into the git repository Obtain an Inflater for decompression. Inflaters obtained through this cache should be returned (if possible) by to avoid garbage collection and reallocation. An available inflater. Never null. Release an inflater previously obtained from this cache. @param i the inflater to return. May be null, in which case this method does nothing. Git style file locking and replacement. To modify a ref file Git tries to use an atomic update approach: we write the new data into a brand new file, then rename it in place over the old name. This way we can just delete the temporary file if anything goes wrong, and nothing has been damaged. To coordinate access from multiple processes at once Git tries to atomically create the new temporary file under a well-known name. Create a new lock for any file. the file that will be locked. Try to establish the lock. True if the lock is now held by the caller; false if it is held by someone else. the temporary output file could not be created. The caller does not hold the lock. Try to establish the lock for appending. True if the lock is now held by the caller; false if it is held by someone else. The temporary output file could not be created. The caller does not hold the lock. Copy the current file content into the temporary file. This method saves the current file content by inserting it into the temporary file, so that the caller can safely append rather than replace the primary file. This method does nothing if the current file does not exist, or exists but is empty. The temporary file could not be written, or a read error occurred while reading from the current file. The lock is released before throwing the underlying IO exception to the caller. Write an ObjectId and LF to the temporary file. the id to store in the file. The id will be written in hex, followed by a sole LF. Write arbitrary data to the temporary file. the bytes to store in the temporary file. No additional bytes are added, so if the file must end with an LF it must appear at the end of the byte array. Obtain the direct output stream for this lock. The stream may only be accessed once, and only after has been successfully invoked and returned true. Callers must close the stream prior to calling to commit the change. A stream to write to the new file. The stream is unbuffered. Request that remember modification time. true if the commit method must remember the modification time. Wait until the lock file information differs from the old file. This method tests both the length and the last modification date. If both are the same, this method sleeps until it can force the new lock file's modification date to be later than the target file. Commit this change and release the lock. If this method fails (returns false) the lock is still released. true if the commit was successful and the file contains the new data; false if the commit failed and the file remains with the old data. Unlock this file and abort this change. The temporary file (if created) is deleted before returning. Wraps a FileStream and tracks its locking status Make this id match . Verifies that an object is formatted correctly. Verifications made by this class only check that the fields of an object are formatted correctly. The ObjectId checksum of the object is not verified, and connectivity links between objects are also not verified. Its assumed that the caller can provide both of these validations on its own. Instances of this class are not thread safe, but they may be reused to perform multiple object validations. Header "tree " Header "parent " Header "author " Header "committer " Header "encoding " Header "object " Header "type " Header "tag " Header "tagger " Check an object for parsing errors. Type of the object. Must be a valid object type code in . The raw data which comprises the object. This should be in the canonical format (that is the format used to generate the of the object). The array is never modified. If any error is identified. Check a commit for errors. The commit data. The array is never modified. If any error was detected. Check an annotated tag for errors. The tag data. The array is never modified. If any error was detected. Check a canonical formatted tree for errors. The raw tree data. The array is never modified. If any error was detected. Check a blob for errors. The blob data. The array is never modified. If any error was detected. Traditional file system based . This is the classical object database representation for a Git repository, where objects are stored loose by hashing them into directories by their , or are stored in compressed containers known as s. Initialize a reference to an on-disk object directory. the location of the objects directory. a list of alternate object directories Gets the location of the objects directory. Compute the location of a loose object file. Identity of the loose object to map to the directory. Location of the object, if it were to exist as a loose object. unmodifiable collection of all known pack files local to this directory. Most recent packs are presented first. Packs most likely to contain more recent objects appear before packs containing objects referenced by commits further back in the history of the repository. Add a single existing pack to the list of available pack files. Path of the pack file to open. Path of the corresponding index file. Index file could not be opened, read, or is not recognized as a Git pack file index. Last wall-clock time the directory was read. Last modification time of . All known packs, sorted by . Any reference whose peeled value is not yet known. A that points directly at an . Pairing of a name and the it currently has. A ref in Git is (more or less) a variable that holds a single object identifier. The object identifier can be any valid Git object (blob, tree, commit, annotated tag, ...). The ref name has the attributes of the ref that was asked for as well as the ref it was resolved to for symbolic refs plus the object id it points to and (for tags) the peeled target object id, i.e. the tag resolved recursively until a non-tag object is referenced. What this ref is called within the repository. name of this ref. Test if this reference is a symbolic reference. A symbolic reference does not have its own {@link ObjectId} value, but instead points to another {@code Ref} in the same database and always uses that other reference's value as its own. true if this is a symbolic reference; false if this reference contains its own ObjectId. Traverse target references until {@link #isSymbolic()} is false. If {@link #isSymbolic()} is false, returns {@code this}. If {@link #isSymbolic()} is true, this method recursively traverses {@link #getTarget()} until {@link #isSymbolic()} returns false. This method is effectively
            return isSymbolic() ? getTarget().getLeaf() : this;
            
the reference that actually stores the ObjectId value.
Get the reference this reference points to, or {@code this}. If {@link #isSymbolic()} is true this method returns the reference it directly names, which might not be the leaf reference, but could be another symbolic reference. If this is a leaf level reference that contains its own ObjectId,this method returns {@code this}. the target reference, or {@code this}. Cached value of this ref. the value of this ref at the last time we read it. Cached value of ref^{} (the ref peeled to commit). if this ref is an annotated tag the id of the commit (or tree or blob) that the annotated tag refers to; null if this ref does not refer to an annotated tag. whether the Ref represents a peeled tag How was this ref obtained? The current storage model of a Ref may influence how the ref must be updated or deleted from the repository. type of ref. Create a new ref pairing. method used to store this ref. name of this ref. current value of the ref. May be null to indicate a ref that does not exist yet. Create a new ref pairing. method used to store this ref. name of this ref. current value of the ref. May be null to indicate a ref that does not exist yet. An annotated tag whose peeled object has been cached. Create a new ref pairing. method used to store this ref. name of this ref. current value of the ref. the first non-tag object that tag {@code id} points to. A reference to a non-tag object coming from a cached source. Create a new ref pairing. method used to store this ref. name of this ref. current value of the ref. May be null to indicate a ref that does not exist yet. Fast, efficient map specifically for {@link ObjectId} subclasses. This map provides an efficient translation from any ObjectId instance to a cached subclass of ObjectId that has the same value. Raw value equality is tested when comparing two ObjectIds (or subclasses), not reference equality and not .Equals(Object) equality. This allows subclasses to override Equals to supply their own extended semantics. Type of subclass of ObjectId that will be stored in the map. Lookup an existing mapping. the object identifier to find. the instance mapped to toFind, or null if no mapping exists. An unknown or invalid object type code. In-pack object type: extended types. This header code is reserved for future expansion. It is currently undefined/unsupported. In-pack object type: commit. Indicates the associated object is a commit. This constant is fixed and is defined by the Git packfile format. In-pack object type: tree. Indicates the associated object is a tree. This constant is fixed and is defined by the Git packfile format. In-pack object type: blob. Indicates the associated object is a blob. This constant is fixed and is defined by the Git packfile format. In-pack object type: annotated tag. Indicates the associated object is an annotated tag. This constant is fixed and is defined by the Git packfile format. In-pack object type: reserved for future use. In-pack object type: offset delta Objects stored with this type actually have a different type which must be obtained from their delta base object. Delta objects store only the changes needed to apply to the base object in order to recover the original object. An offset delta uses a negative offset from the start of this object to refer to its delta base. The base object must exist in this packfile (even in the case of a thin pack). This constant is fixed and is defined by the Git packfile format. In-pack object type: reference delta Objects stored with this type actually have a different type which must be obtained from their delta base object. Delta objects store only the changes needed to apply to the base object in order to recover the original object. A reference delta uses a full object id (hash) to reference the delta base. The base object is allowed to be omitted from the packfile, but only in the case of a thin pack being transferred over the network. This constant is fixed and is defined by the Git packfile format. Construct an object writer for the specified repository. Compute the SHA-1 of a blob without creating an object. This is for figuring out if we already have a blob or not. number of bytes to consume. stream for read blob data from. SHA-1 of a looked for blob. Write a blob with the data in the specified file A file containing blob data. SHA-1 of the blob. Write a blob with the specified data. Bytes of the blob. SHA-1 of the blob. Write a blob with data from a stream Number of bytes to consume from the stream. Stream with blob data. SHA-1 of the blob. Write a canonical tree to the object database. The canonical encoding of the tree object. SHA-1 of the tree. Write a Commit to the object database Commit to store. SHA-1 of the commit. Write an annotated Tag to the object database Tag SHA-1 of the tag. Least frequently used cache for objects specified by PackFile positions. This cache maps a (PackFile, position) tuple to an object. This cache is suitable for objects that are "relative expensive" to compute from the underlying PackFile, given some known position in that file. Whenever a cache miss occurs, is invoked by exactly one thread for the given (PackFile,position) key tuple. This is ensured by an array of _locks, with the tuple hashed to a @lock instance. During a miss, older entries are evicted from the cache so long as returns true. Its too expensive during object access to be 100% accurate with a least recently used (LRU) algorithm. Strictly ordering every read is a lot of overhead that typically doesn't yield a corresponding benefit to the application. This cache : a loose LRU policy by randomly picking a window comprised of roughly 10% of the cache, and evicting the oldest accessed entry within that window. Entities created by the cache are held under SoftReferences, permitting the Java runtime's garbage collector to evict entries when heap memory gets low. Most JREs implement a loose least recently used algorithm for this eviction. The internal hash table does not expand at runtime, instead it is fixed in size at cache creation time. The internal @lock table used to gate load invocations is also fixed in size. The key tuple is passed through to methods as a pair of parameters rather than as a single object, thus reducing the transient memory allocations of callers. It is more efficient to avoid the allocation, as we can't be 100% sure that a JIT would be able to stack-allocate a key tuple. This cache has an implementation rule such that: is invoked by at most one thread at a time for a given (PackFile, position) tuple. For every load() invocation there is exactly one invocation to wrap a SoftReference around the cached entity. For every Reference created by createRef() there will be exactly one call to to cleanup any resources associated with the (now expired) cached entity. Therefore, it is safe to perform resource accounting increments during the or methods, and matching decrements during . Implementors may need to override in order to embed additional accounting information into an implementation specific subclass, as the cached entity may have already been evicted by the JRE's garbage collector. To maintain higher concurrency workloads, during eviction only one thread performs the eviction work, while other threads can continue to insert new objects in parallel. This means that the cache can be temporarily over limit, especially if the nominated eviction thread is being starved relative to the other threads. Type of value stored in the cache. Subtype of subclass used by the cache. Queue that must use. Number of entries in . Access clock for loose LRU. Hash bucket directory; entries are chained below. Locks to prevent concurrent loads for same (PackFile, position). Lock to elect the eviction thread after a load occurs. Number of buckets to scan for an eviction window. Create a new cache with a fixed size entry table and @Lock table. number of entries in the entry hash table. number of entries in the table. This is the maximum concurrency rate for creation of new objects through invocations. Lookup a cached object, creating and loading it if it doesn't exist. the pack that "contains" the cached object. offset within of the object. The object reference. The object reference was not in the cache and could not be obtained by Clear every entry from the cache. This is a last-ditch effort to clear out the cache, such as before it gets replaced by another cache that is configured differently. This method tries to force every cached entry through to ensure that resources are correctly accounted for and cleaned up by the subclass. A concurrent reader loading entries while this method is running may cause resource accounting failures. Clear all entries related to a single file. Typically this method is invoked during , when we know the pack is never going to be useful to us again (for example, it no longer exists on disk). A concurrent reader loading an entry from this same pack may cause the pack to become stuck in the cache anyway. the file to purge all entries of. Materialize an object that doesn't yet exist in the cache. This method is invoked by when the specified entity does not yet exist in the cache. Internal locking ensures that at most one thread can call this method for each unique (pack,position), but multiple threads can call this method concurrently for different (pack,position) tuples. The file to materialize the entry from. Offset within the file of the entry. the materialized object. Must never be null. The method was unable to materialize the object for this input pair. The usual reasons would be file corruption, file not found, out of file descriptors, etc. Construct a Ref (SoftReference) around a cached entity. Implementing this is only necessary if the subclass is performing resource accounting during and requires some information to update the accounting. Implementors MUST ensure that the returned reference uses the Queue, otherwise will not be invoked at the proper time. The file to materialize the entry from. Offset within the file of the entry. The object returned by . A weak reference subclass wrapped around . Update accounting information now that an object has left the cache. This method is invoked exactly once for the combined and invocation pair that was used to construct and insert an object into the cache. the reference wrapped around the object. Implementations must be prepared for @ref.get() to return null. Determine if the cache is full and requires eviction of entries. By default this method returns false. Implementors may override to consult with the accounting updated by , and . True if the cache is still over-limit and requires eviction of more entries. Compute the hash code value for a (PackFile,position) tuple. For example, return packHash + (int) (position >>> 4). Implementors must override with a suitable hash (for example, a different right shift on the position). hash code for the file being accessed. position within the file being accessed. a reasonable hash code mixing the two values. Next entry in the hash table's chain list. The referenced object. Marked true when returns null and the is garbage collected. A true here indicates that the @ref is no longer accessible, and that we therefore need to eventually purge this Entry object out of the bucket's chain. A wrapped around a cached object. Type of the cached object. A Git version 2 pack file representation. A pack file contains Git objects in delta packed format yielding high compression of lots of object where some objects are similar. Sorts PackFiles to be most recently created to least recently created. Construct a Reader for an existing, pre-indexed packfile. path of the .idx file listing the contents. path of the .pack file holding the data. The file object which locates this pack on disk. * Determine if an object is contained within the pack file. For performance reasons only the index file is searched; the main pack content is ignored entirely. The object to look for. Must not be null. True if the object is in this pack; false otherwise. Get an object from this pack. temporary working space associated with the calling thread. the object to obtain from the pack. Must not be null. The object loader for the requested object if it is contained in this pack; null if the object was not found. Close the resources utilized by this repository. Search for object id with the specified start offset in associated pack (reverse) index. start offset of object to find Object id for this offset, or null if no object was found The object which locates this pack on disk. Obtain the total number of objects available in this pack. This method relies on pack index, giving number of effectively available objects. Number of objects in index of this pack, likewise in this pack. The index file cannot be loaded into memory. Access path to locate objects by in a . Indexes are strictly redundant information in that we can rebuild all of the data held in the index file from the on disk representation of the pack file itself, but it is faster to access for random requests because data is stored by ObjectId. Determine if an object is contained within the pack file. The object to look for. Must not be null. True if the object is listed in this index; false otherwise. Get ObjectId for the n-th object entry returned by {@link #iterator()}. This method is a constant-time replacement for the following loop:
             Iterator<MutableEntry> eItr = index.iterator();
             int curPosition = 0;
             while (eItr.hasNext() && curPosition++ < nthPosition)
             	eItr.next();
             ObjectId result = eItr.next().ToObjectId();
             
@param nthPosition position within the traversal of {@link #iterator()} that the caller needs the object for. The first returned {@link MutableEntry} is 0, the second is 1, etc. @return the ObjectId for the corresponding entry.
Get ObjectId for the n-th object entry returned by {@link #iterator()}. This method is a constant-time replacement for the following loop:
             Iterator<MutableEntry> eItr = index.iterator();
             int curPosition = 0;
             while (eItr.hasNext() && curPosition++ < nthPosition)
             	eItr.next();
             ObjectId result = eItr.next().ToObjectId();
             
@param nthPosition unsigned 32 bit position within the traversal of {@link #iterator()} that the caller needs the object for. The first returned {@link MutableEntry} is 0, the second is 1, etc. Positions past 2**31-1 are negative, but still valid. @return the ObjectId for the corresponding entry.
Locate the file offset position for the requested object. @param objId name of the object to locate within the pack. @return offset of the object's header and compressed content; -1 if the object does not exist in this index and is thus not stored in the associated pack. Retrieve stored CRC32 checksum of the requested object raw-data (including header). id of object to look for CRC32 checksum of specified object (at 32 less significant bits). When requested ObjectId was not found in this index when this index doesn't support CRC32 checksum Open an existing pack .idx file for reading..

The format of the file will be automatically detected and a proper access implementation for that format will be constructed and returned to the caller. The file may or may not be held open by the returned instance.

existing pack .idx to read.
Footer checksum applied on the bottom of the pack file. Obtain the total number of objects described by this index. @return number of objects in this index, and likewise in the associated pack that this index was generated from. Obtain the total number of objects needing 64 bit offsets. @return number of objects in this index using a 64 bit offset; that is an object positioned after the 2 GB position within the file. Check whether this index supports (has) CRC32 checksums for objects. Returns mutable copy of this mutable entry. Copy of this mutable entry Returns offset for this index object entry Returns hex string describing the object id of this entry Provide iterator that gives access to index entries. Note, that iterator returns reference to mutable object, the same reference in each call - for performance reason. If client needs immutable objects, it must copy returned object on its own. Iterator returns objects in SHA-1 lexicographical order. Support for the pack index v2 format. 256 arrays of contiguous object names. 256 arrays of the 32 bit offset data, matching {@link #names}. 256 arrays of the CRC-32 of objects, matching {@link #names}. 64 bit offset table. Create a new writer for the oldest (most widely understood) format. This method selects an index format that can accurate describe the supplied objects and that will be the most compatible format with older Git implementations. Index version 1 is widely recognized by all Git implementations, but index version 2 (and later) is not as well recognized as it was introduced more than a year later. Index version 1 can only be used if the resulting pack file is under 4 gigabytes in size; packs larger than that limit must use index version 2. The stream the index data will be written to. If not already buffered it will be automatically wrapped in a buffered stream. Callers are always responsible for closing the stream. The objects the caller needs to store in the index. Entries will be examined until a format can be conclusively selected. A new writer to output an index file of the requested format to the supplied stream. No recognized pack index version can support the supplied objects. This is likely a bug in the implementation. Create a new writer instance for a specific index format version. The stream the index data will be written to. If not already buffered it will be automatically wrapped in a buffered stream. Callers are always responsible for closing the stream. Index format version number required by the caller. Exactly this formatted version will be written. A new writer to output an index file of the requested format to the supplied stream. The version requested is not supported by this implementation. Create a new writer instance. The stream this instance outputs to. If not already buffered it will be automatically wrapped in a buffered stream. Write all object entries to the index stream. After writing the stream passed to the factory is flushed but remains open. Callers are always responsible for closing the output stream. Sorted list of objects to store in the index. The caller must have previously sorted the list using 's native {@link Comparable} implementation. Checksum signature of the entire pack data content. This is traditionally the last 20 bytes of the pack file's own stream. Writes the index file to out. Implementations should go something like: WriteFanOutTable(); foreach (PackedObjectInfo po in entries) { WriteOneEntry(po); } WriteChecksumFooter(); Where the logic for writeOneEntry is specific to the index format in use. Additional headers/footers may be used if necessary and the entries collection may be iterated over more than once if necessary. Implementors therefore have complete control over the data. Output the version 2 (and later) TOC header, with version number. Post version 1 all index files start with a TOC header that makes the file an invalid version 1 file, and then includes the version number. This header is necessary to recognize a version 1 from a version 2 formatted index. Version number of this index format being written. utput the standard 256 entry first-level fan-out table. The fan-out table is 4 KB in size, holding 256 32-bit unsigned integer counts. Each count represents the number of objects within this index whose matches the count's position in the fan-out table. Output the standard two-checksum index footer. The standard footer contains two checksums (20 byte SHA-1 values):
  1. Pack data checksum - taken from the last 20 bytes of the pack file.
  2. Index data checksum - checksum of all index bytes written, including the pack data checksum above.
Keeps track of a associated .keep file. Create a new lock for a pack file. Location of the pack-*.pack file. Create the pack-*.keep file, with the given message. message to store in the file. true if the keep file was successfully written; false otherwise. The keep file could not be written. Remove the .keep file that holds this pack in place. Reverse index for forward pack index. Provides operations based on offset instead of object id. Such offset-based reverse lookups are performed in O(log n) time. /// Create reverse index from straight/forward pack index, by indexing all its entries. Forward index - entries to (reverse) index. Search for object id with the specified start offset in this pack (reverse) index. start offset of object to find. for this offset, or null if no object was found. Search for the next offset to the specified offset in this pack (reverse) index. start offset of previous object (must be valid-existing offset). maximum offset in a pack (returned when there is no next offset). offset of the next object in a pack or maxOffset if provided offset was the last one. When there is no object with the provided offset. Creates new PersonIdent from config info in repository, with current time. This new PersonIdent gets the info from the default committer as available from the configuration. Copy a . Original . Construct a new with current time. Copy a PersonIdent, but alter the clone's time stamp Original . Local date time in milliseconds (since Epoch). Time zone offset in minutes. Copy a , but alter the clone's time stamp Original . Local date time in milliseconds (since Epoch). Construct a PersonIdent from simple data Local date time in milliseconds (since Epoch). Time zone offset in minutes. Construct a Local date time in milliseconds (since Epoch). Time zone offset in minutes. Copy a PersonIdent, but alter the clone's time stamp Original . Local date time in milliseconds (since Epoch). Time zone offset in minutes. Construct a PersonIdent from a string with full name, email, time time zone string. The input string must be valid. A Git internal format author/committer string. Format for Git storage. A string in the git author format. Elapsed milliseconds since Epoch (1970.1.1 00:00:00 GMT) TimeZone offset in minutes Location where a is Stored. The ref does not exist yet, updating it may create it. Creation is likely to choose storage. The ref is Stored in a file by itself. Updating this ref affects only this ref. The ref is stored in the packed-refs file, with others. Updating this ref requires rewriting the file, with perhaps many other refs being included at the same time. The ref is both and . Updating this ref requires only updating the loose file, but deletion requires updating both the loose file and the packed refs file. The ref came from a network advertisement and storage is unknown. This ref cannot be updated without Git-aware support on the remote side, as Git-aware code consolidate the remote refs and reported them to this process. Util for sorting (or comparing) Ref instances by name. Useful for command line tools or writing out refs to file. Singleton instance of RefComparator Sorts the collection of refs, returning a new collection. collection to be sorted sorted collection of refs Compare a reference to a name. the reference instance. the name to compare to. standard Comparator result Compare two references by name. the reference instance. the other reference instance. standard Comparator result Abstraction of name to mapping. A reference database stores a mapping of reference names to . Every has a single reference database, mapping names to the tips of the object graph contained by the . Order of prefixes to search when using non-absolute references. The implementation's method must take this search space into consideration when locating a reference by name. The first entry in the path is always {@code ""}, ensuring that absolute references are resolved without further mangling. Maximum number of times a can be traversed. If the reference is nested deeper than this depth, the implementation should either fail, or at least claim the reference does not exist. Magic value for to return all references. Initialize a new reference database at this location. Close any resources held by this database. Determine if a proposed reference name overlaps with an existing one. Reference names use '/' as a component separator, and may be stored in a hierarchical storage such as a directory on the local filesystem. If the reference "refs/heads/foo" exists then "refs/heads/foo/bar" must not exist, as a reference cannot have a value and also be a container for other references at the same time. If the reference "refs/heads/foo/bar" exists than the reference "refs/heads/foo" cannot exist, for the same reason. proposed name. true if the name overlaps with an existing reference; false if using this name right now would be safe. Create a new update command to create, modify or delete a reference. the name of the reference. if {@code true} and {@code name} is currently a , the update will replace it with an . Otherwise, the update will recursively traverse s and operate on the leaf . a new update for the requested name; never null. Create a new update command to rename a reference. name of reference to rename from name of reference to rename to an update command that knows how to rename a branch to another. Read a single reference. Aside from taking advantage of , this method may be able to more quickly resolve a single reference name than obtaining the complete namespace by {@code getRefs(ALL).get(name)}. the name of the reference. May be a short name which must be searched for using the standard {@link #SEARCH_PATH}. the reference (if it exists); else {@code null}. Get a section of the reference namespace. prefix to search the namespace with; must end with {@code /}. If the empty string (), obtain a complete snapshot of all references. modifiable map that is a complete snapshot of the current reference namespace, with {@code prefix} removed from the start of each key. The map can be an unsorted map. Peel a possibly unpeeled reference by traversing the annotated tags. If the reference cannot be peeled (as it does not refer to an annotated tag) the peeled id stays null, but will be true. Implementors should check before performing any additional work effort. The reference to peel {@code ref} if {@code ref.isPeeled()} is true; otherwise a new Ref object representing the same data as Ref, but isPeeled() will be true and getPeeledObjectId() will contain the peeled object (or null). Traditional file system based {@link RefDatabase}. This is the classical reference database representation for a Git repository. References are stored in two formats: loose, and packed. Loose references are stored as individual files within the {@code refs/} directory. The file name matches the reference name and the file contents is the current {@link ObjectId} in string form. Packed references are stored in a single text file named {@code packed-refs}. In the packed format, each reference is stored on its own line. This file reduces the number of files needed for large reference spaces, reducing the overall size of a Git repository on disk. Magic string denoting the start of a symbolic reference file. Magic string denoting the header of a packed-refs file. If in the header, denotes the file has peeled data. Immutable sorted list of loose references. Symbolic references in this collection are stored unresolved, that is their target appears to be a new reference with no ObjectId. These are converted into resolved references during a get operation, ensuring the live value is always returned. Immutable sorted list of packed references. Number of modifications made to this database. This counter is incremented when a change is made, or detected from the filesystem during a read operation. Last that we sent to listeners. This value is compared to , and a notification is sent to the listeners only when it differs. Create a reference update to write a temporary reference. an update for a new temporary reference. Locate the file on disk for a single reference name. name of the ref, relative to the Git repository top level directory (so typically starts with refs/). the loose file location. Locate the log file on disk for a single reference name. name of the ref, relative to the Git repository top level directory (so typically starts with refs/). the log file location. A reference that indirectly points at another . A symbolic reference always derives its current value from the target reference. Create a new ref pairing. name of this ref. the ref we reference and derive our value from. Rename any reference stored by {@link RefDirectory}. This class works by first renaming the source reference to a temporary name, then renaming the temporary name to the destination reference. This strategy permits switching a reference like {@code refs/heads/foo}, which is a file, to {@code refs/heads/foo/bar}, which is stored inside a directory that happens to match the source name. A RefUpdate combination for renaming a reference. If the source reference is currently pointed to by {@code HEAD}, then the HEAD symbolic reference is updated to point to the new destination. Update operation to read and delete the source reference. Update operation to create/overwrite the destination reference. Initialize a new rename operation. operation to read and delete the source. operation to create (or overwrite) the destination. identity of the user making the change in the reflog. Set the identity of the user appearing in the reflog. The timestamp portion of the identity is ignored. A new identity with the current timestamp will be created automatically when the rename occurs and the log record is written. identity of the user. If null the identity will be automatically determined based on the repository configuration. Get the message to include in the reflog. message the caller wants to include in the reflog; null if the rename should not be logged. Set the message to include in the reflog. the message to describe this change. Don't record this rename in the ref's associated reflog. result of rename operation the result of the new ref update the result of the rename operation. true if the {@code Constants#HEAD} reference needs to be linked to the new destination name. The value of the source reference at the start of the rename. At the end of the rename the destination reference must have this same value, otherwise we have a concurrent update and the rename must fail without making any changes. True if HEAD must be moved to the destination reference. A reference we backup {@link #objId} into during the rename. Updates any reference stored by . Creates, updates or deletes any reference. New value the caller wants this ref to have. Does this specification ask for forced updated (rewind/reset)? Identity to record action as within the reflog. Message the caller wants included in the reflog. Should the Result value be appended to . Old value of the ref, obtained after we lock it. If non-null, the value {@link #oldValue} must have to continue. Result of the update operation. the reference database this update modifies. the repository storing the database's objects. Try to acquire the lock on the reference. If the locking was successful the implementor must set the current identity value by calling . true if the lock should be taken against the leaf level reference; false if it should be taken exactly against the current reference. true if the lock was acquired and the reference is likely protected from concurrent modification; false if it failed. Releases the lock taken by {@link #tryLock} if it succeeded. identity of the user making the change in the reflog. Set the identity of the user appearing in the reflog. The timestamp portion of the identity is ignored. A new identity with the current timestamp will be created automatically when the update occurs and the log record is written. identity of the user. If null the identity will be automatically determined based on the repository configuration. Get the message to include in the reflog. message the caller wants to include in the reflog; null if the update should not be logged. {@code true} if the ref log message should show the result. Set the message to include in the reflog. the message to describe this change. It may be null if appendStatus is null in order not to append to the reflog true if the status of the ref change (fast-forward or forced-update) should be appended to the user supplied message. Don't record this update in the ref's associated reflog. Force the ref to take the new value. This is just a convenient helper for setting the force flag, and as such the merge test is performed. the result status of the update. Gracefully update the ref to the new value. Merge test will be performed according to . This is the same as:
            return update(new RevWalk(getRepository()));
            
the result status of the update.
Gracefully update the ref to the new value. Merge test will be performed according to . a RevWalk instance this update command can borrow to perform the merge test. The walk will be reset to perform the test. the result status of the update. Delete the ref. This is the same as:
            return delete(new RevWalk(getRepository()));
            
the result status of the delete.
Delete the ref. a RevWalk instance this delete command can borrow to perform the merge test. The walk will be reset to perform the test. the result status of the delete. Replace this reference with a symbolic reference to another reference. This exact reference (not its traversed leaf) is replaced with a symbolic reference to the requested name. name of the new target for this reference. The new target name must be absolute, so it must begin with {@code refs/}. or on success. name of the underlying ref this update will operate on. the reference this update will create or modify. new value the ref will be (or was) updated to. the expected value of the ref after the lock is taken, but before update occurs. Null to avoid the compare and swap test. Use to indicate expectation of a non-existant ref. Will this update want to forcefully change the ref, this ignoring merge results ? The old value of the ref, prior to the update being attempted. This value may differ before and after the update method. Initially it is populated with the value of the ref before the lock is taken, but the old value may change if someone else modified the ref between the time we last read it and when the ref was locked for update. Get the status of this update. The same value that was previously returned from an update method. Status of an update request. The ref update/delete has not been attempted by the caller. The ref could not be locked for update/delete. This is generally a transient failure and is usually caused by another process trying to access the ref at the same time as this process was trying to update it. It is possible a future operation will be successful. Same value already stored. Both the old value and the new value are identical. No change was necessary for an update. For delete the branch is removed. The ref was created locally for an update, but ignored for delete. The ref did not exist when the update started, but it was created successfully with the new value. The ref had to be forcefully updated/deleted. The ref already existed but its old value was not fully merged into the new value. The configuration permitted a forced update to take place, so ref now contains the new value. History associated with the objects not merged may no longer be reachable. The ref was updated/deleted in a fast-forward way. The tracking ref already existed and its old value was fully merged into the new value. No history was made unreachable. Not a fast-forward and not stored. The tracking ref already existed but its old value was not fully merged into the new value. The configuration did not allow a forced update/delete to take place, so ref still contains the old value. No previous history was lost. Rejected because trying to delete the current branch. Has no meaning for update. The ref was probably not updated/deleted because of I/O error. Unexpected I/O error occurred when writing new ref. Such error may result in uncertain state, but most probably ref was not updated. This kind of error doesn't include {@link #LOCK_FAILURE}, which is a different case. The ref was renamed from another name Handle the abstraction of storing a ref update. This is because both updating and deleting of a ref have merge testing in common. Utility for reading reflog entries. Parsed reflog entry. Get the last entry in the reflog. The latest reflog entry, or null if no log. all reflog entries in reverse order. Max number of entries to read. All reflog entries in reverse order. Gets the commit id before the change. Gets the commit id after the change. Gets the user performing the change. Gets the textual description of the change. Represents a Git repository. A repository holds all objects and refs used for managing source code (could by any type of file, but source code is what SCM's are typically used for). In Git terms all data is stored in GIT_DIR, typically a directory called .git. A work tree is maintained unless the repository is a bare repository. Typically the .git directory is located at the root of the work dir.
  • GIT_DIR
    • objects/ - objects
    • refs/ - tags and heads
    • config - configuration
    • info/ - more configurations
This class is thread-safe. This implementation only handles a subtly undocumented subset of git features.
Construct a representation of a Git repository. The work tree, object directory, alternate object directories and index file locations are deduced from the given git directory and the default rules. GIT_DIR (the location of the repository metadata). Construct a representation of a Git repository. The work tree, object directory, alternate object directories and index file locations are deduced from the given git directory and the default rules. GIT_DIR (the location of the repository metadata). GIT_WORK_TREE (the root of the checkout). May be null for default value. Construct a representation of a Git repository using the given parameters possibly overriding default conventions.. GIT_DIR (the location of the repository metadata). May be null for default value in which case it depends on GIT_WORK_TREE. GIT_WORK_TREE (the root of the checkout). May be null for default value if GIT_DIR is GIT_OBJECT_DIRECTORY (where objects and are stored). May be null for default value. Relative names ares resolved against GIT_WORK_TREE GIT_ALTERNATE_OBJECT_DIRECTORIES (where more objects are read from). May be null for default value. Relative names ares resolved against GIT_WORK_TREE GIT_INDEX_FILE (the location of the index file). May be null for default value. Relative names ares resolved against GIT_WORK_TREE. Create a new Git repository initializing the necessary files and directories. Create a new Git repository initializing the necessary files and directories. if true, a bare repository is created. Override default workdir the work tree directory Construct a filename where the loose object having a specified SHA-1 should be stored. If the object is stored in a shared repository the path to the alternative repo will be returned. If the object is not yet store a usable path in this repo will be returned. It is assumed that callers will look for objects in a pack first. Suggested file name true if the specified object is stored in this repo or any of the known shared repositories. Temporary working space associated with the calling thread. SHA-1 of an object. A for accessing the data of the named object, or null if the object does not exist. SHA-1 of an object. A for accessing the data of the named object, or null if the object does not exist. Open object in all packs containing specified object. id of object to search for Temporary working space associated with the calling thread. Collection of loaders for this object, from all packs containing this object Open object in all packs containing specified object. of object to search for Result collection of loaders for this object, filled with loaders from all packs containing specified object Temporary working space associated with the calling thread. SHA'1 of a blob An for accessing the data of a named blob SHA'1 of a tree An for accessing the data of a named tree Access a Commit object using a symbolic reference. This reference may be a SHA-1 or ref in combination with a number of symbols translating from one ref or SHA1-1 to another, such as HEAD^ etc. a reference to a git commit object A named by the specified string Access a Commit by SHA'1 id. Commit or null Access any type of Git object by id and SHA-1 of object to read optional, only relevant for simple tags The Git object if found or null Access a Tree object using a symbolic reference. This reference may be a SHA-1 or ref in combination with a number of symbols translating from one ref or SHA1-1 to another, such as HEAD^{tree} etc. a reference to a git commit object a Tree named by the specified string Access a Tree by SHA'1 id. Tree or null Access a tag by symbolic name. Tag or null Access a Tag by SHA'1 id Commit or null Create a command to update (or create) a ref in this repository. name of the ref the caller wants to modify. An update command. The caller must finish populating this command and then invoke one of the update methods to actually make a change. Create a command to update, create or delete a ref in this repository. name of the ref the caller wants to modify. true to create a detached head An update command. The caller must finish populating this command and then invoke one of the update methods to actually make a change. Create a command to rename a ref in this repository Name of ref to rename from. Name of ref to rename to. An update command that knows how to rename a branch to another. The rename could not be performed. Parse a git revision string and return an object id. Currently supported is combinations of these.
  • SHA-1 - a SHA-1
  • refs/... - a ref name
  • ref^n - nth parent reference
  • ref~n - distance via parent reference
  • ref@{n} - nth version of ref
  • ref^{tree} - tree references by ref
  • ref^{commit} - commit references by ref
Not supported is
  • timestamps in reflogs, ref@{full or relative timestamp}
  • abbreviated SHA-1's
A git object references expression. An or null if revstr can't be resolved to any . On serious errors.
Close all resources used by this repository the index file location Replaces any windows director separators (backslash) with / Strip work dir and return normalized repository path Work directory File whose path shall be stripp off it's workdir Normalized repository relative path Register a {@link RepositoryListener} which will be notified when ref changes are detected. @param l Remove a registered {@link RepositoryListener} @param l Register a global {@link RepositoryListener} which will be notified when a ref changes in any repository are detected. @param l Remove a globally registered {@link RepositoryListener} @param l Force a scan for changed refs. @throws IOException mutable map of all known refs (heads, tags, remotes). mutable map of all tags; key is short tag name ("v1.0") and value of the entry contains the ref with the full tag name ("refs/tags/v1.0"). @return a map with all objects referenced by a peeled ref. Check validity of a ref name. It must not contain character that has a special meaning in a Git object reference expression. Some other dangerous characters are also excluded. Returns true if is a valid ref name. Get the short name of the current branch that {@code HEAD} points to. This is essentially the same as {@link #getFullBranch()}, except the leading prefix {@code refs/heads/} is removed from the reference before it is returned to the caller. name of current branch (for example {@code master}), or an ObjectId in hex format if the current branch is detached. A more user friendly ref name A for the supplied , or null if the named ref does not exist. The could not be accessed. The reference database which stores the reference namespace. Gets a representation of the index associated with this repo Gets the state Get the name of the reference that {@code HEAD} points to. Returns name of current branch (for example {@code refs/heads/master}) or an ObjectId in hex format if the current branch is detached. This is essentially the same as doing: return getRef(Constants.HEAD).getTarget().getName() Except when HEAD is detached, in which case this method returns the current ObjectId in hexadecimal string format. Invoked when a ref changes @param e information about the changes. Invoked when the index changes @param e information about the changes. @return the live instance to read system properties. @param newReader the new instance to use when accessing properties. Gets the hostname of the local host. If no hostname can be found, the hostname is set to the default value "localhost". @return the canonical hostname @param variable system variable to read @return value of the system variable * @param key of the system property to read * @return value of the system property @return the git configuration found in the user home @return the current system time @param when TODO @return the local time zone Returns Windows, Linux or Mac for identification of the OS in use Operating System name Returns the GitSharp configuration file from the OS-dependant location. Returns the GitSharp configuration file based on a user-specified location. Construct a new, yet unnamed Tag. @param db Construct a Tag representing an existing with a known name referencing an known object. This could be either a simple or annotated tag. @param db {@link Repository} @param id target id. @param refName tag name or null @param raw data of an annotated tag. Store a tag. If author, message or type is set make the tag an annotated tag. @ @return tagger of a annotated tag or null @return comment of an annotated tag, or null @return creator of this tag. @return tag target type the SHA'1 of the object this tag refers to Id of the object this tag refers to A representation of a Git tree entry. A Tree is a directory in Git. Compare two names represented as bytes. Since git treats names of trees and blobs differently we have one parameter that represents a '/' for trees. For other objects the value should be NUL. The names are compare by their positive byte value (0..255). A blob and a tree with the same name will not compare equal. name name '/' if a is a tree, else NULL. '/' if b is a tree, else NULL. < 0 if a is sorted before b, 0 if they are the same, else b Compare two names represented as bytes. Since git treats names of trees and blobs differently we have one parameter that represents a '/' for trees. For other objects the value should be NUL. The names are compare by their positive byte value (0..255). A blob and a tree with the same name will not compare equal. '/' if a is a tree, else NULL. '/' if b is a tree, else NULL. Return < 0 if a is sorted before b, 0 if they are the same, else b Constructor for a new Tree The repository that owns the Tree. Construct a Tree object with known content and hash value Construct a new Tree under another Tree Construct a Tree with a known SHA-1 under another tree. Data is not yet specified and will have to be loaded on demand. Forget the in-memory data for this tree. Adds a new or existing file with the specified name to this tree. Trees are added if necessary as the name may contain '/':s. Name A for the added file. Adds a new or existing file with the specified name to this tree. Trees are added if necessary as the name may contain '/':s. an array containing the name when the name starts in the tree. A for the added file. Adds a new or existing Tree with the specified name to this tree. Trees are added if necessary as the name may contain '/':s. A for the added tree. Adds a new or existing Tree with the specified name to this tree. Trees are added if necessary as the name may contain '/':s. an array containing the name when the name starts in the tree. A for the added tree. Add the specified tree entry to this tree. Path to the tree. True if a tree with the specified path can be found under this tree. True if a blob or symlink with the specified name can be found under this tree. a representing an object with the specified relative path. Tree name return a with the name treeName or null Returns true of the data of this Tree is loaded. Gets the number of members in this tree. Return all members of the tree sorted in Git order. Entries are sorted by the numerical unsigned byte values with (sub)trees having an implicit '/'. An example of a tree with three entries. a:b is an actual file name here. 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 a.b 040000 tree 4277b6e69d25e5efa77c455340557b384a4c018a a 100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 a:b All entries in this Tree, sorted. Construct a for visiting all non-tree nodes. Construct a for visiting all nodes in a tree in a given order Root node Construct a . First node to visit Visitation True to include tree node Traversal order Visit node first, then leaves Visit leaves first, then node Abstract TreeVisitor for visiting all files known by a Tree. Loose object loader. This class loads an object not stored in a pack. Construct an ObjectLoader to read from the file. location of the loose object to read. Expected identity of the object being loaded, if known. The loose object file does not exist. The loose object file exists, but is corrupt. Construct an ObjectLoader from a loose object's compressed form. Entire content of the loose object file. The compressed data supplied does not match the format for a valid loose object. Reader for a non-delta (just deflated) object in a pack file. Caches slices of a in memory for faster read access. The WindowCache serves as a Java based "buffer cache", loading segments of a into the JVM heap prior to use. As JGit often wants to do reads of only tiny slices of a file, the WindowCache tries to smooth out these tiny reads into larger block-sized IO operations. Modify the configuration of the window cache. The new configuration is applied immediately. If the new limits are smaller than what what is currently cached, older entries will be purged as soon as possible to allow the cache to meet the new limit. Maximum number of bytes to hold within this instance. Number of bytes per window within the cache. True to enable use of mmap when creating windows. Number of bytes to hold in the delta base cache. Modify the configuration of the window cache. The new configuration is applied immediately. If the new limits are smaller than what what is currently cached, older entries will be purged as soon as possible to allow the cache to meet the new limit. The new window cache configuration. Configuration parameters for . 1024 (number of bytes in one kibibyte/kilobyte) 1024 (number of bytes in one mebibyte/megabyte) Create a default configuration. Update properties by setting fields from the configuration. If a property is not defined in the configuration, then it is left unmodified. Configuration to read properties from. The maximum number of streams to open at a time. Open packs count against the process limits. Default is 128. maximum number bytes of heap memory to dedicate to caching pack file data. Default is 10 MB. Gets/Sets the size in bytes of a single window read in from the pack file. Gets/sets the use of Java NIO virtual memory mapping for windows; false reads entire window into a byte[] with standard read calls. Gets/Sets the maximum number of bytes to cache in for inflated, recently accessed objects, without delta chains. Default 10 MB. Active handle to a ByteWindow. Copy bytes from the window to a caller supplied buffer. The file the desired window is stored within. Position within the file to read from. Destination buffer to copy into. Offset within to start copying into. The number of bytes to copy. This value may exceed the number of bytes remaining in the window starting at offset . number of bytes actually copied; this may be less than if exceeded the number of bytes available. This cursor does not match the provider or id and the proper window could not be acquired through the provider's cache. Pump bytes into the supplied inflater as input. The file the desired window is stored within. Position within the file to read from. Destination buffer the inflater should output decompressed data to. Current offset within to inflate into. Updated based on the number of bytes successfully inflated into . this cursor does not match the provider or id and the proper window could not be acquired through the provider's cache. Release the current window cursor. Release the window cursor. cursor to Release; may be null. always null Temporary buffer large enough for at least one raw object id. This class handles checking out one or two trees merging with the index (actually a tree too). Three-way merges are no performed. See . Create a checkout class for checking out one tree, merging with the index workdir current index tree to check out Create a checkout class for merging and checking our two trees and the index. workdir Execute this checkout If true, will scan first to see if it's possible to check out, otherwise throw . If false, it will silently deal with the problem. The list of conflicts created by this checkout The list of all files removed by this checkout A tree visitor for writing a directory tree to the git object database. Blob data is fetched from the files, not the cached blobs. Construct a WriteTree for a given directory