xref: /openbmc/linux/scripts/check-git (revision 05e96e96)
1*05e96e96SMasahiro Yamada#!/bin/sh
2*05e96e96SMasahiro Yamada# SPDX-License-Identifier: GPL-2.0-only
3*05e96e96SMasahiro Yamada#
4*05e96e96SMasahiro Yamada# succeed if we are in a git repository
5*05e96e96SMasahiro Yamada
6*05e96e96SMasahiro Yamadasrctree="$(dirname $0)/.."
7*05e96e96SMasahiro Yamada
8*05e96e96SMasahiro Yamadaif ! git -C "${srctree}" rev-parse --verify HEAD >/dev/null 2>/dev/null; then
9*05e96e96SMasahiro Yamada	exit 1
10*05e96e96SMasahiro Yamadafi
11*05e96e96SMasahiro Yamada
12*05e96e96SMasahiro Yamadaif ! test -z $(git -C "${srctree}" rev-parse --show-cdup 2>/dev/null); then
13*05e96e96SMasahiro Yamada	exit 1
14*05e96e96SMasahiro Yamadafi
15