cat-file

NAME

git-cat-file - Provide content or type and size information for repository objectsgit-cat-file - リポジトリオブジェクトの内容や種類、サイズ情報を提供する

SYNOPSIS概要

git cat-file (-t [--allow-unknown-type]| -s [--allow-unknown-type]| -e | -p | <type> | --textconv | --filters ) [--path=<path>] <object>
git cat-file (--batch | --batch-check) [ --textconv | --filters ] [--follow-symlinks]

DESCRIPTION説明

In its first form, the command provides the content or the type of an object in the repository. The type is required unless -t or -p is used to find the object type, or -s is used to find the object size, or --textconv or --filters is used (which imply type "blob").最初の形式では、コマンドはリポジトリ内のオブジェクトの内容または種類を提供します。型がない限り、必要とされる-tか、-pオブジェクトの種類を見つけるために使用される、または-sオブジェクトのサイズを見つけるために使用され、または--textconvまたは--filters(タイプ「ブロブ」を暗示する)に使用されます。

In the second form, a list of objects (separated by linefeeds) is provided on stdin, and the SHA-1, type, and size of each object is printed on stdout. The output format can be overridden using the optional <format> argument. If either --textconv or --filters was specified, the input is expected to list the object names followed by the path name, separated by a single whitespace, so that the appropriate drivers can be determined.2番目の形式では、(改行で区切られた)オブジェクトのリストが標準入力に表示され、各オブジェクトのSHA-1、タイプ、およびサイズが標準出力に出力されます。出力形式は、オプションの<format>引数を使用して上書きできます。--textconvまたはのいずれか--filtersが指定された場合、適切なドライバを決定できるように、入力にはオブジェクト名の後にパス名を1つの空白で区切ってリストすることが期待されます。

OPTIONSオプション

<object> <オブジェクト>

The name of the object to show. For a more complete list of ways to spell object names, see the "SPECIFYING REVISIONS" section in gitrevisions[7].表示するオブジェクトの名前。オブジェクト名をつづる方法のより完全なリストについては、gitrevisions [7]の "リビジョンの指定"セクションを見てください。

-t

Instead of the content, show the object type identified by <object>.コンテンツの代わりに、<object>によって識別されるオブジェクトタイプを表示します。

-s

Instead of the content, show the object size identified by <object>.内容の代わりに、<object>で識別されるオブジェクトサイズを表示します。

-e

Exit with zero status if <object> exists and is a valid object. If <object> is of an invalid format exit with non-zero and emits an error on stderr.<object>が存在し、それが有効なオブジェクトである場合は、状況0で終了します。<object>が無効なフォーマットの場合、ゼロ以外の値で終了し、stderrにエラーを生成します。

-p

Pretty-print the contents of <object> based on its type.型に基づいて<object>の内容をきれいに表示します。

<type> <タイプ>

Typically this matches the real type of <object> but asking for a type that can trivially be dereferenced from the given <object> is also permitted. An example is to ask for a "tree" with <object> being a commit object that contains it, or to ask for a "blob" with <object> being a tag object that points at it.通常これは実際の<object>の型と一致しますが、与えられた<object>から自明に間接参照できる型を要求することもできます。例としては、<object>がそれを含むコミットオブジェクトである「ツリー」を要求すること、または<object>がそれを指すタグオブジェクトである「blob」を要求することです。

--textconv

Show the content as transformed by a textconv filter. In this case, <object> has to be of the form <tree-ish>:<path>, or :<path> in order to apply the filter to the content recorded in the index at <path>.textconvフィルタによって変換されたコンテンツを表示します。この場合、<path>のインデックスに記録されたコンテンツにフィルタを適用するには、<object>は<tree-ish>:<path>、または:<path>の形式でなければなりません。

--filters - フィルタ

Show the content as converted by the filters configured in the current working tree for the given <path> (i.e. smudge filters, end-of-line conversion, etc). In this case, <object> has to be of the form <tree-ish>:<path>, or :<path>.与えられた<path>用に現在のワーキングツリーで設定されているフィルタ(つまり、汚いフィルタ、行末変換など)によって変換された内容を表示します。この場合、<object>は<tree-ish>:<path>、または:<path>の形式でなければなりません。

--path=<path> --path = <パス>

For use with --textconv or --filters, to allow specifying an object name and a path separately, e.g. when it is difficult to figure out the revision from which the blob came.--textconvまたは--filtersと一緒に使用して、オブジェクト名とパスを別々に指定できるようにします。たとえば、BLOBの元のリビジョンを把握するのが難しい場合などです。

