How to create patch for Kohana? - kohana

I've found a bug at Kohana couple hours ago and fixed it. After that I found a ticket at Redmine describing same issue. Now I want to create patch for the bug but I dont know how to do this. Could anyone give an advice?

git diff > diff.patch
A better way would be to fork the repository on github, commit your change, then send a pull request.

Related

GitLab: Option to create branch from the issue is missing

I am trying to create a branch linked from an issue on GitLab. The option to create a branch from the issue however is missing on this particular project. I have an access level of Maintainer on this project.
The current project I'm working on:
I have checked the other project I made a few months back on which I have exactly the same access level, the option that I'm looking for is there.
My previous project (This is a different project btw, not the source of the fork)
The difference being is that the current project I am working on is a forked version of the old repo so I could keep historical branches from the previous version of the project. I also imported the issues from the previous repo to the new one. I tried to create a new test issue but I still can't see the menu.
It seems like I configured something wrong, could you please help me identify why I cannot access this menu? Any help would be appreciated.
Thanks!
After some digging, I found that this may be a current known issue on GitLab. It only happens on forked projects similar to #VonC's answer. However it doesn't show how to resolve the issue.
To resolve the issue you have to remove the project's fork relationship found on the Settings > General > Advance. If you forked the repo from another project, you should see the Remove fork relationship button there. This essentially removes the fork relationship of the project from the original repository. Once done, the Create merge request should pop-up immediately upon refreshing the page. Do note you need an Owner access to see the Remove fork relationship option.
For more details, please refer to this issue and this solution was from here.
Check first if this is similar to issue 39778 which refers to issue
I disable the button for projects which are forked.
The context in when it references (from a fork) issue from the original project.
No "Create merge request" in that case.

Adding Git Commit Message to Commit Reference Link in GitLab Issue Note

We recently migrated from using Subversion and Trac to Git and GitLab. We successfully migrated all of our old data.
I'm still trying to learn GitLab and generally like it better than Trac, but one thing I don't like as much is that when you reference a GitLab Issue in the git commit, it adds a reference and link to that commit under the issue, but you have to browse to the commit itself to see the associated Git commit message.
In Trac, we had it configured such that the Subversion commit messages were all displayed in the Trac ticket with the commit link, so it was easier to view all the relevant information for that ticket in one place.
Is there a way to configure GitLab to display the Git commit message with the Git commit link that shows up under Issues? The message does show up in the commit list, but not on a referenced Issue.
I thought about trying to use a server hook to generate a note with the Git commit message when a commit is made, but just wondering if there is an easier/better way to accomplish this?
There is no built-in way to show the commit message of a crosslinked commit in the issue log. After all, commits are handled the same way as any other mentions: in the issue's history/mention log.
While the example in GitLab's documentation unfortunately misses the opportunity to show an example of a mention in the commit, here's an issue from GitLab itself with a mention. This commit also shows how mentions often get used within commits—with keywords:
Merge branch '65375-broken-master-gitlab-svg-path-test-failing' into 'master'
Update failing jest snapshot
Closes #13186
See merge request gitlab-org/gitlab-ee!14933
These kind of commits close the specific issue and don't require any further user action. Adding that kind of noise to the discussion/comment section of an issue is, in my opinion, only cluttering the discussion between actual humans*. However, the commit still shows up in the log and is clickable and hoverable.
To get back to your question:
Is there a way to configure GitLab to display the Git commit message with the Git commit link that shows up under Issues?
If you hover over the linked commit, then you'll get the commit's subject. There's nothing more that can be achieved within GitLab itself.
I thought about trying to use a server hook to generate a note with the Git commit message when a commit is made, but just wondering if there is an easier/better way to accomplish this?
If you follow the usual commit/merge message based issue closing and use [Closes?|Fix(es)?] #issue in your commit message, you may end up with more noise in the comments than you would like too.
* well, except for some bots

Commit message with Redmine Ticket

I would like to integrate Redmine with SVN in a manner that the commit message automatically gets posted in the Redmine Ticket ID. Kindly let me know if there are any plugins or hooks up which can be used for me to achieve the same
Such functionality is built in.
Go to Admin | Settings click on Repositories tab, and there you will see following section:
Referencing and fixing issues in commit messages
Referencing keywords
By default, there are:
refs,references,IssueID
So when you perform svn commit, and say
refs #23
such change will be displayed on issue no=23, once you refresh repositories and visit issue again.
There is also way to automate it, so svn or git, post-commit hook refreshes repositores for you...
Full doc here: http://www.redmine.org/projects/redmine/wiki/HowTo_setup_automatic_refresh_of_repositories_in_Redmine_on_commit
Such way if you track changes, you can see all code that was changed, regarding some issue...
For example:
And you can click on (diff) to see that particular code...
Then, furthermore, you can copy URL's when you click diff, so you can discuss code with your peers...
Cheers :)

How do you push code with gitg?

I can do everything else I need but with the GUI I cannot seem to figure out how to pull or push code. Pushing is more important in this case, anyone know how?
Anyone looking for this feature in gitg 3.14: I got confirmation from a developer that it hasn't been implemented yet.
Figured it out, not too difficult, just have to right click on the branch name when you are looking at your commit history
On the history tab, right click on the name of the tracking branch
Create on .git/hooks a file named post-commit and insert this code
#!/bin/bash
git push -u origin master
and turn this into a executable script
chmod 755 post-commit
Push action is available starting from version 3.32.0
See NEWS file in "Release 3.32.0" gitg commit
According to the official project roadmap, it is a feature in todo state;
the target release is 0.3 so I assume this table it is not updated so this project is poorly maintained: we can imagine real gnome coders do not use GUIs :)
You have to clone a repository previously.
For example:
git clone https://github.com/manuelkiessling/NodeBeginnerBook.git
Once cloned, go into the downloaded repository and execute gitk

JGit : connect to distant repository

I searched through Google, forums and JGit user guide but couldn't find how to connect to a distant repository with the API.
Anyone has an example or just an idea on how to do that?
Thanks for your help.
Currently, JGit 2.0.0-SNAPSHOT does only offer
org.eclipse.jgit.storage.file.FileRepository
org.eclipse.jgit.storage.dfs.InMemoryRepository
concrete Repository classes, meaning that since org.eclipse.jgit.api.Git takes a Repository, it is not possible to work remotely. Since Git by itself is not designed to operate remotely in the way I think you mean, I doubt we will see such a feature any time soon.
MORE ON THAT:
Consequently, you will need to clone locally. You do that by issuing
Git.cloneRepository()
.setURI(myRemoteURIString)
.setDirectory(new File(myLocalPathString))
.call();
However, for reasons of consistency in Git you should clone a bare repository only, so a non-bare repository in a remote location, while not technically, is practically inaccessible.
I am not sure I understand the question since Git is made for accessing other repositories, this is what is meant by "Git is distributed".
If you want to connect to ONE distant repository, then yeah you should clone it.
I don't know if that is what you are looking for, but you can also use multiple remotes. Adding one more is done with Git using git remote add <remote_name> <remote_uri>. As for Jgit, I unfortunately can't remember the code to do it simply, but you can figure this out.
At least it's possible by modifying the configuration, calling getConfig() from a Repository object and then calling setString(...) on it - don't forget to save the configuration in the end. But before modifying the configuration, I think you should first get to know more about Git and JGit.
I recommend you to read more about it, and play a bit with your repository. Take a look at this article : http://caiustheory.com/adding-a-remote-to-existing-git-repo .
Another one that will help you down the road is How do I do the equivalent of “git remote update” with jgit?
Maybe someone else knows exactly which commands to run and can help.

Resources