Welcome to mirror list, hosted at ThFree Co, Russian Federation.

unlinked-images.sh « tasks - gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2f12d6115b30d8ce71f7ab094ff2ceb255a382ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/bash

unlinked_files=0

if [[ -z "$1" ]]; then
  echo "ERROR: No search path supplied."
  exit 1
fi

for FILE in $(git ls-files ./"$1"/*.png ./"$1"/*.gif ./"$1"/*.jpg); do
  if ! git grep "$(basename "$FILE")" > /dev/null; then echo "Unlinked file: $FILE"; unlinked_files+=1; fi
done

if [[ $unlinked_files -gt 0 ]]; then
  echo "ERROR: Unlinked files found."
  exit 1
else
  echo "INFO: No unlinked files found."
  exit 0
fi