try to use blob and commit for changed file
This commit is contained in:
parent
93ba8215b9
commit
f248f3f85f
@ -23,28 +23,34 @@ get_blob () { # get the blob of the file(name) passed as $1
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_commit_for_blob () {
|
get_commit_for_blob () {
|
||||||
blob=$(get_blob $1)
|
if [ ! -z $1 ]; then
|
||||||
if [ ! -z $blob ]; then
|
|
||||||
# search for the blob in all commits for the file(name) $1
|
# search for the blob in all commits for the file(name) $1
|
||||||
echo $(echo $(git log --all --pretty=format:%H -- $1) |
|
echo $(echo $(git log --all --pretty=format:%H -- $1) |
|
||||||
xargs -I{} bash -c "git ls-tree {} -- $1 |
|
xargs -I{} bash -c "git ls-tree {} -- $1 |
|
||||||
grep -q $blob && echo {}")
|
grep -q $1 && echo {}")
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
changed_file_names () {
|
changed_file_names () {
|
||||||
for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do
|
for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do
|
||||||
|
# called in repository: $fn is e.g. etc/psa_tariff/tariff01.json
|
||||||
|
# add '/' prefix
|
||||||
|
fn=$(echo $fn | awk '{ printf "/"$0 }')
|
||||||
CHANGED_FILE_NAMES+=($fn)
|
CHANGED_FILE_NAMES+=($fn)
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do
|
for fn in $(git diff-tree -r HEAD@{1} HEAD --name-only); do
|
||||||
if grep -E -q "(DC.*json|dc.*hex|dc.*bin|tariff.*json)" <<< $fn; then
|
if grep -E -q "(DC.*json|dc.*hex|dc.*bin|tariff.*json)" <<< $fn; then
|
||||||
fsize=0
|
# called in repository: $fn is e.g. etc/psa_tariff/tariff01.json
|
||||||
|
# add '/' prefix
|
||||||
|
fn=$(echo $fn | awk '{ printf "/"$0 }')
|
||||||
if [[ -f "$fn" ]]; then
|
if [[ -f "$fn" ]]; then
|
||||||
|
blob=$(get_blob "$fn")
|
||||||
|
commit=$(get_commit_for_blob $blob)
|
||||||
fsize=$(ls -l "$fn" | awk '{ print $5 }')
|
fsize=$(ls -l "$fn" | awk '{ print $5 }')
|
||||||
|
echo "$fn $fsize $blob $commit" >> $GIT_PULL_TMP
|
||||||
fi
|
fi
|
||||||
echo "$fn $fsize" >> $GIT_PULL_TMP
|
|
||||||
fi
|
fi
|
||||||
if grep -E -q ".*opkg_commands" <<< $fn; then
|
if grep -E -q ".*opkg_commands" <<< $fn; then
|
||||||
readarray opkg_commands < <(cat $fn)
|
readarray opkg_commands < <(cat $fn)
|
||||||
|
Loading…
Reference in New Issue
Block a user