فهرست منبع

Switch %%LOGO%% to use an explicit commit link so that logos update in the same way the rest of the content does

Tianon Gravi 10 سال پیش
والد
کامیت
8771a4c49f
1فایلهای تغییر یافته به همراه15 افزوده شده و 5 حذف شده
  1. 15 5
      update.sh

+ 15 - 5
update.sh

@@ -107,11 +107,21 @@ for repo in "${repos[@]}"; do
 		fi
 		
 		logo=
-		if [ -e "$repo/logo.png" ]; then
-			logo="![logo](https://raw.githubusercontent.com/docker-library/docs/master/$repo/logo.png)"
-		elif [ -e "$repo/logo.svg" ]; then
-			# rawgit.com because: http://stackoverflow.com/a/16462143/433558
-			logo="![logo](https://rawgit.com/docker-library/docs/master/$repo/logo.svg)"
+		logoFile=
+		for f in png svg; do
+			if [ -e "$repo/logo.$f" ]; then
+				logoFile="$repo/logo.$f"
+				break
+			fi
+		done
+		if [ "$logoFile" ]; then
+			logoCommit="$(git log -1 --format='format:%H' -- "$logoFile" 2>/dev/null || true)"
+			[ "$logoCommit" ] || logoCommit='master'
+			if [ "${logoFile##*.}" = 'svg' ]; then
+				logo="![logo](https://rawgit.com/docker-library/docs/$logoCommit/$logoFile)"
+			else
+				logo="![logo](https://raw.githubusercontent.com/docker-library/docs/$logoCommit/$logoFile)"
+			fi
 		fi
 		
 		compose=