Re: Testing for commit reachability through plumbing commands

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 06, 2014 at 12:17:34PM -0500, Martin Langhoff wrote:

> I have a shell script that trims old history on a cronjob. This is for
> a repo that is used to track reports that have limited "life" (like
> logs). Old history is trimmed with grafts pointing to an empty "root"
> commit.
> 
> Right now, info/graft grows unbound. I am looking for a way to trim
> unreachable grafts, I would like to be able to say something like:
> 
>  git is-reachable treeish

How about:

    git rev-list --objects --all |
    cut -d' ' -f1 |
    grep $(git rev-parse treeish)

Add "--reflog" to the rev-list invocation if you want to catch things
referenced by the reflog, too.

If you're looking for a commit, you can drop the "--objects", and it
will run much faster.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]