Skip to content

Commit

Permalink
Git Clean and Smudge Filters - 試圖修正 Git 總是視 tree 為不乾淨的問題(3)
Browse files Browse the repository at this point in the history
Signed-off-by: 林博仁 <[email protected]>
  • Loading branch information
brlin-tw committed May 3, 2017
1 parent 1211801 commit 8480fa2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
6 changes: 0 additions & 6 deletions Git Clean and Smudge Filters/smudge-bash.bash
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ init(){
exit 1
fi

# Make Git don't consider tree is dirty even when it shouldn't because of the existing clean filter
# Why does 'git status' ignore the .gitattributes clean filter? - Stack Overflow
# http://stackoverflow.com/questions/19807979/why-does-git-status-ignore-the-gitattributes-clean-filter
rm --force .git/index.lock # Workaround: force override git lock
git add -u

declare version
version="$(describe_this_version)"

Expand Down
5 changes: 5 additions & 0 deletions Git Clean and Smudge Filters/smudge-bash.manual-apply.bash
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ smudge_file(){
declare -r temp_file_name=stdout.bash
declare -r temp_file="${global_temp_directory}/${temp_file_name}"

# Workaround: Make Git don't consider tree is dirty even when it shouldn't because of the existing clean filter
# Why does 'git status' ignore the .gitattributes clean filter? - Stack Overflow
# http://stackoverflow.com/questions/19807979/why-does-git-status-ignore-the-gitattributes-clean-filter
git add -u

printf "Smudging %s...\n" "${target_file}"
"${RUNTIME_SCRIPT_DIRECTORY}"/smudge-bash.bash <"${target_file}" >"${temp_file}"
cat "${temp_file}" >"${target_file}"
Expand Down
9 changes: 2 additions & 7 deletions build.bash
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,8 @@ init(){

# Workaround: git tag always dirty even when it's isn't, manually fixing it
# Make Git don't consider tree is dirty even when it shouldn't because of the existing clean filter
for template_file in "${SDC_SOURCE_CODE_DIR}/"*.bash; do
# Why does 'git status' ignore the .gitattributes clean filter? - Stack Overflow
# http://stackoverflow.com/questions/19807979/why-does-git-status-ignore-the-gitattributes-clean-filter
git add -u

"${SDC_GIT_FILTERS_DIR}/smudge-bash.manual-apply.bash" "${template_file}"
done
find "${SDC_SOURCE_CODE_DIR}" -name "*.bash" -print0 | xargs --null --max-args=1 --verbose "${SDC_GIT_FILTERS_DIR}/clean-bash.manual-apply.bash"
"${SDC_GIT_FILTERS_DIR}/smudge-bash.manual-apply.bash" "${SDC_SOURCE_CODE_DIR}/"*.bash

if [ ! -d "${SDC_RELEASE_DIR}" ]; then
mkdir --parents "${SDC_RELEASE_DIR}"
Expand Down

0 comments on commit 8480fa2

Please sign in to comment.