429 Commits

Author SHA1 Message Date
Andreas Gruenbacher
05400c5689 Strip leading slashes in a separate function
* src/util.c (strip_leading_slashes): Make this a separate function.
(fetchname): Use strip_leading_slashes() here.
2010-04-22 19:04:06 +02:00
Andreas Gruenbacher
d909eee7c9 Support for nanosecond timestamps
* src/patch.c (main): Support nanosecond timestamps.  Replaqce utime()
with utimens().
* src/util.c (create_backup_copy): Preserve nanosecond timestamps.
Replace utime() with utimens().
* src/util.h: Remove the utime() related declarations, and include
the utimens() and nanosecond related headers instead.
* bootstrap.conf: Add the stat-time and utimens modules.
2010-04-22 01:41:51 +02:00
Andreas Gruenbacher
f81fe080e5 Replace timestamp parsing code with gnulib getdate
* src/Makefile.am (patch_SOURCES): Remove maketime.c, maketime.h,
partime.c, and partime.h.
(patch_LDFLAGS): Add LIB_CLOCK_GETTIME for clock_gettime().
* src/util.c: Replace maketime.h and partime.h with getdate.h.
(fetchname): Replace str2time() with get_date().  Sanitize the test
for epoch timestamps.
* src/patch.c (main): When --set-utc is given, set the TZ environment
variable to UTC so that get_date() will default to UTC timestamps.
* tests/preserve-mode-and-timestamp: Switching to get_date() revealed
that str2time() was ignoring timezones.  In order to test --set-utc
now that get_date() fixes this, we must use timestamps that do not
include timestamps here.
* bootstrap.conf: Add the clock-time, getdate, gettime, and setenv
modules.
2010-04-22 01:32:55 +02:00
Andreas Gruenbacher
3693996297 Use struct timespec instead of time_t internally
* src/pch.h (pch_timestamp): Return timestamp as struct timespec
instead of time_t.
* src/pch.c: Use struct timespec instead of time_t.  A tv_sec value
of -1 indicates "no timestamp".
* src/util.h (fetchname): Return timestamp as struct timespec
instead of time_t.
* src/util.c (fetchname): str2time() does not give us nanoseconds; set
them to zero for now.
* src/patch.c (main): Only use the seconds in timestamps for now.
* bootstrap.conf: Add the time module for getting struct timespec
declared on old hosts.
2010-04-22 00:43:29 +02:00
Andreas Gruenbacher
68e9980cce Replace quote_system_arg() with quotearg
* src/util.c (quote_system_arg): Add a replacement for
quote_system_arg() which uses quotearg's shell quoting style.
* src/Makefile.am (patch_SOURCES): Remove quotesys.c and quotesys.h.
* src/quotesys.c, src/quotesys.h: Delete.
2010-04-21 23:51:45 +02:00
Andreas Gruenbacher
9486a75e1a Cosmetic fix
* src/util.c (fetchname): Cosmetic fix.
2010-04-21 23:50:49 +02:00
Ludovic Courtès
3b60c20c17 Fix "make dist"
* src/Makefile.am (patch_SOURCES): Remove the obsolete diffseq.h to
fix "make dist".
2010-04-19 23:35:22 +02:00
Andreas Gruenbacher
02ee1d4e01 Globally rename type LINENUM to lin (as in diffutils)
* Globally rename type LINENUM to lin (as in diffutils).
2010-04-19 01:38:28 +02:00
Andreas Gruenbacher
3bde83e95e Fix two compiler warnings
* src/patch.c (Argv): Change type to char ** so that we can pass Argv
to getopt_long without warning.
* src/maketime.c (maketime): Fix year overflow check.
2010-04-19 01:37:09 +02:00
Andreas Gruenbacher
f97abc39d2 diffseq: Use the gnulib version instead of a private copy
* diffseq: Use the gnulib version instead of a private copy.
2010-04-19 01:35:28 +02:00
Andreas Gruenbacher
130f11008d Update to latest gnulib
* gnulib: Update to latest.
2010-04-18 14:48:56 +02:00
Andreas Gruenbacher
b1c58bd212 Portability fixes in the test suite
* tests/merge: Use the sed commands i, a, and c in their standard form
instead of relying on a GNU extension, and pass sed a script (-f)
instead of a list of commands via -e.
Some versions of sed don't support expressions like /^\(\|foo\)$/.
* tests/corrupt-reject-files: Use the more widely available -e switch
instead of -A.
* tests/crlf-handling: Likewise.
* tests/preserve-mode-and-timestamp: Use touch -t instead of touch -d.
Some non-GNU versions of date can't show a file's timestamp.
2010-04-15 16:24:09 +02:00
Andreas Gruenbacher
57d468b7a4 Add rules for generating .version and for including .tarball-version in dist tarballs
* Makefile.am: Add rules for generating .version and for
including .tarball-version in dist tarballs.
2010-04-15 12:21:45 +02:00
Andreas Gruenbacher
65a8f0f278 Minimum versions required: automake-1.11.1, autoconf-2.65
* configure.ac: Minimum versions required: automake-1.11.1,
autoconf-2.65.
2010-04-12 19:13:53 +02:00
Andreas Gruenbacher
c86f4a2c80 Portability fixes
* tests/test-lib.sh: Some versions of mktemp require a filename
template; use one.  Provide a seq replacement on platforms which don't
have seq.
2010-04-12 17:19:33 +02:00
Andreas Gruenbacher
7fa8417c05 Convert to automake and use a git submodule for gnulib
* configure.ac: Add automake and gnulib macros, replace several
obsolete macros.
* Makefile.am, lib/Makefile.am, src/Makefile.am, tests/Makefile.am:
Add for automake.
* autogen.sh, INSTALL, Makefile.in, mkinstalldirs, update-version.sh:
Obsolete; remove.
* README-hacking: Import from diffutils, replace cvs with git.
* build-aux: Move gnulib auxiliary files here from the top-level
directory.
* gnulib: Add gnulib git submodule.
* bootstrap, bootstrap.conf: Import from gnulib and adjust.
* gl/lib: Remove gnulib files from the repository; they are now
imported into lib/ from gnulib as needed.
* tests/test-lib.sh: Use $abs_top_builddir exported from
tests/Makefile.am here instead of $PWD.
* m4/utimbuf.m4: This macro has been removed from gnulib. Add it here
for now; this will be replaced by gnulib's utimens module soon.
2010-04-12 16:27:55 +02:00
Andreas Gruenbacher
8d5ea52c7a Rename ed_PROGRAM to EDITOR_PROGRAM
* src/pch.c (EDITOR_PROGRAM): Rename from ed_PROGRAM.
* configure.ac (EDITOR_PROGRAM): Likewise.
2010-04-12 16:27:55 +02:00
Andreas Gruenbacher
231e52e985 Fix the use of HAVE_UTIME_H
* src/util.c: Fix the use of HAVE_UTIME_H.
2010-04-12 16:27:55 +02:00
Andreas Gruenbacher
d300ec9bb8 Merge: detect already-applied inserts at the end of files
* src/merge.c: When a hunk has fewer suffix than prefix context lines,
try matching to the end of the file instead of doing a "greedy match":
this allows to detect already-applied inserts at the end of the file.
* tests/merge: Add test cases for this.
2010-02-21 00:37:40 +01:00
Andreas Gruenbacher
70c5b3126f Clarify the description of the -N option
* patch.man: Clarify the description of the -N option.
2010-02-17 16:49:12 +01:00
Andreas Gruenbacher
f376c5db4a Fix HAVE_DECL_STRNLEN and HAVE_DECL_STRNDUP checks
* gl/lib/strndup.c: HAVE_DECL_STRNLEN is either 0 or 1 so we need
to test for it with #if, not #ifdef.
* gl/lib/xstrndup.c: Likewise for HAVE_DECL_STRNDUP.
2010-01-15 19:24:59 +01:00
Andreas Gruenbacher
91e027ab1a No longer use "continue" as the only instruction in a loop body
* src/bestmatch.h, src/diffseq.h, src/inp.c, src/maketime.c,
src/merge.c, src/partime.c, src/pch.c, src/util.c: No longer use
"continue" as the only instruction in a loop body: at least one
compiler chokes on this in combination with variable-length arrays
as in src/bestmatch.h.
2010-01-15 19:20:57 +01:00
Andreas Gruenbacher
819b4a5c1f Do not allow timestamps in Index lines
*  src/util.c (fetchname): Do not allow timestamps in Index lines.
2010-01-11 19:13:54 +01:00
Andreas Gruenbacher
3473a896bb Try to preserve the owning group in backup files
* src/util.c (create_backup_copy): Try to preserve the owning group
in backup files.
2010-01-04 17:55:22 +01:00
Matthew Burgess
d868be8cdf * tests/crlf-handling: Skip another ed-dependent test. 2010-01-04 11:18:37 +01:00
Andreas Gruenbacher
c3052e896b * src/patch.c (main): Compare the input file's group ID with the
effective group ID to determine if a chown() is necessary, not the
effective user ID.
2010-01-02 17:49:29 +01:00
Andreas Gruenbacher
fcdaaaac28 * src/bestmatch.h, src/common.h, src/diffseq.h, src/inp.c, src/inp.h,
src/maketime.c, src/maketime.h, src/merge.c, src/partime.c,
src/partime.h, src/patch.c, src/pch.c, src/pch.h, src/quotesys.c,
src/util.c, src/util.h, src/version.c: Add year 2010 to copyright
notice.  Replace the GPLv2 license template with the GPLv3 license
template.
2010-01-02 13:36:55 +01:00
Andreas Gruenbacher
2c4e3ecdde * Makefile.in (LIBSRCS, LIBM4FILES): Add the missing files strnlen.c,
strnlen.m4, and safe-read.m4.
2010-01-01 16:06:45 +01:00
Andreas Gruenbacher
aa7ae95324 * src/pch.c: coding style fix (syntactic). 2009-12-30 19:44:49 +01:00
Andreas Gruenbacher
018ff72892 * NEWS: Version 2.6.1 released. v2.6.1 2009-12-30 16:30:44 +01:00
Andreas Gruenbacher
9fef208ad7 * patch.man: Clarify the description of the -F / --fuzz option. 2009-12-30 14:54:10 +01:00
Andreas Gruenbacher
6b65755542 * patch.man: Try to improve the documentation of patch's CRLF handling
behavior.
2009-12-29 20:02:50 +01:00
Peter Breitenlohner
6af131f138 * Makefile.in: Make the test suite work for a VPATH build. 2009-12-29 18:41:47 +01:00
Andreas Gruenbacher
8cc8b7061c * src/patch.c (longopts, get_some_switches): Add an optional argument
to the --merge option to choose the output formats for conflicts.
* patch.man: Document the new optional argument of --merge.
* src/merge.c (merge_hunk): Implement diff3-style conflicts.
* src/common.h (conflict_style): This global variable determines the
output format for conflicts.
* tests/merge: Add test cases for the diff3 output format.
2009-12-29 17:03:14 +01:00
Andreas Gruenbacher
b9e8d7e28c * install-sh: Make executable. 2009-12-28 18:47:47 +01:00
Andreas Gruenbacher
3bea3d5bc9 * Makefile.in (getopt.h, GETOPT_H): Generate getopt.h in the top-level
directory if needed.
(stdbool.h, STDBOOL_H): Likewise -- this should fix stdbool.h
generation on platforms which don't provide this header.
(argmatch.$(OBJEXT)): Add missing $(STDBOOL_H) dependency.
2009-12-28 18:35:54 +01:00
Bert Wesarg
aa50fe4ff4 * configure.ac: It looks like the . command does not pass the
arguments to the update-version.sh script [on some platforms].  Invoke
with sh instead.
2009-12-28 17:54:56 +01:00
Andreas Gruenbacher
9336e93bda * configure.ac (gl_FUNC_STRNDUP, gl_FUNC_STRNLEN): Add here.
* gl/m4/strndup.m4 (gl_HEADER_STRING_H_DEFAULTS): Don't use gnulib's
strings.h replacement for now, it is too complicated to add right now.
* gl/lib/xstrndup.c: Instead of using gl_HEADER_STRING_H_DEFAULTS,
declare strndup here on systems which don't have it.
* gl/lib/strndup.c: Instead of using gl_HEADER_STRING_H_DEFAULTS,
declare strnlen here on systems which don't have it.
* gl/lib/strnlen.c: Import from gnulib.
2009-12-28 17:46:08 +01:00
Andreas Gruenbacher
ab59a14a7b * src/pch.c: When the input files to diff have CRLF line endings, the
'<' and '>' lines of normal-style diffs will have CRLF endings even
when the patch itself has not been CRLF mangled.  Do not assume a
mangled patch in this case.
* tests/crlf-handling: Update test case to cover this case.
2009-12-28 15:14:20 +01:00
Andreas Gruenbacher
59ae87bd5b * tests/create-delete: Clean up a syntactic glitch. 2009-12-28 14:28:47 +01:00
Andreas Gruenbacher
e2218ace73 * src/pch.c (intuit_diff_type): Fix regression introduced after patch
2.5.9: when none of the filenames in the old, new, and index headers
exists, patch chose the wrong filename (bug 28367).
(maybe_reverse): Return if the patch looks reversed, not if this
function toggled the reverse flag.
* tests/filename-choice: New test case.
* Makefile.in (TESTS): Add test case.
2009-12-23 00:15:30 +01:00
Andreas Gruenbacher
84f303c1ef * src/pch.c (intuit_diff_type): Add some clarifying comments. 2009-12-22 20:31:43 +01:00
Andreas Gruenbacher
71a3f0d5cf * src/version.c (copyright_string): Add year 2009. 2009-12-22 20:30:22 +01:00
Andreas Gruenbacher
31a8f72983 Platform compatibility fixes in update-version.sh 2009-11-14 21:59:52 +01:00
Andreas Gruenbacher
f01f28263e Version 2.6 released v2.6 2009-11-13 15:10:28 +01:00
Andreas Gruenbacher
87f54e80e1 Clarify the message when (part of) a hunk cannot be merged 2009-10-27 16:46:25 +01:00
Andreas Gruenbacher
7f5e5b5ec1 Fix typo in patch.man (reported by Vytautas Šaltenis) 2009-10-27 16:38:02 +01:00
Andreas Gruenbacher
ba37782d74 Try to preserve the owning group of patched files 2009-09-04 13:55:32 +02:00
Andreas Gruenbacher
80d8b7827b Add the gnulib which were imported on 2009-06-05 to the tarball as well 2009-09-04 13:53:01 +02:00
Andreas Gruenbacher
62d03acb14 The -m option hasn't been officially allocated yet; use only the long form for now (--merge) 2009-07-19 17:50:54 +02:00