[Pkg-javascript-commits] [node-glob-parent] 01/02: add upstream patch
Praveen Arimbrathodiyil
praveen at moszumanska.debian.org
Fri Oct 28 18:06:47 UTC 2016
This is an automated email from the git hooks/post-receive script.
praveen pushed a commit to branch master
in repository node-glob-parent.
commit f7f7afb56dd96855ce8a1db3eceaeb9eee76f891
Author: Praveen Arimbrathodiyil <praveen at debian.org>
Date: Fri Oct 28 21:09:43 2016 +0530
add upstream patch
---
debian/changelog | 8 +-
debian/patches/fix-braces.patch | 210 ++++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 217 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index a026d6c..2331c13 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,12 @@
-node-glob-parent (3.0.1-1) UNRELEASED; urgency=medium
+node-glob-parent (3.0.1-1) unstable; urgency=medium
+ * Team upload
+ * fix-braces.patch: Fix test failure in node-glob-base
+
+ [ Sruthi Chandran ]
* New upstream release
- -- Sruthi Chandran <srud at disroot.org> Fri, 28 Oct 2016 17:29:06 +0530
+ -- Pirate Praveen <praveen at debian.org> Fri, 28 Oct 2016 21:08:58 +0530
node-glob-parent (3.0.0-1) unstable; urgency=low
diff --git a/debian/patches/fix-braces.patch b/debian/patches/fix-braces.patch
new file mode 100644
index 0000000..b315aa7
--- /dev/null
+++ b/debian/patches/fix-braces.patch
@@ -0,0 +1,210 @@
+From 1691b29a44b38ae79121725432a75532929d90b2 Mon Sep 17 00:00:00 2001
+From: Elan Shanker <elan.shanker at gmail.com>
+Date: Tue, 18 Oct 2016 17:44:51 -0400
+Subject: [PATCH 1/8] Add test cases for glob enclosures with separators
+
+---
+ test.js | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+Index: node-glob-parent/test.js
+===================================================================
+--- node-glob-parent.orig/test.js
++++ node-glob-parent/test.js
+@@ -5,57 +5,144 @@ var assert = require('assert');
+
+ describe('glob-parent', function() {
+ it('should strip glob magic to return parent path', function() {
+- assert.equal(gp('path/to/*.js'), 'path/to');
+- assert.equal(gp('/root/path/to/*.js'), '/root/path/to');
++ assert.equal(gp('.'), '.');
++ assert.equal(gp('.*'), '.');
++ assert.equal(gp('/.*'), '/');
++ assert.equal(gp('/.*/'), '/');
++ assert.equal(gp('a/.*/b'), 'a');
++ assert.equal(gp('a*/.*/b'), '.');
++ assert.equal(gp('*/a/b/c'), '.');
++ assert.equal(gp('*'), '.');
++ assert.equal(gp('*/'), '.');
++ assert.equal(gp('*/*'), '.');
++ assert.equal(gp('*/*/'), '.');
++ assert.equal(gp('**'), '.');
++ assert.equal(gp('**/'), '.');
++ assert.equal(gp('**/*'), '.');
++ assert.equal(gp('**/*/'), '.');
+ assert.equal(gp('/*.js'), '/');
+ assert.equal(gp('*.js'), '.');
+ assert.equal(gp('**/*.js'), '.');
++ assert.equal(gp('{a,b}'), '.');
++ assert.equal(gp('/{a,b}'), '/');
++ assert.equal(gp('/{a,b}/'), '/');
++ assert.equal(gp('(a|b)'), '.');
++ assert.equal(gp('/(a|b)'), '/');
++ assert.equal(gp('./(a|b)'), '.');
++ assert.equal(gp('a/(b c)'), 'a', 'not an extglob');
++ assert.equal(gp('a/(b c)/d'), 'a/(b c)', 'not an extglob');
++ assert.equal(gp('path/to/*.js'), 'path/to');
++ assert.equal(gp('/root/path/to/*.js'), '/root/path/to');
++ assert.equal(gp('chapter/foo [bar]/'), 'chapter');
+ assert.equal(gp('path/[a-z]'), 'path');
++ assert.equal(gp('[a-z]'), '.');
+ assert.equal(gp('path/{to,from}'), 'path');
+ assert.equal(gp('path/(to|from)'), 'path');
++ assert.equal(gp('path/(foo bar)/subdir/foo.*'), 'path/(foo bar)/subdir');
+ assert.equal(gp('path/!(to|from)'), 'path');
+ assert.equal(gp('path/?(to|from)'), 'path');
+ assert.equal(gp('path/+(to|from)'), 'path');
+ assert.equal(gp('path/*(to|from)'), 'path');
+ assert.equal(gp('path/@(to|from)'), 'path');
++ assert.equal(gp('path/!/foo'), 'path/!');
++ assert.equal(gp('path/?/foo'), 'path', 'qmarks must be escaped');
++ assert.equal(gp('path/+/foo'), 'path/+');
++ assert.equal(gp('path/*/foo'), 'path');
++ assert.equal(gp('path/@/foo'), 'path/@');
++ assert.equal(gp('path/!/foo/'), 'path/!/foo');
++ assert.equal(gp('path/?/foo/'), 'path', 'qmarks must be escaped');
++ assert.equal(gp('path/+/foo/'), 'path/+/foo');
++ assert.equal(gp('path/*/foo/'), 'path');
++ assert.equal(gp('path/@/foo/'), 'path/@/foo');
+ assert.equal(gp('path/**/*'), 'path');
+ assert.equal(gp('path/**/subdir/foo.*'), 'path');
++ assert.equal(gp('path/subdir/**/foo.js'), 'path/subdir');
++ assert.equal(gp('path/!subdir/foo.js'), 'path/!subdir');
++ assert.equal(gp('path/{foo,bar}/'), 'path');
++ });
++
++ it('should respect escaped characters', function() {
++ assert.equal(gp('path/\\*\\*/subdir/foo.*'), 'path/**/subdir');
++ assert.equal(gp('path/\\[\\*\\]/subdir/foo.*'), 'path/[*]/subdir');
++ assert.equal(gp('path/\\*(a|b)/subdir/foo.*'), 'path');
++ assert.equal(gp('path/\\*/(a|b)/subdir/foo.*'), 'path/*');
++ assert.equal(gp('path/\\*\\(a\\|b\\)/subdir/foo.*'), 'path/*(a|b)/subdir');
++ assert.equal(gp('path/\\[foo bar\\]/subdir/foo.*'), 'path/[foo bar]/subdir');
++ assert.equal(gp('path/\\[bar]/'), 'path/[bar]');
++ assert.equal(gp('path/\\[bar]'), 'path/[bar]');
++ assert.equal(gp('[bar]'), '.');
++ assert.equal(gp('[bar]/'), '.');
++ assert.equal(gp('\\[bar]'), '[bar]');
++ assert.equal(gp('[bar\\]'), '.');
++ assert.equal(gp('path/foo \\[bar]/'), 'path/foo [bar]');
++ assert.equal(gp('path/\\{foo,bar}/'), 'path/{foo,bar}');
++ assert.equal(gp('\\{foo,bar}/'), '{foo,bar}');
++ assert.equal(gp('\\{foo,bar\\}'), '{foo,bar}');
++ assert.equal(gp('{foo,bar\\}'), '.');
++ });
++
++ it('should respect glob enclosures with embedded separators', function() {
++ assert.equal(gp('path/{,/,bar/baz,qux}/'), 'path');
++ assert.equal(gp('path/\\{,/,bar/baz,qux}/'), 'path/{,/,bar/baz,qux}');
++ assert.equal(gp('path/\\{,/,bar/baz,qux\\}/'), 'path/{,/,bar/baz,qux}');
++ assert.equal(gp('/{,/,bar/baz,qux}/'), '/');
++ assert.equal(gp('/\\{,/,bar/baz,qux}/'), '/{,/,bar/baz,qux}');
++ assert.equal(gp('{,/,bar/baz,qux}'), '.');
++ assert.equal(gp('\\{,/,bar/baz,qux\\}'), '{,/,bar/baz,qux}');
++ assert.equal(gp('\\{,/,bar/baz,qux}/'), '{,/,bar/baz,qux}');
++ assert.equal(gp('path/foo[a\\\/]/'), 'path');
++ assert.equal(gp('path/foo\\[a\\\/]/'), 'path/foo[a\\\/]');
++ assert.equal(gp('foo[a\\\/]'), '.');
++ assert.equal(gp('foo\\[a\\\/]'), 'foo[a\\\/]');
++ });
++
++ it('should handle nested braces', function() {
++ assert.equal(gp('path/{../,./,{bar,/baz\\},qux\\}/'), 'path');
++ assert.equal(gp('path/{../,./,\\{bar,/baz},qux}/'), 'path');
++ assert.equal(gp('path/\\{../,./,\\{bar,/baz\\},qux\\}/'), 'path/{../,./,{bar,/baz},qux}');
++ assert.equal(gp('{../,./,{bar,/baz\\},qux\\}/'), '.');
++ assert.equal(gp('{../,./,{bar,/baz\\},qux\\}'), '.');
++ assert.equal(gp('path/{,/,bar/{baz,qux\\}}/'), 'path');
++ assert.equal(gp('path/{,/,bar/{baz,qux}\\}/'), 'path');
++ //assert.equal(gp('path/\\{../,./,{bar,/baz},qux}/'), 'path');
+ });
+
+ it('should return parent dirname from non-glob paths', function() {
+- assert.equal(gp('path/foo/bar.js'), 'path/foo');
+- assert.equal(gp('path/foo/'), 'path/foo');
++ assert.equal(gp('path'), '.');
+ assert.equal(gp('path/foo'), 'path');
++ assert.equal(gp('path/foo/'), 'path/foo');
++ assert.equal(gp('path/foo/bar.js'), 'path/foo');
+ });
+ });
+
+ describe('glob2base test patterns', function() {
+ it('should get a base name', function() {
+- assert.equal(gp('js/*.js') + '/', 'js/');
++ assert.equal(gp('js/*.js'), 'js');
+ });
+
+ it('should get a base name from a nested glob', function() {
+- assert.equal(gp('js/**/test/*.js') + '/', 'js/');
++ assert.equal(gp('js/**/test/*.js'), 'js');
+ });
+
+ it('should get a base name from a flat file', function() {
+- assert.equal(gp('js/test/wow.js') + '/', 'js/test/');
++ assert.equal(gp('js/test/wow.js'), 'js/test');
++ assert.equal(gp('js/test/wow.js'), 'js/test');
+ });
+
+ it('should get a base name from character class pattern', function() {
+- assert.equal(gp('js/t[a-z]st}/*.js') + '/', 'js/');
++ assert.equal(gp('js/t[a-z]st}/*.js'), 'js');
+ });
+
+ it('should get a base name from brace , expansion', function() {
+- assert.equal(gp('js/{src,test}/*.js') + '/', 'js/');
++ assert.equal(gp('js/{src,test}/*.js'), 'js');
+ });
+
+ it('should get a base name from brace .. expansion', function() {
+- assert.equal(gp('js/test{0..9}/*.js') + '/', 'js/');
++ assert.equal(gp('js/test{0..9}/*.js'), 'js');
+ });
+
+ it('should get a base name from extglob', function() {
+- assert.equal(gp('js/t+(wo|est)/*.js') + '/', 'js/');
++ assert.equal(gp('js/t+(wo|est)/*.js'), 'js');
+ });
+
+ it('should get a base name from a path with non-exglob parens', function() {
+@@ -64,10 +151,10 @@ describe('glob2base test patterns', func
+ });
+
+ it('should get a base name from a complex brace glob', function() {
+- assert.equal(gp('lib/{components,pages}/**/{test,another}/*.txt') + '/', 'lib/');
++ assert.equal(gp('lib/{components,pages}/**/{test,another}/*.txt'), 'lib');
+
+- assert.equal(gp('js/test/**/{images,components}/*.js') + '/', 'js/test/');
++ assert.equal(gp('js/test/**/{images,components}/*.js'), 'js/test');
+
+- assert.equal(gp('ooga/{booga,sooga}/**/dooga/{eooga,fooga}') + '/', 'ooga/');
++ assert.equal(gp('ooga/{booga,sooga}/**/dooga/{eooga,fooga}'), 'ooga');
+ });
+ });
+Index: node-glob-parent/index.js
+===================================================================
+--- node-glob-parent.orig/index.js
++++ node-glob-parent/index.js
+@@ -2,9 +2,19 @@
+
+ var path = require('path');
+ var isglob = require('is-glob');
++var pathDirname = require('path-dirname');
+
+ module.exports = function globParent(str) {
+- str += 'a'; // preserves full path in case of trailing path separator
+- do {str = path.dirname(str)} while (isglob(str));
+- return str;
++ // special case for strings ending in enclosure containing path separator
++ if (/[\{\[].*[\/]*.*[\}\]]$/.test(str)) str += '/';
++
++ // preserves full path in case of trailing path separator
++ str += 'a';
++
++ // remove path parts that are globby
++ do {str = pathDirname.posix(str)}
++ while (isglob(str) || /(^|[^\\])[\{\[]/.test(str));
++
++ // remove escape chars and return result
++ return str.replace(/\\([\*\?\|\[\]\(\)\{\}])/g, '$1');
+ };
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..fdc1f35
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+fix-braces.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-glob-parent.git
More information about the Pkg-javascript-commits
mailing list