Re: checking sha1's of files

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

 



On Sun, Feb 08, 2009 at 05:53:31AM -0500, Caleb Cushing wrote:

> > but without knowing what kind of hash they use, I cannot tell you if you
> > can reuse some part of git to compute their hash without using their tools
> > (it also is unclear why you are not using their tool to compute their hash
> > and instead are expecting git to know about the specific hash function
> > used by them).
> 
> I think you misunderstand. I'm not trying to use git to compute their
> hash, I'm trying to replace their hash with git. Once I've figured out
> how to validate the git hash with 'emerge' (said tool) I will be
> removing their hash's.

I'm still not sure I entirely understand what you are trying to do, but
these building blocks may help.

You can see git's idea of the hash of a file in history (or in the
index) by asking rev-parse:

  # hash of 'Makefile' in the most recent commit on the current branch
  $ git rev-parse HEAD:Makefile
  27b9569746179e68c635bdaab8e57395f63faf01

  # hash of 'Makefile' in the index
  $ git rev-parse :Makefile
  27b9569746179e68c635bdaab8e57395f63faf01

  # hash of 'Makefile' in some arbitrary revision
  $ git rev-parse v1.5.1:Makefile
  b159ffd0ae49c28725de6549132e0ad3a3b69d20

And you can compute the git blob hash of any file use git hash-object:

  $ git hash-object --stdin < Makefile
  27b9569746179e68c635bdaab8e57395f63faf01

So if I understand you correctly, you would use the former when
generating your manifests from a revision, and the latter when verifying
the contents of the filesystem against those manifests.

-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]

  Powered by Linux