# [PATCH] Check if pack directory exists prior to descending into it

2 messages from 2006-08-29 to 2006-08-29. Participants: Matthias Kestenholz, Junio C Hamano.
Thread: https://gitlist.dev/t/5425

## Matthias Kestenholz, 2006-08-29 09:12

Subject: [PATCH] Check if pack directory exists prior to descending into it
Message-ID: <20060829091214.GA10155@spinlock.ch>
URL: https://gitlist.dev/e/20060829091214.GA10155%40spinlock.ch

```
This fixes the following warning:

git-repack: line 42: cd: .git/objects/pack: No such file or directory

This happens only, when git-repack -a is run without any packs in the
repository.

Signed-off-by: Matthias Kestenholz <matthias@spinlock.ch>
---
 git-repack.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/git-repack.sh b/git-repack.sh
index 9da92fb..584a732 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -38,7 +38,7 @@ case ",$all_into_one," in
 	pack_objects=
 
 	# Redundancy check in all-into-one case is trivial.
-	existing=`cd "$PACKDIR" && \
+	existing=`test -d "$PACKDIR" && cd "$PACKDIR" && \
 	    find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
 	;;
 esac
-- 
1.4.2.g2f76

```

## Junio C Hamano, 2006-08-29 09:17

Subject: Re: [PATCH] Check if pack directory exists prior to descending into it
Message-ID: <7v1wqzoq8n.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7v1wqzoq8n.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <20060829091214.GA10155@spinlock.ch>

```
Makes sense.  Thanks.

```
