diff options
author | David Parrish | 2016-05-22 18:02:54 -0400 |
---|---|---|
committer | David Parrish | 2016-05-22 18:02:54 -0400 |
commit | e4e9c7a9d03054b69d63528c0fd70a1b076641c1 (patch) | |
tree | f99d5cd9590e7900bb30e027fb23152e67cabeed | |
download | aur-e4e9c7a9d03054b69d63528c0fd70a1b076641c1.tar.gz |
Initial commit
-rw-r--r-- | .SRCINFO | 20 | ||||
-rw-r--r-- | PKGBUILD | 49 | ||||
-rw-r--r-- | exclude-directory.patch | 129 |
3 files changed, 198 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..7088cb9e9216 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,20 @@ +# Generated by mksrcinfo v8 +# Sun May 22 22:01:40 UTC 2016 +pkgbase = diffutils-git-patched-exclude-directory + pkgdesc = Utility programs used for creating patch files, including exclude directory feature + pkgver = 3.3.r46.g5a48551 + pkgrel = 1 + url = http://www.gnu.org/software/diffutils + arch = i686 + arch = x86_64 + license = GPL3 + depends = libsigsegv + provides = diffutils + conflicts = diffutils + source = diffutils-git-patched-exclude-directory::git+git://git.savannah.gnu.org/diffutils.git + source = exclude-directory.patch + sha256sums = SKIP + sha256sums = 97ac78bc61718cba9ae0387b9882042a4e59086f14c8964c75aa467d68e5de34 + +pkgname = diffutils-git-patched-exclude-directory + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..00618674e9e7 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,49 @@ +# Maintainer: David Parrish <daveparrish@tutanota.com> + +pkgname=diffutils-git-patched-exclude-directory +pkgver=3.3.r46.g5a48551 +pkgrel=1 +pkgdesc='Utility programs used for creating patch files, including exclude directory feature' +arch=('i686' 'x86_64') +url='http://www.gnu.org/software/diffutils' +license=('GPL3') +depends=('libsigsegv') +provides=('diffutils') +conflicts=('diffutils') +source=("${pkgname}::git+git://git.savannah.gnu.org/diffutils.git" + 'exclude-directory.patch') +sha256sums=('SKIP' + '97ac78bc61718cba9ae0387b9882042a4e59086f14c8964c75aa467d68e5de34') + +pkgver() { + cd "$pkgname" + git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g' +} + +prepare() { + msg 'Applying exclude directory patch ...' + patch -d "$pkgname" -p1 <exclude-directory.patch + + cd "$pkgname" + + msg 'Bootstrapping diffutils ...' + ./bootstrap +} + +build() { + cd "$pkgname" + ./configure --prefix=/usr + make +} + +check() { + cd "$pkgname" + make check +} + +package() { + cd "$pkgname" + make DESTDIR="$pkgdir" install +} + +# vim:set ts=2 sw=2 et: diff --git a/exclude-directory.patch b/exclude-directory.patch new file mode 100644 index 000000000000..feb3dea28e9b --- /dev/null +++ b/exclude-directory.patch @@ -0,0 +1,129 @@ +diff --git a/src/diff.c b/src/diff.c +index 9bc1d96..4420623 100644 +--- a/src/diff.c ++++ b/src/diff.c +@@ -122,6 +122,7 @@ enum + NO_IGNORE_FILE_NAME_CASE_OPTION, + NORMAL_OPTION, + SDIFF_MERGE_ASSIST_OPTION, ++ EXCLUDE_DIRECTORY_OPTION, + STRIP_TRAILING_CR_OPTION, + SUPPRESS_BLANK_EMPTY_OPTION, + SUPPRESS_COMMON_LINES_OPTION, +@@ -208,6 +209,7 @@ static struct option const longopts[] = + {"show-function-line", 1, 0, 'F'}, + {"side-by-side", 0, 0, 'y'}, + {"speed-large-files", 0, 0, 'H'}, ++ {"exclude-directory", 0, 0, EXCLUDE_DIRECTORY_OPTION}, + {"starting-file", 1, 0, 'S'}, + {"strip-trailing-cr", 0, 0, STRIP_TRAILING_CR_OPTION}, + {"suppress-blank-empty", 0, 0, SUPPRESS_BLANK_EMPTY_OPTION}, +@@ -592,6 +594,10 @@ main (int argc, char **argv) + sdiff_merge_assist = true; + break; + ++ case EXCLUDE_DIRECTORY_OPTION: ++ exclude_directory = true; ++ break; ++ + case STRIP_TRAILING_CR_OPTION: + strip_trailing_cr = true; + break; +@@ -911,6 +917,7 @@ static char const * const option_help_msgid[] = { + N_(" --no-ignore-file-name-case consider case when comparing file names"), + N_("-x, --exclude=PAT exclude files that match PAT"), + N_("-X, --exclude-from=FILE exclude files that match any pattern in FILE"), ++ N_(" --exclude-directory exclude directories matching exclude pattern"), + N_("-S, --starting-file=FILE start with FILE when comparing directories"), + N_(" --from-file=FILE1 compare FILE1 to all operands;\n" + " FILE1 can be a directory"), +diff --git a/src/diff.h b/src/diff.h +index 0983e7c..413790a 100644 +--- a/src/diff.h ++++ b/src/diff.h +@@ -224,6 +224,9 @@ XTERN bool speed_large_files; + /* Patterns that match file names to be excluded. */ + XTERN struct exclude *excluded; + ++/* Include directory as part of exclude matching. */ ++XTERN bool exclude_directory; ++ + /* Don't discard lines. This makes things slower (sometimes much + slower) but will find a guaranteed minimal set of changes. */ + XTERN bool minimal; +diff --git a/src/dir.c b/src/dir.c +index c8aa6a5..e9c70d6 100644 +--- a/src/dir.c ++++ b/src/dir.c +@@ -96,8 +96,15 @@ dir_read (struct file_data const *dir, struct dirdata *dirdata) + && (d_name[1] == 0 || (d_name[1] == '.' && d_name[2] == 0))) + continue; + +- if (excluded_file_name (excluded, d_name)) +- continue; ++ /* Exclude filename matches from diff */ ++ if (exclude_directory) { ++ if (excluded_file_name (excluded, ++ file_name_concat(dir->name, d_name, NULL))) ++ continue; ++ } else { ++ if (excluded_file_name (excluded, d_name)) ++ continue; ++ } + + while (data_alloc < data_used + d_size) + { +diff --git a/tests/exclude-directory b/tests/exclude-directory +new file mode 100755 +index 0000000..825154a +--- /dev/null ++++ b/tests/exclude-directory +@@ -0,0 +1,48 @@ ++#!/bin/sh ++# exclude directory tests ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../src ++ ++TZ=UTC0 ++export TZ ++ ++fail=0 ++ ++# Generate directory structure ++mkdir a ++mkdir b ++echo ac > a/c ++echo bc > b/c ++ ++epoch='1970-01-01 00:00:00' ++touch --date="$epoch" a b a/c b/c ++ ++gen_exp_default() ++{ ++ printf '%s' \ ++"diff -r '--exclude=b/*' a/c b/c ++1c1 ++< ac ++--- ++> bc ++" ++} ++ ++gen_exp_excluded() ++{ ++ printf '%s' \ ++"Only in a: c ++" ++} ++ ++diff -r --exclude="b/*" a b > out ++test $? = 1 || fail=1 ++gen_exp_default > exp || framework_failure_ ++compare exp out || fail=1 ++ ++diff -r --exclude-directory --exclude="b/*" a b > out ++test $? = 1 || fail=1 ++gen_exp_excluded > exp || framework_failure_ ++compare exp out || fail=1 ++ ++Exit $fail |