]> git.nbdom.net Git - nb.git/commitdiff
etc/profile.d/git.sh
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 12 Jan 2018 05:20:41 +0000 (05:20 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Fri, 12 Jan 2018 05:20:41 +0000 (05:20 +0000)
etc/profile.d/git.sh

index a289f78c209127e16de8aa68729c085f506ff41f..0f45b1874184236443e85e6f562b8ce7a3a57e8e 100644 (file)
@@ -242,11 +242,15 @@ echo -e $output | column -t -s ', '
 )
 }
 
-git_clean_repo() {
+git_clone_and_clean() {
   local usage="git_clean_repo REPO"
   local repo=${1:-?$usage}
-  cat <<EOF
-  git_clone $repo || return
+  local tmp=/tmp/git_clone_and_clean
+(
+  rm -rf "$tmp"
+  mkdir -p "$tmp"
+  cd "$tmp" || return
+  git_clone $repo . || return
   git_track_branches || return
 
   echo "Cleaning the files"
@@ -261,5 +265,5 @@ git_clean_repo() {
   echo "Push the cleaned repository"
   git push origin --force --all || return
   git push origin --force --tags || return
-EOF
+)
 }