Is it possible to push a commit and not a reference in libgit2? - libgit2

Is it possible to push a commit and not a reference in libgit2 i.e. basically do the equivalent of git push {remote} {commit}:{branch}?
When I try to call git_remote_upload() with a refspec like e9c46cd9071113c95f6b3fb48b74f98056abf7a1:refs/heads/master, it fails with this error:
No such reference 'e9c46cd9071113c95f6b3fb48b74f98056abf7a1'
Am I doing something wrong or is this feature simply not supported?

Nobody who uses push has added the feature yet. The push functions expect the refspecs to use references for both sides.

Related

How Can i add a cloned object to the repository

New object is not cloned
$clonedObj = clone $repatNewsObj;
$this->extendednewsRepository->add($clonedObj);
$this->persistenceManager->persistAll();
This is not how you copy an extbase object with TYPO3. Sadly, just cloning it with PHP will not reset the object from the extbase point of view. The add method of the default repository will just ignore the "new" object if it already has a uid in the database. Hence, nothing is actually done by your persist call.
You could either create a new object yourself, setting each property manually, based on the source object or you can use the datahandler to copy your object. There is a blog post describing it (in German) as well as an older SO question discussing the same issue.
If you want to clone an object from one of your own extensions, best practice is to overwrite the __clone method and reset things like uid and so on there. If the model class comes from a third party extension, chose one of the two methods from above.

How to delete Operation(s) with Java SDK

It seems that in the Java SDK it is not implemented to delete Operations. The REST API supports it. So I'm wondering if I miss something or if this is the case.
Are there any workaround except using a REST Client to delete Operation(s) in a Java Application?
No, currently not (but feel free to send a pull request with an added method).
As background, operations should usually not be deleted by clients, but instead cycled through their process (pending -> executing -> successful/failed). If you delete an operation, it will be not available anymore and you cannot reproduce what happened on a device at a particular point in time. Deletion is usually taken care of by data retention management.
The easiest way to use an API that is not implemented in the client is calling the rest() method on your platform object.
This will return you the underlaying RestConnector for all API (fully initialised with credentials) and you can execute the calls with it (kind of manually).

How do I make the remote call actually remote?

How do I make an actual remote call?
I've followed the guide: https://codelabs.developers.google.com/codelabs/webrtc-web/#4
And gotten their example fully integrated in my application (Angular, TypeScript, multi webcam &etc).
How do I make the remote call actually remote? - I get the idea of a signalling server, but maybe someone can show with basic strings?
I found this, but it's not been updated in a while so I'm not sure what's still valid:
Found some nice sequence diagrams https://webrtc.org/native-code/native-apis/
Setup call
(source: webrtc.org)
Receive a Call
(source: webrtc.org)
Close Down a Call
(source: webrtc.org)

Error building Shoutem preview build after modifying extension

I've working on modification of the 'shoutem.notification-center' extension using as a guide this tutorial and I'm having some issues.
At first I tried to use the Extend the extension approach, but like I've posted on this issue, didn't quite work.
So I've tried the Directly modify approach, which works fine on my local phone, but once I use the command shoutem push to send my modifications to the server, the instance on Appetize never stops the 'Building your application' message.
The major problem is that there's no error code or feedback.
That was not the first time that happened, I had the same issue modifying other extensions. Any idea why this is happening?
The issue is likely one of two things.
New native dependencies were added that the Builder preview cannot process due to it's predefined binary.
Your directly modified extension works locally, but not on the Builder because locally it's path is still AppName/extensions/shoutem.extName, but on the Builder it's AppName/extensions/yourDevName.extName, so it fails.
The first one can be resolved by either using a non-native solution as a replacement for the native dependency you were using, or to simply use a local emulator for previewing purposes.
The second can be resolved by making sure all extensions that reference the one you directly modified are edited to now reference your new directly modified extension instead of shoutem.extName.
If you could shoot me your app ID in a comment I can let you know which one it is and what the best steps to fix it would be.

RESTful URL for "Activate"

I have a resource (project) which can be activated and deactivated.
What's the most RESTful URL endpoint for this purpose?
Right now I'm thinking about /projects/:id/activate and /projects/:id/deactivate, but I don't think that's very RESTful.
In addition, I'm not certain what HTTP method to use.
Can you provide some pointers?
Thanks!
The most conventional way to do this is via POST to /projects/:id, with parameters indicating whether you want to activate or deactivate or something else (always leave room for something else).
note that RESTful URLs should refer to things (like projects), not actions. Then the common methods have clear meanings:
PUT: create or replace the thing
PATCH: set properties of the thing
POST: perform an operation on the
thing
GET: retrieve the thing
DELETE: delete the thing
Your can send your requests just to projects/{id} and use PATCH (as you're updating existing object) verb, e.g.
PATCH /projects/123
[
{ "op": "activate|deactivate", ... }
]
Read more: REST API - PUT vs PATCH with real life examples
I know I am a bit late but maybe this might be useful for others.
You can create a noun from your operation and use it as sub-resource: activate -> activation
Now you can use POST and DELETE on this sub-resource.
For example:
POST /projects/:id/activation <-- activate project
DELETE /projects/:id/activation <-- deleting the activation = deactivate
This pattern can work quite well for operations that toggle between on/off state of something.