old_contents: # -*- coding: utf-8 -*-
  # vim: tabstop=4 shiftwidth=4 softtabstop=4
  
  # Copyright (c) 2014, GEM Foundation.
  #
  # OpenQuake is free software: you can redistribute it and/or modify it
  # under the terms of the GNU Affero General Public License as published
  # by the Free Software Foundation, either version 3 of the License, or
  # (at your option) any later version.
  #
  # OpenQuake is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU General Public License for more details.
  #
  # You should have received a copy of the GNU Affero General Public License
  # along with OpenQuake.  If not, see <http://www.gnu.org/licenses/>.
  
  
  import os
  import subprocess
  
  
  def git_suffix(fname):
      """
      :returns: `<short git hash>` if Git repository found
      """
      try:
          po = subprocess.check_output(
              ['git', 'rev-parse', '--short', 'HEAD'],
              cwd=os.path.dirname(fname))
          return "-git" + po.stdout.read().strip()
      except:
          # trapping everything on purpose; git may not be installed or it
          # may not work properly
          return ''
  
new_contents: # -*- coding: utf-8 -*-
  # vim: tabstop=4 shiftwidth=4 softtabstop=4
  
  # Copyright (c) 2014, GEM Foundation.
  #
  # OpenQuake is free software: you can redistribute it and/or modify it
  # under the terms of the GNU Affero General Public License as published
  # by the Free Software Foundation, either version 3 of the License, or
  # (at your option) any later version.
  #
  # OpenQuake is distributed in the hope that it will be useful,
  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  # GNU General Public License for more details.
  #
  # You should have received a copy of the GNU Affero General Public License
  # along with OpenQuake.  If not, see <http://www.gnu.org/licenses/>.
  
  
  import os
  import subprocess
  
  
  def git_suffix(fname):
      """
      :returns: `<short git hash>` if Git repository found
      """
      try:
          po = subprocess.check_output(
              ['git', 'rev-parse', '--short', 'HEAD'],
              cwd=os.path.dirname(fname)).strip()
          return "-git" + po
      except:
          # trapping everything on purpose; git may not be installed or it
          # may not work properly
          return ''
  
subject: Fix git version stripping