mirror of
https://github.com/godotengine/godot-git-plugin.git
synced 2026-01-01 01:48:28 +03:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c53f46d8f | ||
|
|
616c26c2c9 | ||
|
|
2e3afd8379 | ||
|
|
18e18fe3f8 | ||
|
|
27a10c7029 | ||
|
|
7a08c914fe | ||
|
|
acc0901a66 |
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@@ -58,5 +58,3 @@ jobs:
|
||||
if-no-files-found: error
|
||||
path: |
|
||||
demo/
|
||||
libssl.a
|
||||
libcrypto.a
|
||||
|
||||
@@ -46,7 +46,7 @@ To build using custom GDNative API definition JSON files, run the below helper c
|
||||
scons platform=<platform> target=debug godot_cpp=yes generate_bindings=yes bits=64 use_custom_api_file=yes custom_api_file=path/to/api.json -j 6
|
||||
```
|
||||
|
||||
Once this command can completed successfully, the standard build commands in the above section can be run without recompiling godot-cpp. To stop godot-cpp from recompiling, do not use the `godot_cpp` option in SCons arguments. To view more options available while recompiling godot-cpp, run `scons platform=<platform> godot_cpp=yes -h`.
|
||||
Once this command is completed successfully, the standard build commands in the above section can be run without recompiling godot-cpp. Once compiled, to stop godot-cpp from recompiling, do not use the `godot_cpp` option in SCons arguments. To view more options available while recompiling godot-cpp, run `scons platform=<platform> godot_cpp=yes -h`.
|
||||
|
||||
---
|
||||
|
||||
|
||||
6652
api.ci.json
6652
api.ci.json
File diff suppressed because it is too large
Load Diff
@@ -169,11 +169,22 @@ void GitAPI::_unstage_file(const String file_path) {
|
||||
git_strarray array = { paths, 1 };
|
||||
|
||||
git_reference_ptr head;
|
||||
GIT2_CALL(git_repository_head(Capture(head), repo.get()), "Could not get repository HEAD");
|
||||
GIT2_CALL_IGNORE(git_repository_head(Capture(head), repo.get()), "Could not find repository HEAD", { GIT_ENOTFOUND COMMA GIT_EUNBORNBRANCH });
|
||||
|
||||
git_object_ptr head_commit;
|
||||
GIT2_CALL(git_reference_peel(Capture(head_commit), head.get(), GIT_OBJ_COMMIT), "Could not peel HEAD reference");
|
||||
GIT2_CALL(git_reset_default(repo.get(), head_commit.get(), &array), "Could not reset " + file_path + " to state at HEAD");
|
||||
if (head) {
|
||||
git_object_ptr head_commit;
|
||||
GIT2_CALL(git_reference_peel(Capture(head_commit), head.get(), GIT_OBJ_COMMIT), "Could not peel HEAD reference");
|
||||
GIT2_CALL(git_reset_default(repo.get(), head_commit.get(), &array), "Could not reset " + file_path + " to state at HEAD");
|
||||
} else {
|
||||
// If there is no HEAD commit, we should just remove the file from the index.
|
||||
|
||||
CString c_path(file_path);
|
||||
|
||||
git_index_ptr index;
|
||||
GIT2_CALL(git_repository_index(Capture(index), repo.get()), "Could not get repository index");
|
||||
GIT2_CALL(git_index_remove_bypath(index.get(), c_path.data), "Could not add " + file_path + " to index");
|
||||
GIT2_CALL(git_index_write(index.get()), "Could not write changes to disk");
|
||||
}
|
||||
}
|
||||
|
||||
void GitAPI::create_gitignore_and_gitattributes() {
|
||||
@@ -222,31 +233,6 @@ void GitAPI::create_gitignore_and_gitattributes() {
|
||||
file->free();
|
||||
}
|
||||
|
||||
String GitAPI::get_commit_date(const git_time *intime) {
|
||||
char sign, out[32];
|
||||
struct tm *intm;
|
||||
int offset, hours, minutes;
|
||||
time_t t;
|
||||
|
||||
offset = intime->offset;
|
||||
if (offset < 0) {
|
||||
sign = '-';
|
||||
offset = -offset;
|
||||
} else {
|
||||
sign = '+';
|
||||
}
|
||||
|
||||
hours = offset / 60;
|
||||
minutes = offset % 60;
|
||||
|
||||
t = (time_t)intime->time + (intime->offset * 60);
|
||||
|
||||
intm = gmtime(&t);
|
||||
strftime(out, sizeof(out), "%a %b %e %T %Y", intm);
|
||||
|
||||
return String(out) + " " + sign + (hours < 10 ? "0" : "") + String::num(hours) + ":" + (minutes < 10 ? "0" : "") + String::num(minutes);
|
||||
}
|
||||
|
||||
Array GitAPI::_get_modified_files_data() {
|
||||
Array stats_files;
|
||||
|
||||
@@ -431,7 +417,7 @@ Array GitAPI::_get_previous_commits(const int64_t max_commits) {
|
||||
const git_signature *sig = git_commit_author(commit.get());
|
||||
String author = String() + sig->name + " <" + sig->email + ">";
|
||||
|
||||
commits.push_back(create_commit(msg, author, commit_id, get_commit_date(&sig->when)));
|
||||
commits.push_back(create_commit(msg, author, commit_id, sig->when.time, sig->when.offset));
|
||||
}
|
||||
|
||||
return commits;
|
||||
@@ -623,10 +609,14 @@ Array GitAPI::_get_diff(const String identifier, const int64_t area) {
|
||||
} break;
|
||||
case TREE_AREA_STAGED: {
|
||||
git_object_ptr obj;
|
||||
GIT2_CALL_R(git_revparse_single(Capture(obj), repo.get(), "HEAD^{tree}"), "Could not get HEAD^{tree} object", diff_contents);
|
||||
|
||||
// Ignore the case when HEAD is not found. We need to compare with a null tree in the case where the HEAD reference object is empty.
|
||||
GIT2_CALL_R_IGNORE(git_revparse_single(Capture(obj), repo.get(), "HEAD^{tree}"), "Could not get HEAD^{tree} object", diff_contents, { GIT_ENOTFOUND });
|
||||
|
||||
git_tree_ptr tree;
|
||||
GIT2_CALL_R(git_tree_lookup(Capture(tree), repo.get(), git_object_id(obj.get())), "Could not lookup HEAD^{tree}", diff_contents);
|
||||
if (obj) {
|
||||
GIT2_CALL_R_IGNORE(git_tree_lookup(Capture(tree), repo.get(), git_object_id(obj.get())), "Could not lookup HEAD^{tree}", diff_contents, { GIT_ENOTFOUND });
|
||||
}
|
||||
|
||||
GIT2_CALL_R(git_diff_tree_to_index(Capture(diff), repo.get(), tree.get(), nullptr, &opts), "Could not create diff for tree from index directory", diff_contents);
|
||||
} break;
|
||||
@@ -640,6 +630,8 @@ Array GitAPI::_get_diff(const String identifier, const int64_t area) {
|
||||
GIT2_CALL_R(git_commit_lookup(Capture(commit), repo.get(), git_object_id(obj.get())), "Could not get commit " + identifier, diff_contents);
|
||||
|
||||
git_commit_ptr parent;
|
||||
|
||||
// We ignore the case when the parent is not found to handle the case when this commit is the root commit. We only need to diff against a null tree in that case.
|
||||
GIT2_CALL_R_IGNORE(git_commit_parent(Capture(parent), commit.get(), 0), "Could not get parent commit of " + identifier, diff_contents, { GIT_ENOTFOUND });
|
||||
|
||||
git_tree_ptr commit_tree;
|
||||
|
||||
@@ -143,7 +143,6 @@ public:
|
||||
bool check_errors(int error, String function, String file, int line, String message, const std::vector<git_error_code> &ignores = {});
|
||||
void create_gitignore_and_gitattributes();
|
||||
bool create_initial_commit();
|
||||
String get_commit_date(const git_time *intime);
|
||||
|
||||
void _init();
|
||||
};
|
||||
|
||||
54
release.sh
Executable file
54
release.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script is used to create releases for this plugin. This is mostly a helper script for the maintainer.
|
||||
|
||||
echo "Enter the new version number (e.g. 1.2.1):"
|
||||
read version
|
||||
|
||||
echo "Enter the Windows x64 release ZIP URL:"
|
||||
read windowsZIPURL
|
||||
|
||||
echo "Enter the Linux x64 release ZIP URL:"
|
||||
read linuxZIPURL
|
||||
|
||||
echo "Enter the MacOS universal release ZIP URL:"
|
||||
read macZIPURL
|
||||
|
||||
# wget-ing the github.com URL gives a 404, so we use the method proposed here - https://github.com/actions/upload-artifact/issues/51#issuecomment-735989475
|
||||
windowsZIPURL=${windowsZIPURL/github.com/nightly.link}
|
||||
linuxZIPURL=${linuxZIPURL/github.com/nightly.link}
|
||||
macZIPURL=${macZIPURL/github.com/nightly.link}
|
||||
|
||||
wget -O windows.zip $windowsZIPURL
|
||||
wget -O linux.zip $linuxZIPURL
|
||||
wget -O mac.zip $macZIPURL
|
||||
|
||||
unzip windows.zip -d windows/
|
||||
unzip linux.zip -d linux/
|
||||
unzip mac.zip -d mac/
|
||||
|
||||
releasePath=godot-git-plugin-v$version
|
||||
mkdir $releasePath
|
||||
|
||||
cp -r windows/addons/ $releasePath
|
||||
addonsPath=$releasePath/addons
|
||||
pluginPath=$addonsPath/godot-git-plugin
|
||||
|
||||
mkdir $pluginPath/linux
|
||||
mkdir $pluginPath/osx
|
||||
cp -r linux/addons/godot-git-plugin/linux/ $pluginPath/
|
||||
cp -r mac/addons/godot-git-plugin/osx/ $pluginPath/
|
||||
|
||||
sed -i "s/version=\"[^\"]*\"/version=\"v${version}\"/g" $pluginPath/plugin.cfg
|
||||
cp LICENSE $pluginPath/LICENSE
|
||||
cp THIRDPARTY.md $pluginPath/THIRDPARTY.md
|
||||
|
||||
zip -r $releasePath.zip $addonsPath
|
||||
|
||||
rm -rf $releasePath
|
||||
rm -rf windows
|
||||
rm -rf linux
|
||||
rm -rf mac
|
||||
rm windows.zip
|
||||
rm linux.zip
|
||||
rm mac.zip
|
||||
Reference in New Issue
Block a user