564 Commits

Author SHA1 Message Date
77d295077f CI: Download the NDK libs
Now I can finally push all these changes, as the CI should also run and
we're ready to try out the new version of the app which uses libgit2
instead of jgit. Hopefully no user will notice anything different.
2019-05-17 17:17:33 +02:00
a11254eab4 ios: Just flutter run
It just seems to make a lot of changes. No idea about half of these. The
ios world is strange and foreign. I have hooked it up to Firebase
Analytics, though.

Also build on all architectures instead of just 64-bit.
2019-05-17 16:24:37 +02:00
7af708116b cLib gitPull: Improve conflict handling
Before it was broken, and we weren't really doing anything. Now, we
commit both versions of the file, so it results in the journal having an
ugly <<<< HEAD === thingy. But this is a start!

We can improve this by choosing which one of the changes to keep.
2019-05-17 11:43:14 +02:00
90c18881a9 cLib: git pull: Perform a fast-forward if possible
This way we don't always get the extra merge commit, if it is not
required.
2019-05-17 11:25:00 +02:00
62c99db1be Remove libssh
libssh is LGPL licensed, which means I would need to re-license the
entire app since we are linking against it statically. I could
dynamically link against it, but since I was only trying to use it for
key-generation and that doesn' seem to be working, I may as well discard
it.

For now, I'm going to stick with jsch for the key generation. On ios
side, I'm not sure what I will do. One option could be to compile
openssh and call the ssh-keygen binary.
2019-05-16 17:29:56 +02:00
17e1880c37 cLib: Move keygeneration code over there
This way we can easily test it outside of Android. Strangely enough this
doesn't work on Android or osx for me. It only seems to work in an
ubuntu linux container.
2019-05-16 15:46:40 +02:00
2fa6f9338b Android: Remove the jgit dependency
Finally! We now only rely on libgit2. Unfortunately, we still rely on a
java library for the public key generation.
2019-05-16 12:27:15 +02:00
64c8ddd7b0 Android: Use the c library for git pull
It's not perfect as our implementation of git pull results in an extra
merge commit and doesn't handle conflicts properly, but it is a basic
implementation, so at least we have something.
2019-05-16 12:23:27 +02:00
8b1cafef2f cLib: gitPull: Use the correct annoated_commit
The annotated commit must be created from the remote's branch's ref.
This entire thing is quite confusing, but for now at least git pull's
work properly, though with an extra merge commit.
2019-05-16 12:15:01 +02:00
18a44d257b cLib gitPull: Check if the repo is in a valid state 2019-05-16 11:51:47 +02:00
5a0a26fe37 cLib gitPull: The other parent can be the annotated commit
What is an annotated commit? This library doesn't make much sense to me.
The merge.c example for libgit2 also doesn't make that much sense.
2019-05-16 11:36:48 +02:00
0f63553363 cLib: First kinda working impelmentation of git pull
In order to do a commit, we need the parents for that commit. In the
case of a merge commit - it should be the 'master' and 'origin/master'
(in the case of the master branch). I cannot seem to get the id of the
'origin/master' commit. So, for now it is hardcoded.

But hey, at least this works.
2019-05-16 11:30:18 +02:00
bd67bf65b6 cLib: Use a proper Makefile
Instead of a custom make shell script.
There is no big advantage right now.
2019-05-16 11:05:38 +02:00
f5b98ab9c6 Make the android app use our c-lib for all git operations
* Apart from gitPull which is currently broken
* And the ssh key generation which fails on Android
2019-05-15 19:12:55 +02:00
8748132e70 gj_common: Add const correctness 2019-05-15 18:43:19 +02:00
69b0b2fa19 Update gitignore 2019-05-15 18:29:31 +02:00
7bd9e4fa98 Android JNI GitAdd: Use the c-lib's gitAdd instead
It finally works!
2019-05-15 18:28:02 +02:00
0c6e13c335 cLib: Make the log function easier
Using variable list arguments in c is a pain.
2019-05-15 18:27:04 +02:00
e1e388c161 gj_common: Add missing test file
This was what I was using to try out this library locally. I probably
should have made a proper unit test suite, but this was just so much
faster and easier.
2019-05-15 18:07:28 +02:00
fee7bb80ee Rename git_test to gj_common 2019-05-15 18:07:13 +02:00
76fa521f36 cLib: Allow logging to outsources
This way in Android we can use the proper logging functions to get the
output in logcat. Printf doesn't make sense in that context.
2019-05-15 18:04:52 +02:00
d86a03e974 c lib: Avoid the infinite loop of trying invalid credentials
LibGit2 has been designed in a strange way. It doesn't give us an easy
way of knowing if and why the credentials has failed, it jusst keep
calling the credentials failed method.