--batch - バッチ
--batch=<format> --batch = <フォーマット>

Print object information and contents for each object provided on stdin. May not be combined with any other options or arguments except --textconv or --filters, in which case the input lines also need to specify the path, separated by whitespace. See the section BATCH OUTPUT below for details.stdinで提供された各オブジェクトのオブジェクト情報と内容を印刷します。他のオプションや引数を除くと組み合わせることがないかもしれない--textconvか、--filters入力ラインはまた、空白で区切られたパスを指定する必要がある場合には、。詳細についてはBATCH OUTPUT以下のセクションを参照してください。

--batch-check - バッチチェック
--batch-check=<format> --batch-check = <フォーマット>

Print object information for each object provided on stdin. May not be combined with any other options or arguments except --textconv or --filters, in which case the input lines also need to specify the path, separated by whitespace. See the section BATCH OUTPUT below for details.標準入力で提供される各オブジェクトのオブジェクト情報を印刷します。他のオプションや引数を除くと組み合わせることがないかもしれない--textconvか、--filters入力ラインはまた、空白で区切られたパスを指定する必要がある場合には、。詳細についてはBATCH OUTPUT以下のセクションを参照してください。

--batch-all-objects

Instead of reading a list of objects on stdin, perform the requested batch operation on all objects in the repository and any alternate object stores (not just reachable objects). Requires --batch or --batch-check be specified. Note that the objects are visited in order sorted by their hashes.stdin上のオブジェクトのリストを読み取る代わりに、(到達可能なオブジェクトだけではなく)リポジトリ内のすべてのオブジェクトおよび代替オブジェクトストアに対して要求されたバッチ操作を実行します。必須--batchまたは--batch-check指定されています。オブジェクトはハッシュ順にソートされた順序で訪問されます。

--buffer - バッファ

Normally batch output is flushed after each object is output, so that a process can interactively read and write from cat-file. With this option, the output uses normal stdio buffering; this is much more efficient when invoking --batch-check on a large number of objects.通常、バッチ出力は各オブジェクトの出力後にフラッシュされるので、プロセスは対話的に読み書きできcat-fileます。このオプションを指定すると、出力は通常のstdioバッファリングを使用します。これは--batch-check、多数のオブジェクトを呼び出すときにはるかに効率的です。

--unordered - 順不同

When --batch-all-objects is in use, visit objects in an order which may be more efficient for accessing the object contents than hash order. The exact details of the order are unspecified, but if you do not require a specific order, this should generally result in faster output, especially with --batch. Note that cat-file will still show each object only once, even if it is stored multiple times in the repository.--batch-all-objects使用中の場合は、ハッシュ順よりもオブジェクトの内容にアクセスする方が効率的な順序でオブジェクトにアクセスします。順序の正確な詳細は指定されていませんが、特定の順序を必要としない場合は、特にの場合は特に出力が速くなります--batch。注cat-fileまだそれがリポジトリに複数回保存されている場合でも、一度だけそれぞれのオブジェクトが表示されます。

--allow-unknown-type - 許可不明タイプ

Allow -s or -t to query broken/corrupt objects of unknown type.-sまたは-tが、タイプが不明な壊れた/壊れたオブジェクトを照会することを許可します。

With --batch or --batch-check, follow symlinks inside the repository when requesting objects with extended SHA-1 expressions of the form tree-ish:path-in-tree. Instead of providing output about the link itself, provide output about the linked-to object. If a symlink points outside the tree-ish (e.g. a link to /foo or a root-level link to ../foo), the portion of the link which is outside the tree will be printed.--batchまたは--batch-checkを使用すると、tree-ish:path-in-treeという形式の拡張SHA-1式を持つオブジェクトを要求するときに、リポジトリ内のシンボリックリンクをたどります。リンク自体に関する出力を提供する代わりに、リンク先オブジェクトに関する出力を提供します。シンボリックリンクがツリーのように見えない場合(例:/ fooへのリンクまたは../fooへのルートレベルのリンク)、ツリーの外側にあるリンクの部分が表示されます。

This option does not (currently) work correctly when an object in the index is specified (e.g. :link instead of HEAD:link) rather than one in the tree.このオプションは、ツリー内のオブジェクトでは:linkなく、インデックス内のオブジェクトが指定されている場合には(現在ではなく)(現時点では)正しく機能しませんHEAD:link

