Debian Codegraph @

src/atlas/library/git_sha1.h.in

raw
1 /*
2 * (C) Copyright 2013 ECMWF.
3 *
4 * This software is licensed under the terms of the Apache Licence Version 2.0
5 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 * In applying this licence, ECMWF does not waive the privileges and immunities
7 * granted to it by virtue of its status as an intergovernmental organisation
8 * nor does it submit to any jurisdiction.
9 */
10
11 #pragma once
12
13 #define ATLAS_GIT_SHA1 "@atlas_GIT_SHA1@"
14
15 #include <algorithm>
16 #include <string>
17
18 namespace atlas {
19 namespace library {
20 inline const char* git_sha1( unsigned int chars = 7 ) {
21 static std::string sha1( ATLAS_GIT_SHA1 );
22 if ( sha1.empty() ) { return "not available"; }
23 sha1 = sha1.substr( 0, std::min( chars, 40u ) );
24 return sha1.c_str();
25 }
26 } // namespace library
27 } // namespace atlas