/***************************************************************************
 * ROM Properties Page shell extension. (librpbase)                        *
 * git.h: Git version macros.                                              *
 *                                                                         *
 * Copyright (c) 2008-2023 by David Korth.                                 *
 * SPDX-License-Identifier: GPL-2.0-or-later                               *
 ***************************************************************************/

#pragma once

// git_version.h is generated by git_version.sh
#include "git_version.h"

// RP_GIT_VERSION: Macro for the git revision, if available.
#ifdef GIT_REPO
#  ifdef GIT_BRANCH
#    define RP_GIT_TMP_BRANCH GIT_BRANCH
#    ifdef GIT_SHAID
#      define RP_GIT_TMP_SHAID "/" GIT_SHAID
#    else /* !GIT_SHAID */
#       define RP_GIT_TMP_SHAID
#    endif /* GIT_SHAID */
#  else /* !GIT_BRANCH */
#    define RP_GIT_TMP_BRANCH
#    ifdef GIT_SHAID
#      define RP_GIT_TMP_SHAID GIT_SHAID
#    else /* !GIT_SHAID */
#      define RP_GIT_TMP_SHAID
#    endif /* GIT_SHAID */
#  endif /* GIT_BRANCH */

#  ifdef GIT_DIRTY
#    define RP_GIT_TMP_DIRTY "+"
#  else /* !GIT_DIRTY */
#    define RP_GIT_TMP_DIRTY
#  endif /* GIT_DIRTY */

#  define RP_GIT_VERSION "git: " RP_GIT_TMP_BRANCH RP_GIT_TMP_SHAID RP_GIT_TMP_DIRTY
#  ifdef GIT_DESCRIBE
#    define RP_GIT_DESCRIBE GIT_DESCRIBE RP_GIT_TMP_DIRTY
#  endif

#else /* !GIT_REPO */
#  ifdef RP_GIT_VERSION
#    undef RP_GIT_VERSION
#  endif /* RP_GIT_VERSION */
#  ifdef RP_GIT_DESCRIBE
#    undef RP_GIT_DESCRIBE
#  endif /* RP_GIT_DESCRIBE */
#endif /* GIT_REPO */
