Commit 062a7b830de7f3eabab23456fb5ff88843a8f958

Authored by Shrikant Sharat
1 parent c1b8cc5a8e

Refactor temporary git function.

Renamed function to a temporary looking name and to more reflect its purpose.
Also, undefining the function once its purpose has been done.

Showing 1 changed file with 12 additions and 6 deletions Side-by-side Diff

... ... @@ -181,32 +181,38 @@ antigen-update () {
181 181 # Get the clone's directory as per the given repo url and branch.
182 182 local url="$1"
183 183 local clone_dir="$(-antigen-get-clone-dir $url)"
184   - Git () { eval git --git-dir=$clone_dir/.git --work-tree=$clone_dir "$@" }
  184 +
  185 + # A temporary function wrapping the `git` command with repeated arguments.
  186 + --plugin-git () {
  187 + eval git --git-dir=$clone_dir/.git --work-tree=$clone_dir "$@"
  188 + }
185 189  
186 190 # Clone if it doesn't already exist.
187 191 if [[ ! -d $clone_dir ]]; then
188 192 git clone "${url%|*}" "$clone_dir"
189 193 elif $update; then
190 194 # Save current revision.
191   - old_rev="$(Git rev-parse HEAD)"
  195 + old_rev="$(--plugin-git rev-parse HEAD)"
192 196 # Pull changes if update requested.
193   - Git pull
  197 + --plugin-git pull
194 198 # Get the new revision.
195   - new_rev="$(Git rev-parse HEAD)"
  199 + new_rev="$(--plugin-git rev-parse HEAD)"
196 200 fi
197 201  
198 202 # If its a specific branch that we want, checkout that branch.
199 203 if [[ $url == *\|* ]]; then
200   - Git checkout "${url#*|}"
  204 + --plugin-git checkout "${url#*|}"
201 205 fi
202 206  
203 207 if ! [[ -z $old_rev || $old_rev == $new_rev ]]; then
204 208 echo Updated from ${old_rev:0:7} to ${new_rev:0:7}.
205 209 if $verbose; then
206   - Git log --oneline --reverse --no-merges --stat '@{1}..'
  210 + --plugin-git log --oneline --reverse --no-merges --stat '@{1}..'
207 211 fi
208 212 fi
209 213  
  214 + unfunction -- --plugin-git
  215 +
210 216 }
211 217  
212 218 -antigen-load () {