summaryrefslogtreecommitdiff
path: root/Documentation
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2013-03-30 06:44:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-02 15:41:17 (GMT)
commit2db60670ba0c6dcaa42ed420f337851eea800bbc (patch)
treee904edfac5450f7d112c744e1d98b8e6bab639c7 /Documentation
parenta6a3f2cc0761a347e8796280a1544e2a0d08cb51 (diff)
downloadgit-2db60670ba0c6dcaa42ed420f337851eea800bbc.zip
git-2db60670ba0c6dcaa42ed420f337851eea800bbc.tar.gz
git-2db60670ba0c6dcaa42ed420f337851eea800bbc.tar.bz2
rev-parse: clarify documentation for the --verify option
The old version could be read to mean that the argument has to refer to a valid object, but that is incorrect: * the object is not necessarily read (e.g., to check for corruption) * if the argument is a 40-digit string of hex digits, then it is accepted whether or not is is the name of an existing object. So reword the explanation to be less ambiguous. Also fix the examples involving --verify: to be sure that the argument refers to a commit (rather than some other kind of object), the argument has to be suffixed with "^{commit}". This trick is not possible in the example involving --default, so don't imply that it is exactly the same as the previous example. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/git-rev-parse.txt19
1 files changed, 15 insertions, 4 deletions
diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
index 3c63561..757d195 100644
--- a/Documentation/git-rev-parse.txt
+++ b/Documentation/git-rev-parse.txt
@@ -60,8 +60,19 @@ OPTIONS
instead.
--verify::
- The parameter given must be usable as a single, valid
- object name. Otherwise barf and abort.
+ Verify that exactly one parameter is provided, and that it
+ can be turned into a raw 20-byte SHA-1 that can be used to
+ access the object database. If so, emit it to the standard
+ output; otherwise, error out.
++
+If you want to make sure that the output actually names an object in
+your object database and/or can be used as a specific type of object
+you require, you can add "^{type}" peeling operator to the parmeter.
+For example, `git rev-parse "$VAR^{commit}"` will make sure `$VAR`
+names an existing object that is a commit-ish (i.e. a commit, or an
+annotated tag that points at a commit). To make sure that `$VAR`
+names an existing object of any type, `git rev-parse "$VAR^{object}"`
+can be used.
-q::
--quiet::
@@ -306,12 +317,12 @@ $ git rev-parse --verify HEAD
* Print the commit object name from the revision in the $REV shell variable:
+
------------
-$ git rev-parse --verify $REV
+$ git rev-parse --verify $REV^{commit}
------------
+
This will error out if $REV is empty or not a valid revision.
-* Same as above:
+* Similar to above:
+
------------
$ git rev-parse --default master --verify $REV