19 Commits
v2.0.0 ... v2.x

Author SHA1 Message Date
Twarit Waikar
74d50dc1d9 Happy new year! (v2.x) 2023-01-02 13:57:12 +05:30
Twarit Waikar
516a24de6e Merge pull request #121 from ChronicallySerious/min-macos-version 2022-08-09 13:57:59 +05:30
Twarit Waikar
7a8ea16f8e Revert bin extraction CI steps 2022-08-09 12:34:39 +05:30
Twarit Waikar
c38a44d192 Extract OpenSSL libs from CI 2022-08-09 04:22:35 +05:30
Twarit Waikar
dcdd042859 Write final universal binaries to thridparty folder 2022-08-08 21:36:57 +05:30
Twarit Waikar
e1b0f45511 Set min macos version as 10.13 for OpenSSL x64 2022-08-08 20:56:37 +05:30
Twarit Waikar
17e6a3c920 Set min macos version to 10.13 due to futimens() used in libgit2 2022-08-07 18:51:01 +05:30
Twarit Waikar
fc4885e019 Build universal openssl builds in CI 2022-08-07 18:47:48 +05:30
Twarit Waikar
89cbb972a9 CI builds should use 10.12 as min macOS version 2022-08-07 18:21:34 +05:30
Twarit Waikar
49866fc60d Add logo to README.md 2022-08-07 17:27:11 +05:30
Twarit Waikar
92a82dc293 Add logo files (svg,png) 2022-08-07 17:24:10 +05:30
Twarit Waikar
39b5c5f7f9 Add support notice for Godot 3.5.x 2022-07-31 21:33:03 +05:30
Twarit Waikar
6c53f46d8f Merge pull request #107 from ChronicallySerious/remove-get-commit-date 2022-04-09 20:36:23 +05:30
ChronicallySerious
616c26c2c9 Remove get_commit_date() and replace with Godot's new Time singleton 2022-02-24 04:08:54 +05:30
Twarit Waikar
2e3afd8379 Fix minor typo in README.md#bleeding-edge 2022-01-16 01:35:50 +05:30
ChronicallySerious
18e18fe3f8 Add release.sh script for creating new releases 2022-01-16 01:01:55 +05:30
Twarit Waikar
27a10c7029 Remove extraneous files in macOS build artifact 2022-01-16 00:04:38 +05:30
Twarit Waikar
7a08c914fe Merge pull request #101 from ChronicallySerious/fix-unstage-when-no-initial-commit 2022-01-15 18:12:16 +05:30
ChronicallySerious
acc0901a66 Fix error when unstaging file with no HEAD commit #100
This also fixes an issue with diffing staged files when there is
no previous HEAD commit
2022-01-15 17:57:44 +05:30
13 changed files with 6571 additions and 365 deletions

View File

