From: Joe Wreschnig Date: Sun, 27 May 2018 12:40:19 +0000 (+0200) Subject: Correctly handle entries with “empty” suites X-Git-Url: https://git.korewanetadesu.com/?p=apt-sources-list.git;a=commitdiff_plain;h=44112833b3fa7f4d7e43708e5996782e22bb2fa3;ds=sidebyside Correctly handle entries with “empty” suites One example of such an entry is for the SBT repository at “deb https://dl.bintray.com/sbt/debian /”. --- diff --git a/apt-sources-list-test.el b/apt-sources-list-test.el index 54a1f57..6e5dfd9 100644 --- a/apt-sources-list-test.el +++ b/apt-sources-list-test.el @@ -125,6 +125,13 @@ deb-src http://deb.test/debian stable main"))) (type "C-c C-s stable RET") (should-equal-buffer "deb http://deb.test/debian stable xxx # foo"))) +(ert-deftest apt-sources-list-test-change-suite-empty () + (with-apt-sources-list "deb http://deb.test/debian stable main # foo" + (type "C-c C-s / RET") + (should-equal-buffer "deb http://deb.test/debian / # foo") + (type "C-c C-s unstable RET M-0 C-k xxx RET") + (should-equal-buffer "deb http://deb.test/debian unstable xxx # foo"))) + (ert-deftest apt-sources-list-test-change-components () (with-apt-sources-list "deb http://deb.test/debian stable main # foo" (type "C-c C-c M-0 C-k a SPC b") diff --git a/apt-sources-list.el b/apt-sources-list.el index f5b049c..ed4c876 100644 --- a/apt-sources-list.el +++ b/apt-sources-list.el @@ -112,7 +112,7 @@ single “%s” which will be replaced with the source name." (one-or-more (not (any " \t\n#")))) (one-or-more blank) (group - (or (and (one-or-more (not (any " \t\n#"))) "/") + (or (and (zero-or-more (not (any " \t\n#"))) "/") (and (zero-or-more (not (any " \t\n#"))) (not (any " \t\n/#")) (one-or-more blank)