We are now working around this.
2019-05-15 17:59:29 +02:00
e8109a20e8 c lib: Allow the ssh keys to be configured 2019-05-15 17:36:07 +02:00
b00a0ca04a GitTest: Create a proper header and implementation file
All these functions are going to be used by both the Android and the iOS
implementation.
2019-05-15 17:28:50 +02:00
4e28a2c63a GitTest: Implement git reset --hard 2019-05-15 17:07:24 +02:00
b3bd01b9bb GitTest: Implement git rm 2019-05-15 16:58:19 +02:00
c230aebcbc GitTest: Refactor git add
This way we avoid any memory leaks and the code is much easier to read.
2019-05-15 16:34:47 +02:00
4750488e0d GitTest: Try to implement a git pull
So far it just does a `git fetch`. I cannot seem to figure out how to
handle merge conflicts or to actually move the HEAD to origin/HEAD.
2019-05-15 16:21:46 +02:00
59005e8d49 GitTest: Implement git push 2019-05-15 13:27:17 +02:00
aa45ab07a8 GitTest: Commit: Do not allow empty commits 2019-05-15 13:07:10 +02:00
6cca6a5c4a GitTest: Simplify git commit code 2019-05-15 12:57:05 +02:00
36c265a72d GitTest: Get cloning over ssh to work
Libgit2 is quite horrible. When passing it credentials, if the
credentials are invalid, it will just ask for the credentials again and
again and again, without giving any feedback that the credentials have
failed. This just sucks.
2019-05-15 12:43:24 +02:00
128e14d3df GitIgnore: Add the android libs 2019-05-15 12:42:50 +02:00
69709a017f GitTest: Try cloning over ssh
This still doesn't seem to work for me, but I think my local libgit2
might not be compiled with ssh support. Hurray for silent failures.
2019-05-15 12:42:46 +02:00
8c4b2e67aa GitTest: Add clone support
For now it only supports http urls :(
2019-05-14 17:58:36 +02:00
957578e81a GitTest: Allow a commit to not have any parents
This is the case when it is the first commit
2019-05-14 17:38:15 +02:00
43258f81d3 GitTest: Add a git commit implementation
Wow, the error handling in c is getting quite cumbersome
2019-05-14 17:33:36 +02:00
295734f4a0 GitTest: Add git init 2019-05-14 17:00:58 +02:00
59ed5e35ec GitTest: Refactor the code 2019-05-14 16:51:56 +02:00
00b66149a1 GitTest: Try running 'git add' without android
It seems to work
2019-05-14 16:47:49 +02:00
1dbe829372 GitAdd: Use libgit2 instead of jgit
This doesn't seem to work properly, though. Not sure what I'm doing
wrong.
2019-05-14 16:38:18 +02:00
1e8f098e10 CMakeLists: Cleanup unused macro 2019-05-14 14:29:53 +02:00
5dddeed54d Add a generateKeys JNI function
It goes via Dart -> Java -> JNI -> OurLib -> LibSSH. Also, it still
doesn't seem to work, and I'm not sure why. I kinda giveup for now.
2019-05-14 14:28:43 +02:00
668eae3562 Android: Move native code to its own class 2019-05-14 13:13:44 +02:00
cd68df9303 First integration of libgit2 in the Android App
This will allow us to remove the jgit dependency. JGit is annoying
because we have to use an old version in order to support older API
versions. Additionally, there are some subtle differences in their
implementation.

Finally, for iOS and desktop we will be using libgit2, so we may as well
use the same stack on Android.
2019-05-14 13:09:25 +02:00
ad2e4ac9b1 Rename markdownToPlainText -> stripMarkdownFormatting
It better reflects what the function actually does
2019-05-13 22:57:49 +02:00
4f939c662e MarkdownToText: Add another test
Just for my own curiosity
2019-05-13 22:55:26 +02:00
cabd51456a Bump version 2019-05-13 22:37:19 +02:00
f2af5c9c75 Improve markdown to text conversion
Use a proper markdown parser to convert the text. This way more of the
formatting is correctly removed.
2019-05-13 22:36:32 +02:00
06ade7b92e Bump version 2019-05-13 22:01:08 +02:00