|
@ -14,8 +14,11 @@ |
|
|
# Calculate the Git hash for a file |
|
|
# Calculate the Git hash for a file |
|
|
function fn_get_git_hash(){ |
|
|
function fn_get_git_hash(){ |
|
|
filename=$1 |
|
|
filename=$1 |
|
|
if [ -e $filename ] |
|
|
if [ -e $filename ]; then |
|
|
then |
|
|
gitcmd="$(which git)" |
|
|
|
|
|
if [ -x "${gitcmd}" ]; then |
|
|
|
|
|
$gitcmd hash-object "${filename}" |
|
|
|
|
|
else |
|
|
filesize=$(stat --format='%s' $filename) |
|
|
filesize=$(stat --format='%s' $filename) |
|
|
if [ "$(tail -c1 $filename)" == "" ]; then |
|
|
if [ "$(tail -c1 $filename)" == "" ]; then |
|
|
printf "blob %d\0%s\n" "${filesize}" "$(cat $filename)" | sha1sum | awk '{print $1}' |
|
|
printf "blob %d\0%s\n" "${filesize}" "$(cat $filename)" | sha1sum | awk '{print $1}' |
|
@ -23,6 +26,7 @@ function fn_get_git_hash(){ |
|
|
printf "blob %d\0%s" "${filesize}" "$(cat $filename)" | sha1sum | awk '{print $1}' |
|
|
printf "blob %d\0%s" "${filesize}" "$(cat $filename)" | sha1sum | awk '{print $1}' |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
fi |
|
|
|
|
|
fi |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
fn_get_github_manifest(){ |
|
|
fn_get_github_manifest(){ |
|
|