Re: [PATCH 2/3] revision: exclude trees/blobs given commit
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 28, 2017, 23:12 UTC
- Message-ID
- <xmqqa895j4er.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <7082d91f30663b2e6d7fb1795c5ea37d3fe3446c.1487984670.git.jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 5 quoted lines
> When the --objects argument is given to rev-list, an argument of the > form "^$tree" can be given to exclude all blobs and trees reachable from > that tree, but an argument of the form "^$commit" only excludes that > commit, not any blob or tree reachable from it. Make "^$commit" behave > consistent to "^$tree".
So with this:
$ git rev-list --objects ^HEAD^@ HEAD ^HEAD^{tree}should be a round-about way to say
$ git rev-parse HEAD
;-)
The expression wants to list everything reachable from HEAD, but it does not want to show its parents (i.e. ^HEAD^@) and it does not want to show its tree (i.e. ^HEAD^{tree}), so the only thing that remains is the commit object HEAD and nothing else?
I agree with Peff's comment about objects that may appear beyond the boundary (i.e. merge base between interesting ones and uninteresting ones); whether that inaccuracy matters depends on what you want to use this for---if you want to hide sensitive objects it does, if you want to reduce the network cost without incurring too much cpu cost, it probably does not.