aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/diff3
Commit message (Collapse)AuthorAgeFilesLines
* diff3: set O_CLOEXEC on pipesBaptiste Daroussin11 days1-6/+2
| | | | | | | | This avoid leaking pipe fd in children and simplifies the code MFC After: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D56120
* diff3: plug fd leakBaptiste Daroussin13 days1-0/+1
| | | | | MFC After: 1 week Reported by: kib
* diff3: prefer posix_spawn over pdfork/execlpBaptiste Daroussin13 days1-18/+29
| | | | | | MFC After: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D56075
* diff3: Add SPDX-License-Identifier tagTuukka Pasanen2026-03-031-0/+2
| | | | | | Reviewed by: bapt Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D55462
* diff3: Produce correct exit statusDag-Erling Smørgrav2026-03-022-14/+29
| | | | | | | | | | Use exit status 2 for errors, 1 only to indicate that differences were found between the inputs (in some operating modes). MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: ngie, bapt Differential Revision: https://reviews.freebsd.org/D55608
* diff3: bump version to the date when the GNU diff3 compat was reachedBaptiste Daroussin2026-03-011-1/+1
|
* diff3: Code cleanupDag-Erling Smørgrav2026-02-281-29/+19
| | | | | | | | | | | | | | | | | | | | | * Order includes. * Turn the diff type into an enum. * Turn an unreachable error message into an assertion. * Remove unused debugging code. * Remove some dead assignments. * Consistently use 1 instead of EXIT_FAILURE. * Turn a return from main() into an exit(). MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D55517
* diff3: add 3 missing files from the testsuiteBaptiste Daroussin2026-02-132-0/+44
| | | | Fixes: 2cfca8e710f260b8a1bb1ee5e1836a52e468ef4b
* diff3: fix merge modeBaptiste Daroussin2026-02-1315-30/+168
| | | | | | | | | | | Make the merge mode compatible with GNU diff3 Add tests for all the changes, those tests are extracted from the etcupdate testsuite. This version passes the etcupdate testsuite and the diffutils diff3 test suite. MFC After: 1 week
* diff3: fix diff3 -ABaptiste Daroussin2026-02-131-7/+24
| | | | | | | | | for cases where file2 differs but file1 and file3 agrees, the code stored the file2 and file3 line numbers in the de[] editing script entries but used them as if they were file1 line numbers. Reviewed by: thj Differential Revision: https://reviews.freebsd.org/D55276
* diff3: use pdwait instead of homemade oneBaptiste Daroussin2026-02-021-37/+19
| | | | MFC After: 3 days
* diff3: Remove debugging remnant.Dag-Erling Smørgrav2024-09-261-1/+0
| | | | | Fixes: cf73401c4f7a MFC after: 3 weeks
* diff3: Fix merge mode.Dag-Erling Smørgrav2024-09-251-76/+179
| | | | | | | | | | | | This is mostly thj@'s work, with some tweaks and cleanup by me. There are still some cases where our output differs from GNU diff3, but it's much better than before and I'd rather commit what I have now than let it continue to languish in a metaphorical drawer. MFC after 3 weeks Sponsored by: Klara, Inc. Reviewed by: thj Differential Revision: https://reviews.freebsd.org/D46762
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* usr.bin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-3/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* usr.bin: Remove ancient SCCS tags.Warner Losh2023-11-272-7/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* diff3: make the diff3 -E -m and diff3 -m behaviour match gnu diff3Baptiste Daroussin2023-09-065-3/+49
| | | | | | | | | | | | In gnu diff3 3 way merging files where the new file and the target are already the same will die and show what has failed to be merged except if -E is passed in argument, in this case it will finish the merge. This difference in behaviour was breaking one of the etcupdate testcase with bsd diff3 Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D41730
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-164-4/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* diff3: Use ranges for new and old diffedits in ed scriptsTom Jones2022-08-021-5/+9
| | | | | | | This should make the output logic easier to read. No functional change intended. Sponsored by: Klara, Inc.
* diff3: Use ranges for the old and new diffedits in A scriptsTom Jones2022-08-021-18/+23
| | | | | | | This makes the output logic easier to read. No functional change intended. Sponsored by: Klara, Inc.
* diff3: Simplify startmark calculation in AscriptTom Jones2022-08-021-2/+3
| | | | | | Remove redundant calculation for startmark. Sponsored by: Klara, Inc.
* diff3: Use variables for old and new in A scriptsTom Jones2022-08-011-17/+19
| | | | | | This makes the code easier to follow, no functional changes intended Sponsored by: Klara, Inc.
* diff3: Replace literal marker with variableTom Jones2022-08-011-5/+6
| | | | Sponsored by: Klara, Inc.
* diff3: Fix indentationTom Jones2022-08-011-1/+1
| | | | Sponsored by: Klara, Inc.
* diff3: make the eflag logic easier to followTom Jones2022-07-051-13/+20
| | | | | | Discussed with: dim Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35324
* diff3: Add man page description for version and helpTom Jones2022-06-231-2/+9
| | | | | | Reviewed by: Pau Amma Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D35325
* diff3: Add help and version optionsTom Jones2022-05-251-3/+16
| | | | | Add help and version flags. Exit values in these paths are set to match the behaviour of gnu diff3.
* diff3: Copy line into debug informationTom Jones2022-05-251-1/+1
| | | | Sponsored by: Klara Inc.
* diff3: Don't perform a bitwise OR when comparing diffsTom Jones2022-05-251-1/+1
| | | | | | This fixes the build now that it uses -Wbitwise-instead-of-logical Sponsored by: Klara Inc.
* diff3: Remove test case that references non existent test filesTom Jones2022-05-021-2/+1
| | | | Sponsored by: Klara, Inc.
* diff3: Add support for -mTom Jones2022-04-195-3/+137
| | | | | | | | | | | | | | | diff3 in -m mode generates a complete file with changes bracketed with conflict markers. This adds support for diff3 to generate version control style three way merge output. The output format was inferred from looking at the gnu diff3 output on a selection of test files as a specification of what diff3 -m should output is not available. It is likely there are cases where the -m output differs from other tools and I am happy to update diff3 to address these. Discussed with: pstef, kevans Sponsored by: Klara, Inc.
* diff3: Add support for -ATom Jones2022-04-195-8/+157
| | | | | | | | | | | | | | | | | | | Diff3 in -A mode generates an ed script to show how the 3 files and brackets changes that conflict. The ed script generated should when applied leave familiar merge conflict markers in a patched file. Diff3 output is not documented, this feature has been arrived at by comparing bsd diff3 output to gnu diff3 output until they were made to agree. There are likely to still be differences between these formats. The gnu diff3 guide is actually quite good at explaining how diff3 output should appear, but it doesn't cover every form of output from diff3. https://www.gnu.org/software/diffutils/manual/diffutils.html#Comparing-Three-Files Discussed with: pstef, kevans Sponsored by: Klara, Inc.
* diff3: seperate old and new markers from file markersTom Jones2022-04-191-5/+8
| | | | | | | With -A and -m output the conflict markers are not tied to the file name. Seperate out these markers. Sponsored by: Klara, Inc.
* diff3: Clean up printing of ranges for edscript outputTom Jones2022-04-191-35/+37
| | | | | | | | | | | | | | | | | | | Replace the edscript code that tracked and printed lines using byte offsets with code that can work from line offsets. This tidies up the reduces duplication in the edscript output code. It also fixes the usage of the de struct so that it only tracks diffs as line offsets rather than the usage changing from line offsets to byte offsets during the lifetime of diff3. Large files with large numbers of ranges will probably suffer in performance here, but as we don't use diff3 yet this isn't a regression. Include a warning for future hackers so they have a place to start hacking from. Reviewed by: pstef Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D34941
* diff3: allow diff3 ed scripts to generate deletionsTom Jones2022-04-157-16/+113
| | | | | | | | | | | diff3 with the -e (ed script flag) can generate line deletions, add support for deletions and add a test case to exercise this behaviour. This functionality was unearthed through comparison of bsd diff3 and gnu diff3 output. Reviewed by: pstef Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D34912
* diff3: document and test -TPiotr Pawel Stefaniak2021-08-254-2/+27
| | | | | Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D31650
* diff3: implement --strip-trailing-crPiotr Pawel Stefaniak2021-08-235-1/+21
| | | | | Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D31626
* diff3.1: update manual page to match codePiotr Pawel Stefaniak2021-08-231-6/+27
|
* diff3: improve stylePiotr Pawel Stefaniak2021-08-231-17/+19
|
* diff3: sync with upstreamPiotr Pawel Stefaniak2021-08-231-6/+15
| | | | | | | * replace realloc calls with reallocarray calls * fix merging of files that lack newlines Obtained from: OpenBSD
* Replace homemade getline(3) by actual getline(3)Baptiste Daroussin2019-12-171-17/+5
| | | | Notes: svn path=/head/; revision=355854
* Use strtoimax.Baptiste Daroussin2019-12-171-16/+6
| | | | | | | Use existing strtoimax instead of reinventing it Notes: svn path=/head/; revision=355847
* capsicum: use a new capsicum helpers in toolsMariusz Zaborski2018-11-041-3/+3
| | | | | | | Use caph_{rights,ioctls,fcntls}_limit to simplify the code. Notes: svn path=/head/; revision=340138
* Convert `cap_enter() < 0 && errno != ENOSYS` to `caph_enter() < 0`.Mariusz Zaborski2018-06-191-1/+1
| | | | | | | No functional change intended. Notes: svn path=/head/; revision=335395
* DIRDEPS_BUILD: Connect new directories.Bryan Drewery2017-10-311-0/+11
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325187
* Add HAS_TESTS to all Makefiles that are currently using theEnji Cooper2017-08-021-0/+1
| | | | | | | | | `SUBDIR.${MK_TESTS}+= tests` idiom. This is a follow up to r321912. Notes: svn path=/projects/make-check-sandbox/; revision=321914
* Convert traditional ${MK_TESTS} conditional idiom for including testEnji Cooper2017-08-021-3/+1
| | | | | | | | | | | | | | directories to SUBDIR.${MK_TESTS} idiom This is being done to pave the way for future work (and homogenity) in ^/projects/make-check-sandbox . No functional change intended. MFC after: 1 weeks Notes: svn path=/head/; revision=321912
* Update the diff3 manpage to reflect the fact the version in freebsd doesBaptiste Daroussin2017-05-251-21/+1
| | | | | | | not use temporary files nor uses a /usr/libexec/diff3prog Notes: svn path=/head/; revision=318892