| #!/usr/bin/env {{ python }} |
| LOCATION = r'{{ location }}' |
| SCRIPTS = os.path.dirname(os.path.dirname(LOCATION)) |
| for line in subprocess.check_output( |
| ['git', 'diff', '--name-only'] + (['--staged'] if staged else []), |
| except subprocess.CalledProcessError: |
| staged = files(staged=True) |
| unstaged = files(staged=False) |
| for line in staged or unstaged: |
| if line.endswith('pbxproj'): |
| project_files.append(line) |
| code = subprocess.run(['perl', os.path.join(SCRIPTS, 'sort-Xcode-project-file')] + project_files).returncode |
| code += subprocess.run(['git', 'add'] + project_files).returncode |