Skip to content

Commit 15364d2

Browse files
peffgitster
authored andcommitted
docs: document caveats of rev-list's object-name output
At first glance, the names given by "rev-list --objects" seem like a good way to see which paths are present in a set of commits. But there are some subtle gotchas there. We do not document the format of the names at all, so let's do so, along with warning of these problems. I intentionally did not document the exact format of the names here, as I don't think it's something we want people to rely on (though I doubt in practice that we'd change it at this point). Though all of this is historically tied to "--objects", these days we have a separate "--object-names" flag which can turn the names off or on. So I put the detailed documentation there, but added a note from --objects (which did not otherwise mention the names at all, even though they are on by default). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7556e5d commit 15364d2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Documentation/rev-list-options.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ ifdef::git-rev-list[]
882882
Print the object IDs of any object referenced by the listed
883883
commits. `--objects foo ^bar` thus means ``send me
884884
all object IDs which I need to download if I have the commit
885-
object _bar_ but not _foo_''.
885+
object _bar_ but not _foo_''. See also `--object-names` below.
886886

887887
--in-commit-order::
888888
Print tree and blob ids in order of the commits. The tree
@@ -912,7 +912,12 @@ ifdef::git-rev-list[]
912912

913913
--object-names::
914914
Only useful with `--objects`; print the names of the object IDs
915-
that are found. This is the default behavior.
915+
that are found. This is the default behavior. Note that the
916+
"name" of each object is ambiguous, and mostly intended as a
917+
hint for packing objects. In particular: no distinction is made between
918+
the names of tags, trees, and blobs; path names may be modified
919+
to remove newlines; and if an object would appear multiple times
920+
with different names, only one name is shown.
916921

917922
--no-object-names::
918923
Only useful with `--objects`; does not print the names of the object

0 commit comments

Comments
 (0)