File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ #
3
+ # This script checks if the English version of a page has changed since a localized
4
+ # page has been committed.
5
+
6
+ if [ " $# " -ne 1 ] || ! [ -f " $1 " ]; then
7
+ echo -e " \nThis script checks if the English version of a page has changed since a "
8
+ echo -e " localized page has been committed.\n"
9
+ echo -e " Usage:\n\t$0 <PATH>\n" >&2
10
+ echo -e " Example:\n\t$0 content/zh/docs/concepts/_index.md\n" >&2
11
+ exit 1
12
+ fi
13
+
14
+ LOCALIZED=" $1 "
15
+
16
+ # Try get the English version
17
+ EN_VERSION=` echo $LOCALIZED | sed " s/content\/..\//content\/en\//g" `
18
+ if ! [ -f $EN_VERSION ]; then
19
+ echo " $EN_VERSION has been removed."
20
+ exit 2
21
+ fi
22
+
23
+ # Last commit for the localized file
24
+ LASTCOMMIT=` git log -n 1 --pretty=format:%h -- $LOCALIZED `
25
+
26
+ git diff $LASTCOMMIT ...HEAD $EN_VERSION
27
+
28
+ if [ " $? " -eq 0 ]; then
29
+ echo " $LOCALIZED is still in sync"
30
+ exit 3
31
+ fi
You can’t perform that action at this time.
0 commit comments