patch(1): give /dev/null patches special treatmentWe have a bad habit of duplicating contents of files that are sourced from/dev/null and applied more than once... take the more sane (in most ways
patch(1): give /dev/null patches special treatmentWe have a bad habit of duplicating contents of files that are sourced from/dev/null and applied more than once... take the more sane (in most ways)GNU route and complain if the file exists and offer reversal options.This still falls short a little bit as selecting "don't reverse, applyanyway" will still give you duplicated file contents. There's probably otherissues as well, but awareness is the first step to happiness.MFC after: 2 weeksDifferential Revision: https://reviews.freebsd.org/D21535
show more ...
patch(1): fix the file removal test, strengthen it a bitTo remain compatible with GNU patch, we should ensure that once we'reremoving empty files after a reversed /dev/null patch we don't remove f
patch(1): fix the file removal test, strengthen it a bitTo remain compatible with GNU patch, we should ensure that once we'reremoving empty files after a reversed /dev/null patch we don't remove filesthat have been modified. GNU patch leaves these intact and just reverses thehunk that created the file, effectively implying --remove-empty-files forreversed /dev/null patches.
patch(1): add some basic testsSummary:- basic: test application of patches created by diff -u at the beginning/middle/end of file, which have differing amounts of context before and after chun
patch(1): add some basic testsSummary:- basic: test application of patches created by diff -u at the beginning/middle/end of file, which have differing amounts of context before and after chunks being added- limited_ctx: stems from PR 74127 in which a rogue line was getting added when the patch should have been rejected. Similar behavior was reproducible with larger contexts near the beginning/end of a file. See r326084 for details- file_creation: patch sourced from /dev/null should create the file- file_nodupe: said patch sourced from /dev/null shouldn't dupe the contents when re-applied (personal vendetta, WIP, see comment)- file_removal: this follows from nodupe; the reverse of a patch sourced from /dev/null is most naturally deleting the file, as is expected based on GNU patch behavior (WIP)