path: root/userdiff.c
diff options
authorJeff King <>2008-10-26 04:44:53 (GMT)
committerJunio C Hamano <>2008-10-26 21:09:48 (GMT)
commit04427ac8483f61dcb01a48c78a821f5042c88195 (patch)
tree90c925a7bd0d756d86bfa092ca779b5834b5554f /userdiff.c
parentdf5e91fc2c95e051744ec9b9de66869d2b323037 (diff)
refactor userdiff textconv code
The original implementation of textconv put the conversion into fill_mmfile. This was a bad idea for a number of reasons: - it made the semantics of fill_mmfile unclear. In some cases, it was allocating data (if a text conversion occurred), and in some cases not (if we could use the data directly from the filespec). But the caller had no idea which had happened, and so didn't know whether the memory should be freed - similarly, the caller had no idea if a text conversion had occurred, and so didn't know whether the contents should be treated as binary or not. This meant that we incorrectly guessed that text-converted content was binary and didn't actually show it (unless the user overrode us with " = false", which then created problems in plumbing where the text conversion did _not_ occur) - not all callers of fill_mmfile want the text contents. In particular, we don't really want diffstat, whitespace checks, patch id generation, etc, to look at the converted contents. This patch pulls the conversion code directly into builtin_diff, so that we only see the conversion when generating an actual patch. We also then know whether we are doing a conversion, so we can check the binary-ness and free the data from the mmfile appropriately (the previous version leaked quite badly when text conversion was used) Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'userdiff.c')
0 files changed, 0 insertions, 0 deletions