Re: verifying commit IDs

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

 



Paul Mackerras wrote:
Is there a fast and easy way to find out which of a set of SHA1 ids
refer to commits that (still) exist in a repository?

This is for use in gitk and there could be several ids, so I'd prefer
to avoid a fork/exec per id.  I could do a git cat-file -t $id for
each id, but that's a fork/exec per id.  git rev-parse doesn't check
whether an id actually refers to an existing commit, so it isn't the
answer.


Assuming you have a completely random set of ids, I think the easiest
way to do it would be to extend git-cat-file to accept several ids
and then parse the error output from that.

What I want to be able to do is to cache the condensed topology
information that gitk uses for working out next/previous tags.  But
when I read in the cache I need to be able to know if the topology
includes commits that used to exist but have now been removed.  Hence
my question.


I'm assuming you will still have to do git-rev-list to get the new commits
since the last known location of a branch head. If so, git rev-list <bogus-sha1>..<rewound-branch-tip> should be enough to
tell you you need to re-read that branch's entire history.

I just got up though, and since I don't drink coffee, waking up is a lengthy
process for me.

--
Andreas Ericsson                   andreas.ericsson@xxxxxx
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231
-
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]

  Powered by Linux