WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
chmod 600 ~/.ssh_tests/id_rsa*
git config --global user.name "John Doe"
git config --global user.email [email protected]
git config --global --add safe.directory /__w/nodegit/nodegit

- uses: actions/checkout@v2

Expand Down
51 changes: 51 additions & 0 deletions generate/templates/manual/include/lfs_cmd.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#ifndef NODEGIT_LFS_CMD_H
#define NODEGIT_LFS_CMD_H

#include <memory>
#include <string>
#include "cmd.h"

namespace nodegit {
/**
* \struct LfsCmdOpts
* Abstract structure to store options for the LFS commands.
*/
struct LfsCmdOpts {
LfsCmdOpts() = default;
virtual ~LfsCmdOpts() = default;
LfsCmdOpts(const LfsCmdOpts &other) = delete;
LfsCmdOpts(LfsCmdOpts &&other) = delete;
LfsCmdOpts& operator=(const LfsCmdOpts &other) = delete;
LfsCmdOpts& operator=(LfsCmdOpts &&other) = delete;

virtual std::string BuildArgs() const = 0;
};

/**
* \class LfsCmd
* An LFS command to execute.
*/
class LfsCmd : public Cmd {
public:
static const char* kStrLfsCmd;

// Enumeration describing the type of LFS command
enum class Type {kNone};

LfsCmd(Type lfsCmdType, std::unique_ptr<LfsCmdOpts> &&opts);
LfsCmd() = delete;
~LfsCmd() = default;
LfsCmd(const LfsCmd &other) = delete;
LfsCmd(LfsCmd &&other) = delete;
LfsCmd& operator=(const LfsCmd &other) = delete;
LfsCmd& operator=(LfsCmd &&other) = delete;

std::string Command() const;
std::string Args() const;

private:
Type m_lfsCmdType {Type::kNone};
std::unique_ptr<LfsCmdOpts> m_opts {};
};
} // namespace nodegit
#endif // NODEGIT_LFS_CMD_H
36 changes: 36 additions & 0 deletions generate/templates/manual/src/lfs_cmd.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include "../include/lfs_cmd.h"

const char* nodegit::LfsCmd::kStrLfsCmd = "git lfs";

/**
* LfsCmd::LfsCmd
*
* Constructor from type and options.
*/
nodegit::LfsCmd::LfsCmd(Type lfsCmdType, std::unique_ptr<nodegit::LfsCmdOpts> &&opts) :
m_lfsCmdType(lfsCmdType), m_opts(std::move(opts)) {
}

/**
* nodegit::LfsCmd::Command
*
* \return string with LFS command to execute.
*/
std::string nodegit::LfsCmd::Command() const {
std::string strCmd {nodegit::LfsCmd::kStrLfsCmd};

switch (m_lfsCmdType) {
default:
break;
}
return strCmd;
}

/**
* nodegit::LfsCmd::Args
*
* \return string with arguments for this LFS command.
*/
std::string nodegit::LfsCmd::Args() const {
return m_opts->BuildArgs();
}
1 change: 1 addition & 0 deletions generate/templates/templates/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"src/v8_helpers.cc",
"src/tracker_wrap.cc",
"src/lfs.cc",
"src/lfs_cmd.cc",
{% each %}
{% if type != "enum" %}
"src/{{ name }}.cc",
Expand Down