1#!/usr/bin/env bash 2# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. 3# If clang_format_diff.py command is not specfied, we assume we are able to 4# access directly without any path. 5 6TGT_DIFF=`git diff TARGETS | head -n 1` 7 8if [ ! -z "$TGT_DIFF" ] 9then 10 echo "TARGETS file has uncommitted changes. Skip this check." 11 exit 0 12fi 13 14echo Backup original TARGETS file. 15 16cp TARGETS TARGETS.bkp 17 18${PYTHON:-python3} buckifier/buckify_rocksdb.py 19 20TGT_DIFF=`git diff TARGETS | head -n 1` 21 22if [ -z "$TGT_DIFF" ] 23then 24 mv TARGETS.bkp TARGETS 25 exit 0 26else 27 echo "Please run '${PYTHON:-python3} buckifier/buckify_rocksdb.py' to update TARGETS file." 28 echo "Do not manually update TARGETS file." 29 ${PYTHON:-python3} --version 30 mv TARGETS.bkp TARGETS 31 exit 1 32fi 33