blob: 2a6ef4ca92c7aba0671f7683440bb31bd830b330 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/usr/bin/ruby -w
$stdout.write(<<END)
#include "git-tag.h"
END
IO.popen(["git", "describe", "--always", "--dirty", "--long", "--tags"], "r") do | io |
$stdout.write("const char *GIT_TAG = #{io.read.strip.dump};\n")
end
IO.popen(["git", "diff"]) do | io |
diff = io.read
if diff.strip == ""
$stdout.write("const char *GIT_DIFF = nullptr;\n")
else
$stdout.write("const char *GIT_DIFF = #{diff.dump};\n")
end
end
IO.popen(["git", "diff", "--stat"]) do | io |
stat = io.read
if stat.strip == ""
$stdout.write("const char *GIT_STAT = nullptr;\n")
else
$stdout.write("const char *GIT_STAT = #{stat.dump};\n")
end
end
|