[Bash-completion-commits] [bash-completion] 01/01: make: Don't pick up variables when makefile is reloaded
Ville Skyttä
scop-guest at moszumanska.debian.org
Wed Sep 9 14:42:30 UTC 2015
This is an automated email from the git hooks/post-receive script.
scop-guest pushed a commit to branch master
in repository bash-completion.
commit c5451dbd310074f8bceeada0e48e542713dada1e
Author: Tristan Wibberley <tristan.wibberley at gmail.com>
Date: Mon Sep 7 00:23:55 2015 +0100
make: Don't pick up variables when makefile is reloaded
Ah, I realised why only one variable was picked up. It's the last one only
that looks like it might be a target.
This third version of the patch has an updated test that should reliably
trigger unless there is some other environmental or version specific
behaviour.
---
completions/make | 10 +++++++---
test/fixtures/make/.gitignore | 1 +
test/fixtures/make/Makefile | 5 +++++
test/lib/completions/make.exp | 4 ++--
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/completions/make b/completions/make
index e84e5ba..ad1348b 100644
--- a/completions/make
+++ b/completions/make
@@ -20,9 +20,13 @@ function _make_target_extract_script()
fi
cat <<EOF
- 1,/^# * Files/ d; # skip until files section
- /^# * Not a target/,/^$/ d; # skip not target blocks
- /^${prefix_pat}/,/^$/! d; # skip anything user dont want
+ 1,/^# * Make data base/ d; # skip any makefile output
+ /^# * Finished Make data base/,/^# * Make data base/{
+ d; # skip any makefile output
+ }
+ /^# * Variables/,/^# * Files/ d; # skip until files section
+ /^# * Not a target/,/^$/ d; # skip not target blocks
+ /^${prefix_pat}/,/^$/! d; # skip anything user dont want
# The stuff above here describes lines that are not
# explicit targets or not targets other than special ones
diff --git a/test/fixtures/make/.gitignore b/test/fixtures/make/.gitignore
new file mode 100644
index 0000000..3d1325c
--- /dev/null
+++ b/test/fixtures/make/.gitignore
@@ -0,0 +1 @@
+extra_makefile
diff --git a/test/fixtures/make/Makefile b/test/fixtures/make/Makefile
index 3d1d5f3..b04a6eb 100644
--- a/test/fixtures/make/Makefile
+++ b/test/fixtures/make/Makefile
@@ -39,3 +39,8 @@ clean:
ifndef __BASH_MAKE_COMPLETION__
-include sample.d
endif
+
+VARIABLE_LOOKS_A_BIT_LIKE_A_TARGET := fooled-you
+extra_makefile:
+ touch $@
+include extra_makefile
diff --git a/test/lib/completions/make.exp b/test/lib/completions/make.exp
index 44abcbb..1dfef8e 100644
--- a/test/lib/completions/make.exp
+++ b/test/lib/completions/make.exp
@@ -18,10 +18,10 @@ assert_complete_dir "Makefile" "make -f Ma" $dir $test
sync_after_int
-
set test "\"make <TAB>\" should complete targets"
set dir $::srcdir/fixtures/make
-set targets "all sample install clean"
+set targets "all sample install clean extra_makefile"
+file delete $dir/extra_makefile
assert_complete_dir $targets "make " $dir $test
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/bash-completion/bash-completion.git
More information about the Bash-completion-commits
mailing list