Use top commit for subdirectory instead of repository in update script

If there is more than one layer in a repository, we want the latest
commit in the subdirectory not the entire repository (since we use it
to determine the last commit date which should show how "fresh" the
layer is).

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2013-02-26 11:26:00 +00:00
parent e0f8a05423
commit d56d280be7

View File

@ -286,6 +286,12 @@ def main():
repo = git.Repo(repodir)
assert repo.bare == False
topcommit = repo.commit('master')
if layer.vcs_subdir:
# Find latest commit in subdirectory
# A bit odd to do it this way but apparently there's no other way in the GitPython API
for commit in repo.iter_commits(paths=layer.vcs_subdir):
topcommit = commit
break
layerdir = os.path.join(repodir, layer.vcs_subdir)
layerdir_start = os.path.normpath(layerdir) + os.sep