diff options
author | Reid Kleckner <rnk@google.com> | 2017-05-12 00:10:19 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2017-05-12 00:10:19 +0000 |
commit | 0f442bcdd019eebd8350719c8f20a696fe1f0593 (patch) | |
tree | e19243ffb388c752c42c1e55166baf7ac9c53c26 /llvm/utils/git-svn | |
parent | f3e9f12296cb8a5f4d1a0a6d51df654ec6b2d790 (diff) | |
download | bcm5719-llvm-0f442bcdd019eebd8350719c8f20a696fe1f0593.tar.gz bcm5719-llvm-0f442bcdd019eebd8350719c8f20a696fe1f0593.zip |
[git-llvm] Fix svn:eol-style issue for one-file patches
llvm-svn: 302853
Diffstat (limited to 'llvm/utils/git-svn')
-rwxr-xr-x | llvm/utils/git-svn/git-llvm | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/llvm/utils/git-svn/git-llvm b/llvm/utils/git-svn/git-llvm index c2eaa5b6e64..55d3129c4a8 100755 --- a/llvm/utils/git-svn/git-llvm +++ b/llvm/utils/git-svn/git-llvm @@ -205,21 +205,26 @@ def fix_eol_style_native(rev, sr, svn_sr_path): # Use ignore_errors because 'svn propget' prints errors if the file doesn't # have the named property. There doesn't seem to be a way to suppress that. eol_props = svn(svn_sr_path, 'propget', 'svn:eol-style', *files, - ignore_errors=True).split('\n') + ignore_errors=True) crlf_files = [] - for eol_prop in eol_props: - # Remove spare CR. - eol_prop = eol_prop.strip('\r') - if not eol_prop: - continue - prop_parts = eol_prop.rsplit(' - ', 1) - if len(prop_parts) != 2: - eprint("unable to parse svn propget line:") - eprint(eol_prop) - continue - (f, eol_style) = prop_parts - if eol_style == 'native': - crlf_files.append(f) + if len(files) == 1: + # No need to split propget output on ' - ' when we have one file. + if eol_props.strip() == 'native': + crlf_files = files + else: + for eol_prop in eol_props.split('\n'): + # Remove spare CR. + eol_prop = eol_prop.strip('\r') + if not eol_prop: + continue + prop_parts = eol_prop.rsplit(' - ', 1) + if len(prop_parts) != 2: + eprint("unable to parse svn propget line:") + eprint(eol_prop) + continue + (f, eol_style) = prop_parts + if eol_style == 'native': + crlf_files.append(f) # Reformat all files with native SVN line endings to Unix format. SVN knows # files with native line endings are text files. It will commit just the # diff, and not a mass line ending change. |