This option cannot (currently) be used unless --batch or --batch-check is used.このオプションは、(現在は)しない限り、使用することはできない--batchか、--batch-check使用されています。

For example, consider a git repository containing:たとえば、次のものを含むgitリポジトリを考えます。

f: a file containing "hello\n"
link: a symlink to f
dir/link: a symlink to ../f
plink: a symlink to ../f
alink: a symlink to /etc/passwd

For a regular file f, echo HEAD:f | git cat-file --batch would print通常のファイルのf場合echo HEAD:f | git cat-file --batchは、

ce013625030ba8dba906f756967f9e9ca394464a blob 6

And echo HEAD:link | git cat-file --batch --follow-symlinks would print the same thing, as would HEAD:dir/link, as they both point at HEAD:f.そして、両者が指摘しているecho HEAD:link | git cat-file --batch --follow-symlinksように、同じことを印刷HEAD:dir/linkHEAD:fます。

Without --follow-symlinks, these would print data about the symlink itself. In the case of HEAD:link, you would seeそうでなければ--follow-symlinks、これらはシンボリックリンク自身に関するデータを印刷するでしょう。の場合HEAD:link、あなたは見るでしょう

4d1ae35ba2c8ec712fa2a379db44ad639ca277bd blob 1

Both plink and alink point outside the tree, so they would respectively print:両方ともツリーの外側plinkalink指すので、それぞれ次のように出力されます。

symlink 4
../f
symlink 11
/etc/passwd

OUTPUT出力

If -t is specified, one of the <type>.-t指定されている場合は、<タイプ>のいずれか。

If -s is specified, the size of the <object> in bytes.-sが指定されている場合、<オブジェクト>のサイズ(バイト単位)。

If -e is specified, no output, unless the <object> is malformed.場合は-e、指定され、出力は、<オブジェクト>がない限り、不正な形式ではありません。

If -p is specified, the contents of <object> are pretty-printed.-pを指定した場合、<object>の内容はきれいに印刷されます。

If <type> is specified, the raw (though uncompressed) contents of the <object> will be returned.<type>が指定されている場合、<object>の生の(圧縮されていないが)内容が返されます。

BATCH OUTPUTバッチ出力

If --batch or --batch-check is given, cat-file will read objects from stdin, one per line, and print information about them. By default, the whole line is considered as an object, as if it were fed to git-rev-parse[1].場合--batchまたは--batch-check指定され、cat-file標準入力から1行につき1つのオブジェクトを読み、それらについての印刷情報になります。デフォルトでは、まるでgit-rev-parse [1]に入力されたかのように、行全体がオブジェクトと見なされます。

You can specify the information shown for each object by using a custom <format>. The <format> is copied literally to stdout for each object, with placeholders of the form %(atom) expanded, followed by a newline. The available atoms are:カスタムを使用して、各オブジェクトに表示される情報を指定できます<format><format>フォームのプレースホルダと、オブジェクトごとに標準出力に文字通りコピーされる%(atom)改行に続く拡張します、。利用可能な原子は次のとおりです。

objectname

The 40-hex object name of the object.オブジェクトの40進数のオブジェクト名。

objecttype

The type of the object (the same as cat-file -t reports).オブジェクトのタイプ(cat-file -tレポートと同じ)

objectsize

The size, in bytes, of the object (the same as cat-file -s reports).オブジェクトのサイズ(バイト単位cat-file -s)(レポートと同じ)。

objectsize:disk

The size, in bytes, that the object takes up on disk. See the note about on-disk sizes in the CAVEATS section below.オブジェクトがディスク上で占有するサイズ(バイト単位)。CAVEATS以下のセクションのディスク上のサイズに関する注意を参照してください。

deltabase

If the object is stored as a delta on-disk, this expands to the 40-hex sha1 of the delta base object. Otherwise, expands to the null sha1 (40 zeroes). See CAVEATS below.オブジェクトがデルタとしてディスク上に格納されている場合、これはデルタベースオブジェクトの40-hex sha1に拡張されます。そうでない場合は、null sha1(40個のゼロ)に展開されます。CAVEATS下記を参照してください。

rest

If this atom is used in the output string, input lines are split at the first whitespace boundary. All characters before that whitespace are considered to be the object name; characters after that first run of whitespace (i.e., the "rest" of the line) are output in place of the %(rest) atom.このアトムが出力文字列で使用されている場合、入力行は最初の空白の境界で分割されます。その空白より前の文字はすべてオブジェクト名と見なされます。最初の空白文字の後(すなわち、行の "残り")の文字は、%(rest)アトムの代わりに出力されます。

