浏览代码

Fix diff-pr tar error on empty file

> tar: This does not look like a tar archive
Joe Ferguson 5 年之前
父节点
当前提交
529fe93da0
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. 7 5
      diff-pr.sh

+ 7 - 5
diff-pr.sh

@@ -223,11 +223,13 @@ copy-tar() {
 				if [ "$listTarballContents" ]; then
 					case "$g" in
 						*.tar.*|*.tgz)
-							tar -tf "$dst/$dDirName/$g" \
-								| grep -vE "$uninterestingTarballGrep" \
-								| sed -e 's!^[.]/!!' \
-								| sort \
-								> "$dst/$dDirName/$g  'tar -t'"
+							if [ -s "$dst/$dDirName/$g" ]; then
+								tar -tf "$dst/$dDirName/$g" \
+									| grep -vE "$uninterestingTarballGrep" \
+									| sed -e 's!^[.]/!!' \
+									| sort \
+									> "$dst/$dDirName/$g  'tar -t'"
+							fi
 							;;
 					esac
 				fi