Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5662: Fetching the remote of the current branch is working now
- Loading branch information
1 parent
48cf0d8
commit 5f1704a
Showing
7 changed files
with
99 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <memory> | ||
#include <git2.h> | ||
|
||
namespace vcs | ||
{ | ||
|
||
namespace git | ||
{ | ||
|
||
class Reference final | ||
{ | ||
private: | ||
git_reference* _reference; | ||
|
||
public: | ||
using Ptr = std::shared_ptr<Reference>; | ||
|
||
Reference(git_reference* reference) : | ||
_reference(reference) | ||
{} | ||
|
||
std::string getName() const | ||
{ | ||
return git_reference_name(_reference); | ||
} | ||
|
||
std::string getShorthandName() const | ||
{ | ||
return git_reference_shorthand(_reference); | ||
} | ||
|
||
// Returns the upstream of this reference (if configured) | ||
Ptr getUpstream() | ||
{ | ||
git_reference* upstream = nullptr; | ||
git_branch_upstream(&upstream, _reference); | ||
|
||
return upstream != nullptr ? std::make_shared<Reference>(upstream) : Ptr(); | ||
} | ||
|
||
~Reference() | ||
{ | ||
git_reference_free(_reference); | ||
} | ||
}; | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ namespace vcs | |
namespace git | ||
{ | ||
|
||
class Remote | ||
class Remote final | ||
{ | ||
private: | ||
git_remote* _remote; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters