summaryrefslogtreecommitdiffstats
path: root/src/rocksdb/buckifier/check_buck_targets.sh
blob: 66c83c52f373649c00bef8734dea4a7af86790cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env bash
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
# If clang_format_diff.py command is not specfied, we assume we are able to
# access directly without any path.

TGT_DIFF=`git diff TARGETS | head -n 1`

if [ ! -z "$TGT_DIFF" ]
then
  echo "TARGETS file has uncommitted changes. Skip this check."
  exit 0
fi

echo Backup original TARGETS file.

cp TARGETS TARGETS.bkp

${PYTHON:-python3} buckifier/buckify_rocksdb.py

TGT_DIFF=`git diff TARGETS | head -n 1`

if [ -z "$TGT_DIFF" ]
then
  mv TARGETS.bkp TARGETS
  exit 0
else
  echo "Please run '${PYTHON:-python3} buckifier/buckify_rocksdb.py' to update TARGETS file."
  echo "Do not manually update TARGETS file."
  ${PYTHON:-python3} --version
  mv TARGETS.bkp TARGETS
  exit 1
fi