If no format is specified, the default format is %(objectname) %(objecttype) %(objectsize).形式が指定されていない場合、デフォルトの形式は%(objectname) %(objecttype) %(objectsize)です。

If --batch is specified, the object information is followed by the object contents (consisting of %(objectsize) bytes), followed by a newline.場合--batch、指定された、オブジェクト情報は、オブジェクトの内容(成る続いて%(objectsize)改行に続くバイト)。

For example, --batch without a custom format would produce:たとえば--batch、カスタムフォーマットがないと、次のようになります。

<sha1> SP <type> SP <size> LF
<contents> LF

Whereas --batch-check='%(objectname) %(objecttype)' would produce:一方--batch-check='%(objectname) %(objecttype)'生成します:

<sha1> SP <type> LF

If a name is specified on stdin that cannot be resolved to an object in the repository, then cat-file will ignore any custom format and print:リポジトリ内のオブジェクトに解決できない名前がstdinに指定されている場合は、cat-fileカスタムフォーマットを無視して出力します。

<object> SP missing LF

If a name is specified that might refer to more than one object (an ambiguous short sha), then cat-file will ignore any custom format and print:複数のオブジェクト(あいまいな短いsha)を参照する可能性のある名前が指定されている場合は、cat-fileカスタムフォーマットを無視して出力します。

<object> SP ambiguous LF

If --follow-symlinks is used, and a symlink in the repository points outside the repository, then cat-file will ignore any custom format and print:--follow-symlinksが使用されていて、リポジトリ内のシンボリックリンクがリポジトリ外を指している場合cat-fileは、カスタムフォーマットを無視して出力します。

symlink SP <size> LF
<symlink> LF

The symlink will either be absolute (beginning with a /), or relative to the tree root. For instance, if dir/link points to ../../foo, then <symlink> will be ../foo. <size> is the size of the symlink in bytes.シンボリックリンクは、絶対パス(/で始まる)か、ツリーのルートからの相対パスです。たとえば、dir / linkが../../fooを指している場合、<symlink>は../fooになります。<size>はシンボリックリンクのサイズ(バイト単位)です。

If --follow-symlinks is used, the following error messages will be displayed:--follow-symlinksが使用されている場合、以下のエラーメッセージが表示されます。

<object> SP missing LF

is printed when the initial symlink requested does not exist.要求された最初のシンボリックリンクが存在しない場合に表示されます。

dangling SP <size> LF
<object> LF

is printed when the initial symlink exists, but something that it (transitive-of) points to does not.最初のシンボリックリンクが存在するときには表示されますが、それが指すもの(transitive-of)は存在しません。

loop SP <size> LF
<object> LF

is printed for symlink loops (or any symlinks that require more than 40 link resolutions to resolve).シンボリックリンクループ(または解決するために40を超えるリンク解決を必要とするシンボリックリンク)に対して表示されます。

notdir SP <size> LF
<object> LF

is printed when, during symlink resolution, a file is used as a directory name.シンボリックリンクの解決時に、ファイルがディレクトリ名として使用されている場合に、が表示されます。

CAVEATS警告

Note that the sizes of objects on disk are reported accurately, but care should be taken in drawing conclusions about which refs or objects are responsible for disk usage. The size of a packed non-delta object may be much larger than the size of objects which delta against it, but the choice of which object is the base and which is the delta is arbitrary and is subject to change during a repack.ディスク上のオブジェクトのサイズは正確に報告されていますが、どの参照またはオブジェクトがディスクの使用に責任があるかについての結論を引き出す際には注意が必要です。パックされた非デルタオブジェクトのサイズは、それに対してデルタするオブジェクトのサイズよりはるかに大きくなる可能性がありますが、どのオブジェクトがベースでどれがデルタであるかの選択は任意であり、再パック中に変更されます。

Note also that multiple copies of an object may be present in the object database; in this case, it is undefined which copy’s size or delta base will be reported.オブジェクトデータベースには、オブジェクトの複数のコピーが存在する可能性があることにも注意してください。この場合、どのコピーのサイズまたはデルタベースが報告されるかは未定義です。

GIT

Part of the git[1] suite一部のgit [1]スイート

関連記事

スポンサーリンク

ソース中の改行が空白として表示されないことがある

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る