X-Git-Url: https://git.madduck.net/code/vcsh.git/blobdiff_plain/17cd983a970777a7d8196587e5cbc501c63fc64b..794f0aac869dda034300211e9be45db123d84377:/vcsh?ds=inline diff --git a/vcsh b/vcsh index 9b1a558..c9c706b 100755 --- a/vcsh +++ b/vcsh @@ -12,6 +12,12 @@ # which is admittedly extremely unlikely to the point of being impossible, # this software will most likely follow suit. +basename() { + local f; f="${1##*/}" + [ -z "$2" ] || f="${f%$2}" + echo "$f" +} + SELF=$(basename $0) VERSION='1.2' @@ -171,7 +177,7 @@ git_dir_exists() { hook() { for hook in $VCSH_HOOK_D/$1* $VCSH_HOOK_D/$VCSH_REPO_NAME.$1*; do [ -x "$hook" ] || continue - info "executing '$hook'" + verbose "executing '$hook'" "$hook" done } @@ -258,9 +264,9 @@ write_gitignore() { tempfile=$(mktemp) || fatal "could not create tempfile" 51 echo '*' > "$tempfile" || fatal "could not write to '$tempfile'" 57 for gitignore in $gitignores; do - echo "$gitignore" | sed 's/^/!/' >> "$tempfile" || fatal "could not write to '$tempfile'" 57 + echo "$gitignore" | sed 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57 if [ x$VCSH_GITIGNORE = x'recursive' ] && [ -d "$gitignore" ]; then - { echo "$gitignore/*" | sed 's/^/!/' >> "$tempfile" || fatal "could not write to '$tempfile'" 57; } + { echo "$gitignore/*" | sed 's@^@!/@' >> "$tempfile" || fatal "could not write to '$tempfile'" 57; } fi done if diff -N "$tempfile" "$VCSH_BASE/.gitignore.d/$VCSH_REPO_NAME" > /dev/null; then