forked from AndreyG/libgit2cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrevspec.cpp
More file actions
38 lines (32 loc) · 882 Bytes
/
Copy pathrevspec.cpp
File metadata and controls
38 lines (32 loc) · 882 Bytes
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
29
30
31
32
33
34
35
36
37
#include "git2cpp/revspec.h"
namespace git
{
Revspec::Revspec(git_object * single, Repository const & repo)
: flags_(GIT_REVPARSE_SINGLE)
, revspec_(single, repo)
{}
Revspec::Revspec(git_revspec const & revspec, Repository const & repo)
: flags_(revspec.flags)
, revspec_((revspec.flags & GIT_REVPARSE_SINGLE)
? Range(revspec.from, repo)
: Range(revspec, repo))
{}
Object * Revspec::single()
{
if (flags_ & GIT_REVPARSE_SINGLE)
return &revspec_.from;
else
return nullptr;
}
Revspec::Range const * Revspec::range() const
{
if (flags_ & GIT_REVPARSE_SINGLE)
return nullptr;
else
return &revspec_;
}
unsigned int Revspec::flags() const
{
return flags_;
}
}