我希望从通常的 git 存储库中的 git tag 中提取标记者名称和电子邮件。如果我说git show -q <mytag>。git 向我展示了这样的东西:
tag <mytag>
Tagger: tagger <mail>
Date: tagdate
Tagcomment
commit hash
Author: commitauthor <mail>
Date: commitdate
Commit comment
Run Code Online (Sandbox Code Playgroud)
出于编写脚本的目的,我只需要标记者的邮件和标记日期。我尝试了很多,但找不到任何方法让 git 仅打印此信息。我不想使用grep或其他 shell 工具,也不希望 git 打印完整提交。有任何想法吗?谢谢!
我只是想知道以下C++代码是否可以正常工作:
struct B1 {
virtual void f() {};
};
struct B2 {
virtual void f2() {};
};
struct D:public B1,public B2 {
};
int main() {
D d;
B1 *b1=&d;
if (dynamic_cast<B2*>(b1)) {
B2* b2 = reinterpret_cast<B2*>(b1); //is this conversion valid?
};
return 1;
};
Run Code Online (Sandbox Code Playgroud)
当然,你为什么需要这个呢?因为我想替换这个:
C::C(B1* b): member(dynamic_cast<B2*>(b)?dynamic_cast<B2*>(b)->m():b) {};
Run Code Online (Sandbox Code Playgroud)
具有更好的结构(通过性能,不检查类型安全两次):
C::C(B1* b): member(dynamic_cast<B2*>(b)?reinterpret_cast<B2*>(b)->m():b) {};
Run Code Online (Sandbox Code Playgroud)
提前致谢!