Skip to content

Commit 5086776

Browse files
committed
Git example: avoid exceeding 132 max line length
1 parent 479490f commit 5086776

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ endif()
77
project(Fortran2018Examples
88
LANGUAGES C Fortran
99
DESCRIPTION "Example of using modern Fortran syntax"
10-
VERSION 1.3.1)
10+
VERSION 1.3.2)
1111

1212
enable_testing()
1313

git/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
find_package(Git)
22

3+
set(_max_len 80) # arbitrary limit, so as not to exceed maximum 132 character Fortran line length.
4+
35
set(git_version ${GIT_VERSION_STRING})
6+
string(SUBSTRING ${git_version} 0 ${_max_len} git_version)
47
if(GIT_FOUND)
8+
59
# git branch --show-current requires Git >= 2.22, June 2019
610
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
711
OUTPUT_VARIABLE git_branch OUTPUT_STRIP_TRAILING_WHITESPACE)
12+
string(SUBSTRING ${git_branch} 0 ${_max_len} git_branch)
13+
814
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
915
OUTPUT_VARIABLE git_rev OUTPUT_STRIP_TRAILING_WHITESPACE)
16+
string(SUBSTRING ${git_rev} 0 ${_max_len} git_rev)
1017

1118
set(git_porcelain .true.)
1219
execute_process(COMMAND ${GIT_EXECUTABLE} status --porcelain

git/main.in.f90

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ program git_demo
1010
rev = "@git_rev@"
1111
porcelain = @git_porcelain@
1212

13-
print *, "MyProgram git_version:", git_version, " git_branch: ", branch, " git revision: ", rev, ' git_porcelain', porcelain
13+
print *, "git_version: ", git_version
14+
print *, "git_branch: ", branch
15+
print *, "git revision: ", rev
16+
print *, "git_porcelain ", porcelain
1417
!! could also use this to set a warning or other logical flag
1518

1619
end program

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project('Fortran2018examples', 'fortran', 'c',
2-
version : '1.3.1',
2+
version : '1.3.2',
33
meson_version: '>= 0.52.0',
44
default_options : ['default_library=static', 'buildtype=release', 'warning_level=3'])
55

0 commit comments

Comments
 (0)