Add version.{h,cpp}: Returning version info
这个提交包含在:
		
							
								
								
									
										2
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								Makefile
									
									
									
									
									
								
							@@ -55,6 +55,8 @@ gtest: $(GTESTS_TESTDIR)/*.cpp $(GTEST_OBJECTS)
 | 
				
			|||||||
%.o:%.cpp
 | 
					%.o:%.cpp
 | 
				
			||||||
	$(CXX) ${CXXFLAGS} ${LDFLAGS} ${INCLUDEFLAGS} -c -o $@ $<
 | 
						$(CXX) ${CXXFLAGS} ${LDFLAGS} ${INCLUDEFLAGS} -c -o $@ $<
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					version.o:version.cpp
 | 
				
			||||||
 | 
						$(CXX) ${CXXFLAGS} ${LDFLAGS} ${INCLUDEFLAGS} -DGITCOMMIT=\"$(shell git rev-parse --short HEAD)\" -c -o $@ $<
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
	rm -f $(OBJECTS) $(DEPENDS)
 | 
						rm -f $(OBJECTS) $(DEPENDS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,6 +41,7 @@ SOFTWARE.
 | 
				
			|||||||
#include "cli.h"
 | 
					#include "cli.h"
 | 
				
			||||||
#include "cliconsole.h"
 | 
					#include "cliconsole.h"
 | 
				
			||||||
#include "cliserver.h"
 | 
					#include "cliserver.h"
 | 
				
			||||||
 | 
					#include "version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void sigterm_handler(int arg)
 | 
					void sigterm_handler(int arg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -73,11 +74,6 @@ std::unique_ptr<ICache> createCache(const ConfigVariableResolver &resolver)
 | 
				
			|||||||
	return std::make_unique<FsCache>(path);
 | 
						return std::make_unique<FsCache>(path);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
std::string get_version_string()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	return "master";
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int main(int argc, char **argv)
 | 
					int main(int argc, char **argv)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										11
									
								
								version.cpp
									
									
									
									
									
										普通文件
									
								
							
							
						
						
									
										11
									
								
								version.cpp
									
									
									
									
									
										普通文件
									
								
							@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					#include "version.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					std::string git_commit_id()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return std::string(GITCOMMIT);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					std::string get_version_string()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return git_commit_id() + " Built: " + __DATE__ + " " + __TIME__;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		在新工单中引用
	
	屏蔽一个用户