582c8cb2915bf898a419cfcff398af1966211c25

Author
Jacob Menke <jamenk@email.wm.edu>
Committer
GitHub <noreply@github.com>
Date

Message

Prefix cd calls with `builtin` (#8937)

Diff

 1diff --git a/lib/cli.zsh b/lib/cli.zsh
 2index 8c0fabb82d66fb41faf7686d2611058fb7a9b001..e25a9f0b1782b5bb109aeedf1628b7e26c82dc70 100644
 3--- a/lib/cli.zsh
 4+++ b/lib/cli.zsh
 5@@ -103,7 +103,7 @@ EOF
 6 function _omz::pr::clean {
 7     (
 8         set -e
 9-        cd -q "$ZSH"
10+        builtin cd -q "$ZSH"
11 
12         _omz::log info "removing all Oh My Zsh Pull Request branches..."
13         command git branch --list 'ohmyzsh/pull-*' | while read branch; do
14@@ -126,7 +126,7 @@ function _omz::pr::test {
15 
16     # Save current git HEAD
17     local branch
18-    branch=$(cd -q "$ZSH"; git symbolic-ref --short HEAD) || {
19+    branch=$(builtin cd -q "$ZSH"; git symbolic-ref --short HEAD) || {
20         _omz::log error "error when getting the current git branch. Aborting..."
21         return 1
22     }
23@@ -136,7 +136,7 @@ function _omz::pr::test {
24     # If any of these operations fail, undo the changes made
25     (
26         set -e
27-        cd -q "$ZSH"
28+        builtin cd -q "$ZSH"
29 
30         # Get the ohmyzsh git remote
31         command git remote -v | while read remote url _; do
32@@ -185,7 +185,7 @@ function _omz::pr::test {
33 
34     (
35         set -e
36-        cd -q "$ZSH"
37+        builtin cd -q "$ZSH"
38 
39         command git checkout "$branch" -- || {
40             _omz::log error "could not go back to the previous branch ('$branch')."
41diff --git a/lib/diagnostics.zsh b/lib/diagnostics.zsh
42index 9c9905e4d34e0a7b05b9f7905eb9ee238a7b13e5..001de42b7ab5ef9d1a5c0b9528b4f35c9d6f4913 100644
43--- a/lib/diagnostics.zsh
44+++ b/lib/diagnostics.zsh
45@@ -192,19 +192,19 @@ function _omz_diag_dump_one_big_text() {
46   command ls -ld ~/.oh*
47   builtin echo
48   builtin echo oh-my-zsh git state:
49-  (cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
50+  (builtin cd $ZSH && builtin echo "HEAD: $(git rev-parse HEAD)" && git remote -v && git status | command grep "[^[:space:]]")
51   if [[ $verbose -ge 1 ]]; then
52-    (cd $ZSH && git reflog --date=default | command grep pull)
53+    (builtin cd $ZSH && git reflog --date=default | command grep pull)
54   fi
55   builtin echo
56   if [[ -e $ZSH_CUSTOM ]]; then
57     local custom_dir=$ZSH_CUSTOM
58     if [[ -h $custom_dir ]]; then
59-      custom_dir=$(cd $custom_dir && pwd -P)
60+      custom_dir=$(builtin cd $custom_dir && pwd -P)
61     fi
62     builtin echo "oh-my-zsh custom dir:"
63     builtin echo "   $ZSH_CUSTOM ($custom_dir)"
64-    (cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
65+    (builtin cd ${custom_dir:h} && command find ${custom_dir:t} -name .git -prune -o -print)
66     builtin echo
67   fi
68 
69diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
70index 6c61725cdcf897ef9f860c19f66d1687e7f0da97..435febc6d56ddc56f947fad6cf010cb3eaedd3b6 100644
71--- a/oh-my-zsh.sh
72+++ b/oh-my-zsh.sh
73@@ -63,7 +63,7 @@ fi
74 
75 # Construct zcompdump OMZ metadata
76 zcompdump_metadata="\
77-#omz revision: $(cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
78+#omz revision: $(builtin cd -q "$ZSH"; git rev-parse HEAD 2>/dev/null)
79 #omz fpath: $fpath\
80 "
81