You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ngcpcfg/scripts/diff

38 lines
1.2 KiB

#!/bin/bash
# Purpose: show changes in configuration pool
################################################################################
set -e
set -u
set -o pipefail
if ! [ -r /usr/share/ngcp-ngcpcfg/functions/main ] ; then
printf "Error: /usr/share/ngcp-ngcpcfg/functions/main could not be read. Exiting.\n" >&2
exit 1
fi
. /usr/share/ngcp-ngcpcfg/functions/main
# main script
log_debug "cd $NGCPCTL_MAIN"
cd "$NGCPCTL_MAIN"
log_debug "git diff $*"
git diff $*
# added files
log_debug "git status --porcelain | awk '/^\?\? / {print \$2}'"
if git status --porcelain | awk '/^\?\? / {print $2}' | grep -q . ; then
log_info "* New but not yet registered files inside ${NGCPCTL_MAIN}:"
git status --porcelain | awk '/^\?\? / {print $2}' | sed "s/^/$timestamp_replacementchars/"
fi
# deleted files
log_debug "git status --porcelain | awk '/^D / {print \$2}'"
if git status --porcelain | awk '/^D / {print $2}' | grep -q . ; then
log_info "* Removed but not yet unregistered files inside ${NGCPCTL_MAIN}:"
git status --porcelain | awk '/^D / {print $2}' | sed "s/^/$timestamp_replacementchars/"
fi
## END OF FILE #################################################################