From d56d280be7ae69ce192c89d56b659df8c481cc7d Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Tue, 26 Feb 2013 11:26:00 +0000 Subject: [PATCH] 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 --- layerindex/update.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/layerindex/update.py b/layerindex/update.py index 52de4fe..497445a 100755 --- a/layerindex/update.py +++ b/layerindex/update.py @@ -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