about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-03-10 23:20:54 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-03-11 22:19:04 +0000
commit527badc237cf1afd44c7215838ce69ae28dd35d8 (patch)
tree3b57405e7fa8cd5d2d1261b9377e5819d1061040
parent98fcdb0861af6462d233f6199568d64b01fb7b08 (diff)
downloadzsh-527badc237cf1afd44c7215838ce69ae28dd35d8.tar.gz
zsh-527badc237cf1afd44c7215838ce69ae28dd35d8.tar.xz
zsh-527badc237cf1afd44c7215838ce69ae28dd35d8.zip
38129: _git: Fix __git_ignore_line's treatment of shell and pattern metacaracters.
Builds upon a patch by Jun T.

Also upgrade/fix __git_pattern_escape.
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_git6
2 files changed, 8 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 34be26e2e..0e7d1e023 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-11  Daniel Shahaf  <d.s@daniel.shahaf.name>
+
+	* 38129: Completion/Unix/Command/_git: Fix __git_ignore_line's
+	treatment of shell and pattern metacaracters.
+
 2016-03-10  Daniel Shahaf  <d.s@daniel.shahaf.name>
 
 	* 38128: Completion/Unix/Command/_git: Fix completion of diffs
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 6c88ad073..e3d7231d3 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -4956,7 +4956,7 @@ __git_committish_range_last () {
 
 (( $+functions[__git_pattern_escape] )) ||
 __git_pattern_escape () {
-  print -r -n ${1//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}
+  print -r -n - ${(b)1}
 }
 
 (( $+functions[__git_is_type] )) ||
@@ -5048,9 +5048,9 @@ __git_ignore_line () {
   declare -a ignored
   ignored=()
   ((CURRENT > 1)) &&
-    ignored+=(${line[1,CURRENT-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+    ignored+=(${(bQ)line[1,CURRENT-1]})
   ((CURRENT < $#line)) &&
-    ignored+=(${line[CURRENT+1,-1]//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH})
+    ignored+=(${(bQ)line[CURRENT+1,-1]})
   $* -F ignored
 }