From abf75d636b3919d5f21e6f067e0b6478610227ba Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Tue, 25 Apr 2023 11:01:22 +0200 Subject: [PATCH] assum blob not empty --- .githooks/post-merge | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.githooks/post-merge b/.githooks/post-merge index 3dbb445..0b91abc 100755 --- a/.githooks/post-merge +++ b/.githooks/post-merge @@ -23,12 +23,10 @@ get_blob () { # get the blob of the file(name) passed as $1 } get_commit_for_blob () { - if [ ! -z $1 ]; then - # search for the blob in all commits for the file(name) $1 - echo $(echo $(git log --all --pretty=format:%H -- $1) | - xargs -I{} bash -c "git ls-tree {} -- $1 | - grep -q $1 && echo {}") - fi + # search for the blob in all commits for the file(name) $1 + echo $(echo $(git log --all --pretty=format:%H -- $1) | + xargs -I{} bash -c "git ls-tree {} -- $1 | + grep -q $1 && echo {}") } changed_file_names () { @@ -49,7 +47,7 @@ for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do blob=$(get_blob "$fn") commit=$(get_commit_for_blob $blob) fsize=$(ls -l "$fn" | awk '{ print $5 }') - echo "$fn $fsize $blob $commit" >> $GIT_PULL_TMP + echo "$fn $fsize b=$blob c=$commit" >> $GIT_PULL_TMP fi fi if grep -E -q ".*opkg_commands" <<< $fn; then