Skip to content

Commit

Permalink
Merge pull request airbnb#58 from airbnb/mw_small_fixes
Browse files Browse the repository at this point in the history
Two trivial fixes: one for initialising a newly checked out repository with the embedded tooling, and one for updating the database when a KnowledgeRepository backend gains the capability of registering UUIDs.
  • Loading branch information
matthewwardrop authored Oct 11, 2016
2 parents 303f184 + 11b841f commit 27008cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion knowledge_repo/app/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def update_index():
kp = kr_dir.pop(post.path)

# Update metadata of post if required
if (kp.revision > post.revision or not post.is_published):
if (kp.revision > post.revision or not post.is_published or kp.uuid != post.uuid):
if kp.is_valid():
logger.info('Recording update to post at: {}'.format(kp.path))
post.update_metadata_from_kp(kp)
Expand Down
5 changes: 4 additions & 1 deletion knowledge_repo/repositories/gitrepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,10 @@ def update(self, branch=None):
break
if sm is not None:
sm_target_url = sm.config_reader().get_value('url')
sm_actual_url = sm.module().git.config('--get', 'remote.origin.url')
try:
sm_actual_url = sm.module().git.config('--get', 'remote.origin.url')
except git.InvalidGitRepositoryError:
sm_actual_url = "the uninitialized state"
if sm_target_url != sm_actual_url:
logging.info('Migrating embedded tooling from {} to {}.'.format(sm_actual_url, sm_target_url))
self.git.git.submodule('sync')
Expand Down

0 comments on commit 27008cb

Please sign in to comment.