git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Carl Worth <cworth@cworth.org>
To: git@vger.kernel.org
Cc: Carl Worth <cworth@cworth.org>
Subject: [PATCH 1/3] Trap exit to clean up created directory if clone fails.
Date: Fri, 17 Feb 2006 13:33:24 -0800	[thread overview]
Message-ID: <11402120042011-git-send-email-cworth@cworth.org> (raw)
In-Reply-To: <11402120031687-git-send-email-cworth@cworth.org>

Signed-off-by: Carl Worth <cworth@cworth.org>


---

 git-clone.sh |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

589b68168e3dad89238b879b06680c662a99ad8d
diff --git a/git-clone.sh b/git-clone.sh
index e192b08..d184ceb 100755
--- a/git-clone.sh
+++ b/git-clone.sh
@@ -118,6 +118,7 @@ dir="$2"
 [ -e "$dir" ] && echo "$dir already exists." && usage
 mkdir -p "$dir" &&
 D=$(cd "$dir" && pwd) &&
+trap 'err=$?; rm -r $D; exit $err' exit
 case "$bare" in
 yes) GIT_DIR="$D" ;;
 *) GIT_DIR="$D/.git" ;;
@@ -255,3 +256,6 @@ Pull: $head_points_at:$origin" &&
 		git checkout
 	esac
 fi
+
+trap - exit
+
-- 
1.2.0.gf6e8

  reply	other threads:[~2006-02-17 21:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-17 21:33 Making git-clone clean up when it fails Carl Worth
2006-02-17 21:33 ` Carl Worth [this message]
2006-02-17 21:33   ` [PATCH 2/3] Abstract test_create_repo out for use in tests Carl Worth
2006-02-17 21:33     ` [PATCH 3/3] New test to verify that when git-clone fails it cleans up the new directory Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11402120042011-git-send-email-cworth@cworth.org \
    --to=cworth@cworth.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).