def _collect_files_being_pushed(ref_list, remote):
    if not ref_list:
        return {}
    # avoid testing of non branch pushes (tags for instance) or deletions
    ref_heads_only = [ref for ref in ref_list
                      if ref.local_ref.startswith('refs/heads/')]
    # get branch name from e.g. local_ref='refs/heads/lint_hook'
    branches = [ref.local_ref.split('/')[-1] for ref in ref_heads_only]
    hashes = [ref.local_sha1 for ref in ref_heads_only]
    remote_hashes = [ref.remote_sha1 for ref in ref_heads_only]
    collected_files = {}
    # git allows that multiple branches get pushed simultaneously with the "all"
    # flag. Therefore we need to loop over the ref_list provided.
    for branch, sha1, remote_sha1 in zip(branches, hashes, remote_hashes):
        # git reports the following for an empty / non existing branch
        # sha1: '0000000000000000000000000000000000000000'
        if set(remote_sha1) != {'0'}:
            try:
                modified_files = _compare_to_remote(remote, branch)
            except ValueError as e:
                print e.message
                sys.exit(1)
        else:
            # Get the difference to origin/develop instead
            try:
                modified_files = _compare_to_remote(remote, branch,
                                                    remote_branch='develop')
            except ValueError:
                # give up, return all files in repo
                try:
                    modified_files = _git_diff_name_status(GIT_NULL_COMMIT,
                                                           sha1)
                except ValueError as e:
                    print e.message
                    sys.exit(1)
        files_to_lint = _extract_files_to_lint(modified_files)
        collected_files[branch] = (modified_files, files_to_lint)

    for branch, (modified_files, files_to_lint) in collected_files.iteritems():
        if modified_files:
            print '\nModified files in %s:' % branch
            pprint.pprint(modified_files)
            print '\nFiles to lint in %s:' % branch
            pprint.pprint(files_to_lint)
            print '\n'
    return collected_files
Called when a node creation request has been received.
dataset/ETHPy150Open oppia/oppia/scripts/pre_push_hook.py/_collect_files_being_pushed--crossover with--dataset/ETHPy150Open ralphm/wokkel/wokkel/iwokkel.py/IPubSubResource.create