Changeset 27051 in project


Ignore:
Timestamp:
07/12/12 03:01:23 (7 years ago)
Author:
evhan
Message:

git: docs for new 0.17.0 bindings & diff api changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wiki/eggref/4/git

    r26791 r27051  
    184184On success, the on-disk repository is updated immediately.
    185185
     186==== Branch
     187
     188<procedure>(create-branch repository name target [force]) => reference</procedure>
     189
     190Creates a new branch in the given {{repository}} of the given {{name}} and
     191{{target}} and returns a {{reference}} to the new branch. {{target}} must be a
     192{{commit}} or {{tag}} belonging to the repository. If a branch of the given
     193{{name}} exists and {{force}} is not given or {{#f}}, an error is signalled.
     194Otherwise, creation is forced and the old branch is be overwritten.
     195
     196On success, the on-disk repository is updated immediately.
     197
     198<procedure>(branches repository [type]) => list</procedure>
     199
     200Returns a list {{reference}}s to each branch in the given {{repository}}. A
     201{{type}} symbol may be given, either {{'local}} or {{'remote}}, to specify what
     202type of branches should be listed; by default, {{'local}} is used.
     203
     204<procedure>(branch-rename repository old new [force]) => void</procedure>
     205
     206Renames a branch in the given repository from the {{old}} to {{new}}, which
     207should be strings. If a true-valued {{force}} is given and a branch with the
     208new name already exists, it will be overwritten.
     209
     210On success, the on-disk repository is updated immediately.
     211
     212<procedure>(branch-delete repository name [type]) => void</procedure>
     213
     214Deletes the branch with the given {{name}} in the {{repository}}. A {{type}}
     215symbol may be given, either {{'local}} or {{'remote}}, to specify what type of
     216branch should be deleted; by default, {{'local}} is used.
     217
     218On success, the on-disk repository is updated immediately.
     219
    186220==== Generic
    187221
     
    303337On success, the on-disk repository is updated immediately.
    304338
     339<procedure>(merge-base repository commit1 commit2) => commit</procedure>
     340
     341Returns the nearest common ancestor for the given commits. {{commit1}} and
     342{{commit2}} may be {{commit}}s, commit {{oid}}s, or SHA1 hashes.
     343
    305344==== Tag
    306345
     
    340379
    341380<procedure>(tag-target tag) => object</procedure>
    342 
    343 Returns the object referred to by {{tag}}, which will be of type {{commit}},
    344 {{tree}}, {{blob}} or {{tag}}.
     381<procedure>(tag-peel tag) => object</procedure>
     382
     383{{tag-target}} returns the object referred to by {{tag}}, which will be of type
     384{{commit}}, {{tree}}, {{blob}} or {{tag}}.
     385
     386{{tag-peel}} is similar to {{tag-target}}, except that it recursively
     387dereferences the given {{tag}} until a non-tag object is found and returned.
    345388
    346389<procedure>(tag-delete tag) => void</procedure>
     
    400443Creates and returns a {{tree}} object from the state of the given {{index}}.
    401444
     445<procedure>(tree-walk tree fn [mode]) => void</procedure>
     446
     447Invokes the given function {{fn}} on each {{tree-entry}} in the given {{tree}}.
     448A walk order may be specified by the symbol {{mode}}, which should be one of
     449{{'pre}} or {{'post}}.
     450
    402451==== Tree Entry
    403452
     
    464513on-disk repository on success. The resulting {{tree}} is returned.
    465514
    466 ==== Tree Diff
    467 
    468 <record>tree-diff</record>
    469 <procedure>(tree-diff? obj) => boolean</procedure>
    470 
    471 A {{tree-diff}} is the difference of a single file across two Git {{tree}}s.
    472 Each tree-diff has a path, status, and a pair of {{oid}}s and Unix file
    473 attributes (for the older & newer file, respectively).
    474 
    475 <procedure>(tree-diff repository tree1 tree2) => list</procedure>
    476 
    477 Compares two {{tree}}s in the given {{repository}}, returning a list of
    478 {{tree-diff}} objects for every difference between them.
    479 
    480 <procedure>(tree-diff-status tree-diff) => symbol</procedure>
    481 
    482 Returns a symbol representing the diff status of a {{tree-diff}}, which will be
    483 one of {{added}}, {{deleted}}, or {{modified}}.
    484 
    485 <procedure>(tree-diff-path tree-diff)</procedure>
    486 
    487 Returns the path of the given {{tree-diff}}, relative to the repository's
    488 root.
    489 
    490 <procedure>(tree-diff-old-id tree-diff) => oid</procedure>
    491 <procedure>(tree-diff-new-id tree-diff) => oid</procedure>
    492 
    493 Returns the older or newer {{oid}} of the given {{tree-diff}}.
    494 
    495 <procedure>(tree-diff-old-attr tree-diff) => int</procedure>
    496 <procedure>(tree-diff-new-attr tree-diff) => int</procedure>
    497 
    498 Returns the older or newer Unix file attributes of the given {{tree-diff}}.
     515==== Diff
     516
     517<record>diff</record>
     518<procedure>(diff? obj) => boolean</procedure>
     519<record>diff-file</record>
     520<procedure>(diff-file? obj) => boolean</procedure>
     521
     522A {{diff}} is the difference in a single file between two Git {{tree}}s. Each
     523diff has a status, similarity, and a pair of {{diff-file}}s for the old and new
     524files, respectively.
     525
     526Each diff-file has an {{oid}}, {{path}}, and {{mode}} (Unix file attributes).
     527
     528<procedure>(diff repository [tree object]) => list</procedure>
     529
     530Compares a tree to another object in the given {{repository}}, or compares a
     531repository's working directory to its index if no other arguments are given.
     532Returns a list of {{diff}} objects is for every difference between them.
     533
     534{{object}} may be an {{index}}, {{tree}}, or one of the symbols {{'index}} or
     535{{'workdir}} to specify a diff target indirectly.
     536
     537<procedure>(diff-status diff) => symbol</procedure>
     538
     539Returns a symbol representing the status of a {{diff}}, which will be
     540one of the following symbols:
     541
     542    modified
     543    added
     544    deleted
     545    modified
     546    renamed
     547    copied
     548    ignored
     549    untracked
     550
     551<procedure>(diff-similarity diff) => integer</procedure>
     552
     553Returns an integer value from 0 to 100 representing the similarity between a
     554{{diff}}'s old and new files, high values being representing greater
     555similarity.
     556
     557<procedure>(diff-old-file diff)</procedure>
     558<procedure>(diff-new-file diff)</procedure>
     559
     560Returns the {{diff-file}} object for the old and new file of the given
     561{{diff}}, respectively. If the file is added or deleted, {{#f}} will be
     562returned for the diff's old or new file, respectively.
     563
     564<procedure>(diff-file-path diff-file) => string</procedure>
     565
     566Returns the path of the given {{diff-file}}, relative to the repository's root.
     567In the case of a rename, the paths of the old and new {{diff-file}} for a given
     568{{diff}} may be different.
     569
     570<procedure>(diff-file-id diff-file) => oid</procedure>
     571
     572Returns the {{oid}} of the given {{diff-file}}.
     573
     574<procedure>(diff-file-mode diff-file) => int</procedure>
     575
     576Returns the Unix file attributes of the given {{diff-file}}.
     577
     578<procedure>(diff-old-id diff) => oid</procedure>
     579<procedure>(diff-new-id diff) => oid</procedure>
     580<procedure>(diff-old-mode diff) => int</procedure>
     581<procedure>(diff-new-mode diff) => int</procedure>
     582<procedure>(diff-old-path diff) => string</procedure>
     583<procedure>(diff-new-path diff) => string</procedure>
     584
     585Convenience procedures for accessing the fields of a {{diff}} objects's old &
     586new {{diff-file}}s.
     587
     588    (diff-old-id diff) => (diff-file-id (diff-old-file diff))
    499589
    500590==== Status
     
    759849=== History
    760850
     851* 0.0.15 - libgit2 0.17.0 bindings & diff api changes
    761852* 0.0.14 - libgit2 0.17.0 compatibility
    762853* 0.0.13 - libgit2 0.16.0
Note: See TracChangeset for help on using the changeset viewer.