Update as for branch zg1/zone1
This commit is contained in:
parent
10f95e328a
commit
8dea72e22b
@ -11,15 +11,35 @@ if [ -z $IFS ]; then
|
||||
IFS=$'\n'
|
||||
fi
|
||||
|
||||
GIT_PULL_TMP=/tmp/git_pull
|
||||
GIT_PULL_TMP=/tmp/git_changed_files_for_last_pull
|
||||
OPKG_CMDS_TMP=/tmp/opkg_commands
|
||||
|
||||
rm -f $OPKG_PULL_TMP
|
||||
rm -f $GIT_PULL_TMP
|
||||
rm -f $OPKG_CMDS_TMP
|
||||
|
||||
get_blob () { # get the blob of the file(name) passed as $1
|
||||
# note: this can be used for any file in the filesystem
|
||||
echo $(git hash-object $1)
|
||||
}
|
||||
|
||||
get_commit_for_blob () {
|
||||
# search for the blob in all commits for the file(name) $1
|
||||
echo $(git log --all --pretty=format:%H -- $2 |
|
||||
xargs -I{} bash -c "git ls-tree {} -- $2 |
|
||||
grep -q $1 && echo -n {} && head -n 1")
|
||||
}
|
||||
|
||||
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
|
||||
echo "$fn" >> $GIT_PULL_TMP
|
||||
# called in repository: $fn is e.g. etc/psa_tariff/tariff01.json
|
||||
# add '/' prefix
|
||||
fn=$(echo $fn | awk '{ printf "/"$0 }')
|
||||
if [[ -f "$fn" ]]; then
|
||||
blob=$(get_blob "$fn")
|
||||
commit=$(get_commit_for_blob $blob "$fn")
|
||||
fsize=$(ls -l "$fn" | awk '{ print $5 }')
|
||||
echo "$fn $fsize $blob $commit" >> $GIT_PULL_TMP
|
||||
fi
|
||||
fi
|
||||
if grep -E -q ".*opkg_commands" <<< $fn; then
|
||||
readarray opkg_commands < <(cat $fn)
|
||||
|
Loading…
Reference in New Issue
Block a user