-
-
Save sigmaris/3bcc088234d2de488258 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pygit2 | |
#created by "git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git" | |
LINUX_REPO = '/home/hugh/linux/.git' | |
repo = pygit2.Repository(LINUX_REPO) | |
# this commit is "shm: optimize locking and ipc_namespace getting" | |
commit = repo['4c677e2eefdba9c5bfc4474e2e91b26ae8458a1d'] | |
tree = commit.tree | |
include = repo[tree['include'].sha] | |
linux = repo[include['linux'].sha] | |
print("Is 'i2c' in include/linux (via iteration)? {0}".format( | |
reduce(lambda a,b: a or b, [entry.name == 'i2c' for entry in linux], False) | |
)) | |
print("Is 'i2c' in include/linux (via 'in')? {0}".format('i2c' in linux)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment