# [PATCH] cg-add checks to see if file exists

1 messages from 2005-04-26 to 2005-04-26. Participants: Rhys Hardwick.
Thread: https://gitlist.dev/t/338

## Rhys Hardwick, 2005-04-26 22:17

Subject: [PATCH] cg-add checks to see if file exists
Message-ID: <200504262317.49739.rhys@rhyshardwick.co.uk>
URL: https://gitlist.dev/e/200504262317.49739.rhys%40rhyshardwick.co.uk

```
Hi,

This is a patch to check if the file being added exists, and if not, issues a 
warning and dies.

Rhys




Signed-off-by: Rhys Hardwick <rhys@rhyshardwick.co.uk

Index: cg-add
===================================================================
--- 6159f313b10f0cfcdfedd63d6fb044029fe46aaa/cg-add  (mode:100755 
sha1:8ba5351a4c7e28a577ea1aa4afa1078c54e9bccc)
+++ uncommitted/cg-add  (mode:100755)
@@ -10,4 +10,10 @@

 [ "$1" ] || die "usage: cg-add FILE..."

+if [ -f "$1" ]; then
+       echo "Adding file $1"
+else
+       die "$1 does not exist"
+fi
+
 update-cache --add -- "$@"



```
