[Numpy-discussion] whitespace in git repo
Friedrich Romstedt
friedrichromstedt@gmail....
Wed Oct 27 15:41:55 CDT 2010
attribute: 'true', 'false', '<value>', ''
attributes: text, eol, core.autocrlf
filters: left alone.
core.safecrlf: left alone.
results.
normalise: True, False
workingdir_fmt: 'lf', 'crlf'
# Apply text.
# Can be skipped on check-out.
if text == 'true':
normalise = True
elif text == 'false':
normalise = False
elif text == 'auto':
normalise = file_is_text
elif text == '':
if file_is_text and core.autocrlf:
# depends on is_normalised, in_repo
# 0 0: True
# 0 1: False
# 1 0: N/A (does not occur)
# 1 1: True
normalise = not (in_repo and not is_normalised)
# Except it is unnormalised in repo, do normalise.
else:
normalise = False
# SO we should think about "text" as "normalise_preference"
# Two levels of indentation get necessarily prosaic ...
# Define default fmt.
if core.autocrlf:
workingdir_fmt = 'crlf'
else:
workingdir_fmt = core.eol # defaults to native
# Apply eol attribute.
if eol == 'lf':
normalise = True
workingdir_fmt = 'lf'
elif eol == 'crlf':
normalise = True
workingdir_fmt = 'crlf'
else:
pass
# Translation of crlf attribute:
# crlf == 'true' => text = 'true'
# crlf == 'false' => text = 'false'
# crlf == 'input' => eol = 'lf'
CHECKING IN
if normalise:
checkin(normalise(file))
else:
checkin(file)
CHECKING OUT
checkout(file, workingdir_fmt)
NOTES
Files are not changed without a checkin.
So I think Darren's last pull req is just perfect. I was just worried
about the mechanisms that lead to the changes, but when Darren says
they are all okay and sensible then I think they are.
Maybe the pseudo code would be useful for somehow git docs too, I mean
the people who use git are coders and not philologists.
I checked the code but I cannot fully exclude bugs, as usual ..
Friedrich
More information about the NumPy-Discussion
mailing list