From 803ac89fe5d26425654876ee85686c67e37503b8 Mon Sep 17 00:00:00 2001 From: cocoatomo Date: Tue, 14 Mar 2017 00:33:51 +0900 Subject: [PATCH] =?UTF-8?q?Do=20not=20commit=20difference=20in=20lines=20'?= =?UTF-8?q?=E6=9C=80=E7=B5=82=E6=9B=B4=E6=96=B0=E6=97=A5=E6=99=82:=20'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even if some HTML file has no change in its contents, its 'Last updated on' ('最終更新日時: ' in Japanese) line could have been changed. This difference is less informative and noizy, so it should be ignored. --- .travis.yml | 7 +------ update_github_pages.sh | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 6 deletions(-) create mode 100755 update_github_pages.sh diff --git a/.travis.yml b/.travis.yml index 9b08d74..fc82b14 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,12 +17,7 @@ install: - sphinx-build -j4 -D language=ja -D locale_dirs=locale -D gettext_compact=0 -A versionswitcher=1 -E -d build/doctrees . ../../py27 script: - cd ../../py27 -- git config user.email "travis-build-bot@example.com" -- git config user.name "Autobuild bot on Travis-CI" -- git pull origin master -- git add . -- if [ $(git status -s | wc -l) -eq 0 ]; then echo "nothing to commit"; exit 0; fi -- git commit -a -m "update html" +- ../py27-locale/update_github_pages.sh - git push --quiet "https://${GH_TOKEN}@github.com/python-doc-ja/py27.git" master:master env: diff --git a/update_github_pages.sh b/update_github_pages.sh new file mode 100755 index 0000000..09eb08c --- /dev/null +++ b/update_github_pages.sh @@ -0,0 +1,22 @@ +#!/bin/bash +set -Ceux + +git config user.email "travis-build-bot@example.com" +git config user.name "Autobuild bot on Travis-CI" +git config --local core.quotepath false +git pull origin master +if [ $(git status -s | wc -l) -eq 0 ]; then + echo "nothing to commit" + exit 0 +elif [ $(git --no-pager diff -G"最終更新日時: " | wc -l) -eq 0 ]; then + git add . +else + files_to_add=$(git --no-pager diff --numstat | awk '! ($1 == 1 && $2 == 1 && $3 ~ /.html$/) { print $3 }') + if [ -z "${files_to_add}" ]; then + echo "nothing to commit except for lines of '最終更新日時: '" + exit 0 + else + git add ${files_to_add} + fi +fi +git commit -m "update html"