@@ -50,7 +50,7 @@ jobs:
run: |
git submodule update --init --recursive
brew install scons
scons platform=osx target=release bits=64 godot_cpp=yes generate_bindings=yes use_custom_api_file=yes custom_api_file=api.ci.json macos_arch=universal use_llvm=yes -j $(sysctl -n hw.logicalcpu)
scons platform=osx target=release bits=64 godot_cpp=yes generate_bindings=yes use_custom_api_file=yes custom_api_file=api.ci.json macos_arch=universal macos_deployment_target=10.13 use_llvm=yes -j $(sysctl -n hw.logicalcpu)
otool -L demo/addons/godot-git-plugin/osx/libgitapi.dylib
- uses: actions/upload-artifact@v2
with:
@@ -58,5 +58,3 @@ jobs:
if-no-files-found: error
path: |
demo/
libssl.a
libcrypto.a

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2016-2022 The Godot Engine community
Copyright (c) 2016-2023 The Godot Engine community
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,10 +1,12 @@
[![C/C++ CI](https://github.com/godotengine/godot-git-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/godotengine/godot-git-plugin/actions/workflows/build.yml)
# GDNative Based Git Plugin for Godot Version Control Editor Plugin
<img src="/icon.png" width="25%" />
Git implementation of the Godot Engine VCS interface in Godot. We use [libgit2](https://libgit2.org) as our backend to simulate Git in code.
# Godot Git Plugin
> Planned for the upcoming version of Godot. Look for other branches for support in other Godot releases.
Git implementation of the Godot Engine VCS interface using GDNative in Godot. We use [libgit2](https://libgit2.org) as our backend to simulate Git in code.
> Supported in Godot 3.5.x. Look for other branches for support in other Godot releases.
## Installation Instructions
@@ -46,7 +48,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`.
---

View File

@@ -33,6 +33,7 @@ opts.Add(PathVariable("macos_openssl_static_ssl", "Path to OpenSSL libssl.a libr
os.path.join(os.path.abspath(os.getcwd()), "thirdparty/openssl/libssl.a"), PathVariable.PathAccept))
opts.Add(PathVariable("macos_openssl_static_crypto", "Path to OpenSSL libcrypto.a library - only used in macOS builds.",
os.path.join(os.path.abspath(os.getcwd()), "thirdparty/openssl/libcrypto.a"), PathVariable.PathAccept))
opts.Add("macos_deployment_target", "macOS deployment target", "default")
# Updates the environment with the option variables.
opts.Update(env)
@@ -49,6 +50,12 @@ if env["platform"] == "osx":
env.Append(LINKFLAGS=["-arch", env["macos_arch"]])
env.Append(CCFLAGS=["-arch", env["macos_arch"]])
if env["macos_deployment_target"] != "default":
env.Append(CCFLAGS=["-mmacosx-version-min=" +
env["macos_deployment_target"]])
env.Append(LINKFLAGS=["-mmacosx-version-min=" +
env["macos_deployment_target"]])
Export("env")
SConscript("thirdparty/SCsub")

File diff suppressed because it is too large Load Diff

View File

@@ -12,9 +12,9 @@ cd openssl_arm64
make
cd ../
cd openssl_x86_64
./Configure darwin64-x86_64-cc
./Configure darwin64-x86_64-cc -mmacosx-version-min=10.13
make
cd ../
lipo -create openssl_arm64/libcrypto.a openssl_x86_64/libcrypto.a -output libcrypto.a
lipo -create openssl_arm64/libssl.a openssl_x86_64/libssl.a -output libssl.a
lipo -create openssl_arm64/libcrypto.a openssl_x86_64/libcrypto.a -output thirdparty/openssl/libcrypto.a
lipo -create openssl_arm64/libssl.a openssl_x86_64/libssl.a -output thirdparty/openssl/libssl.a
rm openssl-$OPENSSL_VERSION.tar.gz

View File

@@ -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;

View File

@@ -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();
};

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

144
icon.svg Normal file
View File

@@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
height="1024"
width="1024"
version="1.1"
id="svg47"
sodipodi:docname="icon_color.svg"
inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)"
inkscape:export-filename="icon_color.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs51">
<mask
maskUnits="userSpaceOnUse"
id="mask11953">
<rect
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.754231;stroke-opacity:1"
id="rect11955"
width="43.98111"
height="4.7610822"
x="490.15945"
y="230.63536" />
</mask>
</defs>
<sodipodi:namedview
id="namedview49"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="true"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
shape-rendering="auto"
inkscape:zoom="1"
inkscape:cx="304"
inkscape:cy="521"
inkscape:window-width="2560"
inkscape:window-height="1387"
inkscape:window-x="1912"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg47">
<inkscape:grid
type="xygrid"
id="grid2088" />
</sodipodi:namedview>
<path
d="m0 0s-.325 1.994-.515 1.976l-36.182-3.491c-2.879-.278-5.115-2.574-5.317-5.459l-.994-14.247-27.992-1.997-1.904 12.912c-.424 2.872-2.932 5.037-5.835 5.037h-38.188c-2.902 0-5.41-2.165-5.834-5.037l-1.905-12.912-27.992 1.997-.994 14.247c-.202 2.886-2.438 5.182-5.317 5.46l-36.2 3.49c-.187.018-.324-1.978-.511-1.978l-.049-7.83 30.658-4.944 1.004-14.374c.203-2.91 2.551-5.263 5.463-5.472l38.551-2.75c.146-.01.29-.016.434-.016 2.897 0 5.401 2.166 5.825 5.038l1.959 13.286h28.005l1.959-13.286c.423-2.871 2.93-5.037 5.831-5.037.142 0 .284.005.423.015l38.556 2.75c2.911.209 5.26 2.562 5.463 5.472l1.003 14.374 30.645 4.966z"
fill="#fff"
transform="matrix(4.162611 0 0 -4.162611 919.24059 673.152141)"
id="path31" />
<path
d="m0 0v-47.514-6.035-5.492c.108-.001.216-.005.323-.015l36.196-3.49c1.896-.183 3.382-1.709 3.514-3.609l1.116-15.978 31.574-2.253 2.175 14.747c.282 1.912 1.922 3.329 3.856 3.329h38.188c1.933 0 3.573-1.417 3.855-3.329l2.175-14.747 31.575 2.253 1.115 15.978c.133 1.9 1.618 3.425 3.514 3.609l36.182 3.49c.107.01.214.014.322.015v4.711l.015.005v54.325c5.09692 6.4164715 9.92323 13.494208 13.621 19.449-5.651 9.62-12.575 18.217-19.976 26.182-6.864-3.455-13.531-7.369-19.828-11.534-3.151 3.132-6.7 5.694-10.186 8.372-3.425 2.751-7.285 4.768-10.946 7.118 1.09 8.117 1.629 16.108 1.846 24.448-9.446 4.754-19.519 7.906-29.708 10.17-4.068-6.837-7.788-14.241-11.028-21.479-3.842.642-7.702.88-11.567.926v.006c-.027 0-.052-.006-.075-.006-.024 0-.049.006-.073.006v-.006c-3.872-.046-7.729-.284-11.572-.926-3.238 7.238-6.956 14.642-11.03 21.479-10.184-2.264-20.258-5.416-29.703-10.17.216-8.34.755-16.331 1.848-24.448-3.668-2.35-7.523-4.367-10.949-7.118-3.481-2.678-7.036-5.24-10.188-8.372-6.297 4.165-12.962 8.079-19.828 11.534-7.401-7.965-14.321-16.562-19.974-26.182 4.4426579-6.973692 9.2079702-13.9828876 13.621-19.449z"
fill="#478cbf"
transform="matrix(4.162611 0 0 -4.162611 104.69892 427.387251)"
id="path33"
style="fill:#ef5132;fill-opacity:1" />
<path
d="m0 0-1.121-16.063c-.135-1.936-1.675-3.477-3.611-3.616l-38.555-2.751c-.094-.007-.188-.01-.281-.01-1.916 0-3.569 1.406-3.852 3.33l-2.211 14.994h-31.459l-2.211-14.994c-.297-2.018-2.101-3.469-4.133-3.32l-38.555 2.751c-1.936.139-3.476 1.68-3.611 3.616l-1.121 16.063-32.547 3.138c.015-3.498.06-7.33.06-8.093 0-34.374 43.605-50.896 97.781-51.086h.066.067c54.176.19 97.766 16.712 97.766 51.086 0 .777.047 4.593.063 8.093z"
fill="#478cbf"
transform="matrix(4.162611 0 0 -4.162611 784.07144 718.723121)"
id="path35"
style="fill:#ef5132;fill-opacity:1" />
<path
d="m0 0c0-12.052-9.765-21.815-21.813-21.815-12.042 0-21.81 9.763-21.81 21.815 0 12.044 9.768 21.802 21.81 21.802 12.048 0 21.813-9.758 21.813-21.802"
fill="#fff"
transform="matrix(4.162611 0 0 -4.162611 389.21484 527.151321)"
id="path37" />
<path
d="m0 0c0-7.994-6.479-14.473-14.479-14.473-7.996 0-14.479 6.479-14.479 14.473s6.483 14.479 14.479 14.479c8 0 14.479-6.485 14.479-14.479"
fill="#414042"
transform="matrix(4.162611 0 0 -4.162611 367.36686 532.537071)"
id="path39" />
<path
d="m0 0c-3.878 0-7.021 2.858-7.021 6.381v20.081c0 3.52 3.143 6.381 7.021 6.381s7.028-2.861 7.028-6.381v-20.081c0-3.523-3.15-6.381-7.028-6.381"
fill="#fff"
transform="matrix(4.162611 0 0 -4.162611 511.99336 626.219821)"
id="path41" />
<path
d="m0 0c0-12.052 9.765-21.815 21.815-21.815 12.041 0 21.808 9.763 21.808 21.815 0 12.044-9.767 21.802-21.808 21.802-12.05 0-21.815-9.758-21.815-21.802"
fill="#fff"
transform="matrix(4.162611 0 0 -4.162611 634.78706 527.151321)"
id="path43" />
<path
d="m0 0c0-7.994 6.477-14.473 14.471-14.473 8.002 0 14.479 6.479 14.479 14.473s-6.477 14.479-14.479 14.479c-7.994 0-14.471-6.485-14.471-14.479"
fill="#414042"
transform="matrix(4.162611 0 0 -4.162611 656.64056 532.537071)"
id="path45" />
<path
style="fill:#ef5132;fill-opacity:1"
d="m 104.57536,667.20303 -0.15289,43.87884 145.09067,135.30584 582.80887,-29.96604 87.13745,-108.31356 -0.43243,-43.78378 -494.37838,-12.64865 z"
id="path265" />
<path
style="fill:#ef5132;fill-opacity:1"
d="m 181.01934,403.62419 666.59147,9.78483 -13.45414,250.73625 -659.25285,-11.00794 z"
id="path1205" />
<g
id="g6283"
transform="matrix(1.325853,0,0,1.325853,-167.12939,-143.97607)"
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1">
<ellipse
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"
id="path2034"
cx="511.42264"
cy="380.99677"
rx="54.428112"
ry="56.874317" />
<ellipse
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"
id="path2034-8"
cx="512.48041"
cy="716.73877"
rx="54.428112"
ry="56.874317" />
<ellipse
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"
id="path2034-8-0"
cx="653.41595"
cy="520.51215"
rx="54.428112"
ry="56.874317" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-opacity:1"
d="m 490.15878,667.66169 h 44.03173 V 432.76846 l 72.41241,72.41241 31.15384,-31.15384 -84.5946,-84.5946 h -63 z"
id="path5896" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:3.20357;stroke-opacity:1"
d="m 490.16216,232.8165 h 44 V 336 h -44 z"
id="path6276" />
<path
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.754231;stroke-opacity:1"
d="m 475.66408,234.00582 h 73.09797 c 0,0 -32.71498,-6.71602 -73.09797,0 z"
id="path11529"
sodipodi:nodetypes="ccc"
mask="url(#mask11953)" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.1 KiB

54
release.sh Executable file
View 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

Binary file not shown.

Binary file not shown.