Commit 131d0239 authored by Frank Siegert's avatar Frank Siegert Committed by Enrico Bothmann

Make Git_Info aware of local modifications in subdirectories.

Also fixes problems in old git versions with -C option.
Fixes #6 and probably fixes #19 as well.


(cherry picked from commit fff49436)
parent cd6008ab
......@@ -445,6 +445,8 @@ void Run_Parameter::Gen::PrintGitVersion(std::ostream &str,const int mode,
if (info.empty()) THROW(fatal_error,"No Git information");
std::string branch(info.begin()->second->Branch());
std::string revision(info.begin()->second->Revision());
if (branch.find("rel-")!=0)
msg_Info()<<"WARNING: You are using an unsupported development branch."<<endl;
str<<prefix<<"Git branch "<<branch<<", revision "<<revision;
if (mode&1) str<<" {\n";
else str<<"."<<std::endl;
......@@ -452,12 +454,9 @@ void Run_Parameter::Gen::PrintGitVersion(std::ostream &str,const int mode,
iit(info.begin());iit!=info.end();++iit) {
if (mode&1) str<<prefix<<" "<<iit->second->Checksum()
<<" "<<iit->second->Name()<<"\n";
if (iit->second->Branch()!=branch) str<<prefix
<<"===> "<<iit->second->Name()<<" has branch "<<iit->second->Branch()
<<", first seen was "<<branch<<" <===\n";
if (iit->second->Revision()!=revision) str<<prefix
<<"===> "<<iit->second->Name()<<" has revision "<<iit->second->Revision()
<<", first seen was "<<revision<<" <===\n";
<<"===> "<<iit->second->Name()<<" has local modifications "
<<" <===\n";
}
if (mode&1) str<<prefix<<"}\n";
str<<std::endl;
......
......@@ -3,7 +3,7 @@ MD5_EXCLUDE ?=
Git_Info.C: Git_Info.C.in
@if ! which git > /dev/null || \
! git -C $(top_srcdir) rev-parse HEAD > /dev/null 2>&1; then \
! (cd $(top_srcdir); git rev-parse HEAD > /dev/null 2>&1); then \
if test -f $(srcdir)/$@; then \
cp $(srcdir)/$@ $@.tmp; chmod u+rw $@.tmp; \
else \
......@@ -15,7 +15,10 @@ Git_Info.C: Git_Info.C.in
exit 1; \
fi; \
else \
rev=$$(git -C $(top_srcdir) rev-parse HEAD); \
rev=$$(cd $(top_srcdir); git rev-parse HEAD); \
if test -n "$$(cd $(srcdir); git status -s --untracked-files=no .)"; then \
rev=$$rev"-dirty"; \
fi; \
url=$$(git rev-parse --abbrev-ref HEAD); \
echo '#include "ATOOLS/Org/Git_Info.H"' > $@.tmp; \
echo 'static ATOOLS::Git_Info initializer' >> $@.tmp; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment