threads / patch / 338

patchcg-add checks to see if file exists

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

## tl;dr

One message between Apr 26, 2005 and Apr 26, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Rhys Hardwick· Apr 26, 2005, 22:17 UTC · lore
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
Show changes to diff +6 −0
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 -- "$@"

← back to recent threads