git-cat-file: Add --batch option
[git/dscho.git] / Documentation / git-cat-file.txt
blobf6c394c48240314298dd67716c6d96e6d9704c11
1 git-cat-file(1)
2 ===============
4 NAME
5 ----
6 git-cat-file - Provide content or type/size information for repository objects
9 SYNOPSIS
10 --------
11 'git-cat-file' [-t | -s | -e | -p | <type>] <object>
12 'git-cat-file' [--batch | --batch-check] < <list-of-objects>
14 DESCRIPTION
15 -----------
16 In the first form, provides content or type of objects in the repository. The
17 type is required unless '-t' or '-p' is used to find the object type, or '-s'
18 is used to find the object size.
20 In the second form, a list of object (separated by LFs) is provided on stdin,
21 and the SHA1, type, and size of each object is printed on stdout.
23 OPTIONS
24 -------
25 <object>::
26         The name of the object to show.
27         For a more complete list of ways to spell object names, see
28         "SPECIFYING REVISIONS" section in linkgit:git-rev-parse[1].
30 -t::
31         Instead of the content, show the object type identified by
32         <object>.
34 -s::
35         Instead of the content, show the object size identified by
36         <object>.
38 -e::
39         Suppress all output; instead exit with zero status if <object>
40         exists and is a valid object.
42 -p::
43         Pretty-print the contents of <object> based on its type.
45 <type>::
46         Typically this matches the real type of <object> but asking
47         for a type that can trivially be dereferenced from the given
48         <object> is also permitted.  An example is to ask for a
49         "tree" with <object> being a commit object that contains it,
50         or to ask for a "blob" with <object> being a tag object that
51         points at it.
53 --batch::
54         Print the SHA1, type, size, and contents of each object provided on
55         stdin. May not be combined with any other options or arguments.
57 --batch-check::
58         Print the SHA1, type, and size of each object provided on stdin. May not be
59         combined with any other options or arguments.
61 OUTPUT
62 ------
63 If '-t' is specified, one of the <type>.
65 If '-s' is specified, the size of the <object> in bytes.
67 If '-e' is specified, no output.
69 If '-p' is specified, the contents of <object> are pretty-printed.
71 If <type> is specified, the raw (though uncompressed) contents of the <object>
72 will be returned.
74 If '--batch' is specified, output of the following form is printed for each
75 object specified on stdin:
77 ------------
78 <sha1> SP <type> SP <size> LF
79 <contents> LF
80 ------------
82 If '--batch-check' is specified, output of the following form is printed for
83 each object specified fon stdin:
85 ------------
86 <sha1> SP <type> SP <size> LF
87 ------------
89 For both '--batch' and '--batch-check', output of the following form is printed
90 for each object specified on stdin that does not exist in the repository:
92 ------------
93 <object> SP missing LF
94 ------------
96 Author
97 ------
98 Written by Linus Torvalds <torvalds@osdl.org>
100 Documentation
101 --------------
102 Documentation by David Greaves, Junio C Hamano and the git-list <git@vger.kernel.org>.
106 Part of the linkgit:git[7] suite