aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromkatv <roman.perepelitsa@gmail.com>2019-10-05 19:14:17 +0300
committerromkatv <roman.perepelitsa@gmail.com>2019-10-05 19:14:17 +0300
commitb73042cf43737690d0bae8f3259287c6c9123043 (patch)
tree3690e65c740d4b8d0fe4e782564a8b8f378e39ea
parentad48c1e77ae0028543e8ab082eafe56aaa399572 (diff)
simplify and speed up gitstatus/pull-upstream.zsh
-rwxr-xr-xgitstatus/pull-upstream.zsh10
1 files changed, 4 insertions, 6 deletions
diff --git a/gitstatus/pull-upstream.zsh b/gitstatus/pull-upstream.zsh
index 2cb758a5..05995da4 100755
--- a/gitstatus/pull-upstream.zsh
+++ b/gitstatus/pull-upstream.zsh
@@ -9,10 +9,10 @@ setopt err_exit no_unset pipe_fail extended_glob xtrace
readonly GITSTATUS_DIR GITSTATUS_URL
readonly -a IGNORE=(pull-upstream.zsh README.md)
-function pull() {
- local repo && repo=$(mktemp -d ${TMPDIR:-/tmp}/gitstatus-pull-upstream.XXXXXXXXXX)
+() {
+ local repo && repo="$(mktemp -d ${TMPDIR:-/tmp}/gitstatus-pull-upstream.XXXXXXXXXX)"
trap "rm -rf ${(q)repo}" EXIT
- git clone $GITSTATUS_URL $repo
+ git clone --depth 1 --single-branch $GITSTATUS_URL $repo
local dst
for dst in $GITSTATUS_DIR/**/*(.,@); do
@@ -22,9 +22,7 @@ function pull() {
[[ -f $src ]] && {
mkdir -p ${dst:h} && cp -f $src $dst || return
} || {
- rm $dst
+ rm -f $dst
}
done
}
-
-pull