存档前检查是否有任何提交要做?
Before Archiving check If there is any commit to do?
在我的 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
我认为你要找的条件是:
git diff --name-status | wc -l
它应该为您提供自上次提交以来更改的文件数。
在我的 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
我认为你要找的条件是:
git diff --name-status | wc -l
它应该为您提供自上次提交以来更改的文件数。