@content_git_object_init.connect
def filetime_from_git(content, git_content):
 if (not content.settings['GIT_FILETIME_FROM_GIT']):
  return
 if (not string_to_bool(content.metadata.get('gittime', 'yes'))):
  return
 path = content.source_path
 fs_creation_time = datetime_from_timestamp(os.stat(path).st_ctime, content)
 fs_modified_time = datetime_from_timestamp(os.stat(path).st_mtime, content)
 if git_content.is_managed_by_git():
  if git_content.is_committed():
   content.date = git_content.get_oldest_commit_date()
   if git_content.is_modified():
    content.modified = fs_modified_time
   else:
    content.modified = git_content.get_newest_commit_date()
  else:
   content.date = fs_creation_time
 else:
  content.date = fs_creation_time
 if (not hasattr(content, 'modified')):
  content.modified = content.date
 if hasattr(content, 'date'):
  content.locale_date = strftime(content.date, content.date_format)
 if hasattr(content, 'modified'):
  content.locale_modified = strftime(content.modified, content.date_format)

@ content_git_object_init . connect def filetime_from_git ( content , git_content ) : if ( not content . settings [ 'GIT_FILETIME_FROM_GIT' ] ) : return if ( not string_to_bool ( content . metadata . get ( 'gittime' , 'yes' ) ) ) : return path = content . source_path fs_creation_time = datetime_from_timestamp ( os . stat ( path ) . st_ctime , content ) fs_modified_time = datetime_from_timestamp ( os . stat ( path ) . st_mtime , content ) if git_content . is_managed_by_git ( ) : if git_content . is_committed ( ) : content . date = git_content . get_oldest_commit_date ( ) if git_content . is_modified ( ) : content . modified = fs_modified_time else : content . modified = git_content . get_newest_commit_date ( ) else : content . date = fs_creation_time else : content . date = fs_creation_time if ( not hasattr ( content , 'modified' ) ) : content . modified = content . date if hasattr ( content , 'date' ) : content . locale_date = strftime ( content . date , content . date_format ) if hasattr ( content , 'modified' ) : content . locale_modified = strftime ( content . modified , content . date_format )
update modification and creation times from git .