mirror of
https://github.com/stefanberger/libtpms
synced 2026-08-09 12:48:00 +00:00
scripts: Implement meld-commit to meld by commit Id
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
c2a8109f8b
commit
deef2301e3
43
scripts/meld-commit
Executable file
43
scripts/meld-commit
Executable file
@ -0,0 +1,43 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SKIP_FILES="(CMakeLists.txt|.cmake|CMakePresets.json|Makefile.am|configure.ac)$"
|
||||
|
||||
if [ ! -d "$1" ]; then
|
||||
echo "$1 is not a directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
COMMIT="$2"
|
||||
if [ -z "$2" ]; then
|
||||
echo "2nd parameter must be a commit id. Not given, so assuming 'HEAD'"
|
||||
COMMIT="HEAD"
|
||||
fi
|
||||
|
||||
if [ -z "${TCG_TPM_HOME}" ]; then
|
||||
echo "TCG_TPM_HOME must be set to the TCG TPM repo checkout."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "${TCG_TPM_HOME}" ]; then
|
||||
echo "TCG_TPM_HOME must point to a directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -x
|
||||
LIBTPMS_ROOT="$PWD"
|
||||
|
||||
pushd "${TCG_TPM_HOME}" >/dev/null || exit 1
|
||||
|
||||
git checkout "${COMMIT}" || exit 1
|
||||
|
||||
for fname in $(git diff-tree --no-commit-id --name-only "${COMMIT}" -r); do
|
||||
if [[ $(basename "${fname}") =~ ${SKIP_FILES} ]]; then
|
||||
continue
|
||||
fi
|
||||
mkdir -p "$(dirname "${LIBTPMS_ROOT}/${1}/${fname}")"
|
||||
touch "${LIBTPMS_ROOT}/${1}/${fname}"
|
||||
meld "${fname}" "${LIBTPMS_ROOT}/${1}/${fname}"
|
||||
if [ $(stat -c%s "${LIBTPMS_ROOT}/${1}/${fname}") -eq 0 ]; then
|
||||
rm -f "${LIBTPMS_ROOT}/${1}/${fname}"
|
||||
fi
|
||||
done
|
||||
Loading…
Reference in New Issue
Block a user