Skip to contentSkip to conversation

document the <tree ish> <file> blob reference syntax

PATCH In review Andy Whitcroft 3 participants 5 messages Aug 11, 2016 Documentation

lore
Share & tools
lore
#3 lore raw
In reply to Andy Whitcroft
Quoted 7 lines · Andy Whitcroft

Documentation/git.txt HEAD:: · line 567

Quoted 3 lines
Documentation/git.txt +3 -0
+For a more complete list of ways to spell object names, see
+"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
+

That section seems to have more compresensive descriptions of the various definitions of commit-ish, but not a tree-ish. Specifically, there is no mentions of tree-ish:file

164 * A suffix ':' followed by a path; this names the blob or tree
165 at the given path in the tree-ish object named by the part
166 before the colon.

#1 lore raw
In reply to Andy Whitcroft
Quoted 5 lines · Andy Whitcroft

It is possible to specify a specific file within a tree-ish symbolically. For example you can find the contents of a specific file in a specific commit as below:

	git cat-file -p v1.2.4:git-prune.sh

Didn't we document this elsewhere recently in git-rev-parse? How about this instead?

-- >8 --
[PATCH] Refer to git-rev-parse:Specifying Revisions from git.txt

The brief list given in "Symbolic Identifiers" section of the main documentation is good enough for overview, but help the reader to find a more comrehensive list as needed.

---
 Documentation/git.txt |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Documentation/git.txt +3 -0
index 3af6fc6..b00607e 100644
@@ -562,6 +562,9 @@ HEAD::
 	a valid head 'name'
 	(i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
 
+For a more complete list of ways to spell object names, see
+"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
+
 
 File/Directory Structure
 ------------------------
Signature · 1 line
1.4.3.2.gc1a4
#2 lore raw
Quoted 28 lines · Junio C Hamano
Quoted 5 lines · Andy Whitcroft

It is possible to specify a specific file within a tree-ish symbolically. For example you can find the contents of a specific file in a specific commit as below:

	git cat-file -p v1.2.4:git-prune.sh

Didn't we document this elsewhere recently in git-rev-parse? How about this instead?

-- >8 --
[PATCH] Refer to git-rev-parse:Specifying Revisions from git.txt

The brief list given in "Symbolic Identifiers" section of the main documentation is good enough for overview, but help the reader to find a more comrehensive list as needed.

---
 Documentation/git.txt |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
Documentation/git.txt +0 -0
index 3af6fc6..b00607e 100644

Documentation/git.txt HEAD:: · line 567

Quoted 6 lines
Documentation/git.txt +3 -0
@@ -562,6 +562,9 @@ HEAD::
 	a valid head 'name'
 	(i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
 
+For a more complete list of ways to spell object names, see
+"SPECIFYING REVISIONS" section in gitlink:git-rev-parse[1].
+

That section seems to have more compresensive descriptions of the various definitions of commit-ish, but not a tree-ish. Specifically, there is no mentions of tree-ish:file

#0 lore raw

PATCH 1/1 document the <tree ish> <file> blob reference syntax

It is possible to specify a specific file within a tree-ish symbolically. For example you can find the contents of a specific file in a specific commit as below:

	git cat-file -p v1.2.4:git-prune.sh

Document this syntax in the Symbolic Identifiers section of the main git documentation and reference it from git-cat-file's documentation.

---

Documentation/git-cat-file.txt +15 -1
index 5e9cbf8..9f2138d 100644
@@ -19,7 +19,9 @@ or '-s' is used to find the object size.
 OPTIONS
 -------
 <object>::
-	The sha1 identifier of the object.
+	The sha1 identifier of the object or a symbolic object
+	reference.  See the Symbolic Identifiers section of the
+	main git manual page.
 
 -t::
 	Instead of the content, show the object type identified by
@@ -58,6 +60,18 @@ Otherwise the raw (though uncompressed) 
 be returned.
 
 
+EXAMPLES
+--------
+git cat-file -p c5a5d29aaacf753b70e715169cbb7f74f0193e4a::
+	Pretty print the object directly using an sha1, perhaps
+	from a git ls-tree output.
+
+git cat-file -p v1.2.4:git-prune.sh::
+	Output the file git-prune.sh from the branch or tag v1.2.4.
+	Note that where the name is ambigious a heads/ or tags/
+	prefix may be used to disambiguate the name.
+
+
 Author
 ------
 Written by Linus Torvalds <[email protected]>
Documentation/git.txt +7 -0
index 7074e32..e9f99e2 100644
@@ -565,6 +565,13 @@ HEAD::
 	a valid head 'name'
 	(i.e. the contents of `$GIT_DIR/refs/heads/<head>`).
 
+Some commands will also accept the following extended syntax:
+
+<tree-ish>:<file>::
+	indicating a specific blob for that file within the tree
+	object specified, which may also be symbolic.  For example
+	'v1.2.4:git-prune.sh'.
+
 
 File/Directory Structure
#4 lore raw
In reply to Junio C Hamano
Quoted 10 lines · Junio C Hamano
Quoted 5 lines · Andy Whitcroft

It is possible to specify a specific file within a tree-ish symbolically.  For example you can find the contents of a specific file in a specific commit as below:

      git cat-file -p v1.2.4:git-prune.sh

Didn't we document this elsewhere recently in git-rev-parse? How about this instead?

Redundancy in documentation is (usually) good idea. Perhaps both?

P.S. "recently" as in "Thu Oct 19 10:04:55 2006 +0700" in 'master', commit v1.4.3-g6b09c78

Signature · 2 lines
Jakub Narebski
Poland