在我的 shell 腳本中,我得到了提交數和發布數。但是我想知道在歸檔應用程式之前是否有任何方法可以知道是否有任何提交要做,如果有任何提交要做,那么不要存檔應用程式顯示錯誤訊息。這是我的shell腳本:
git=$(sh /etc/profile; which git)
number_of_commits=$("$git" rev-list HEAD --count)
git_release_version=$("$git" describe --tags --always --abbrev=0)
target_plist="$TARGET_BUILD_DIR/$INFOPLIST_PATH"
dsym_plist="$DWARF_DSYM_FOLDER_PATH/$DWARF_DSYM_FILE_NAME/Contents/Info.plist"
for plist in "$target_plist" "$dsym_plist"; do
if [ -f "$plist" ]; then
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $number_of_commits" "$plist"
/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ${git_release_version#*v}" "$plist"
fi
done
uj5u.com熱心網友回復:
我認為您正在尋找的條件是:
git diff --name-status | wc -l
它應該為您提供自上次提交以來更改的檔案數。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/329704.html
