[PATCH] cg-add checks to see if file exists
From: Rhys Hardwick <hidden>
Date: 2016-06-15 22:41:54
From: Rhys Hardwick <hidden>
Date: 2016-06-15 22:41:54
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 -- "$@"