Project

General

Profile

Git branch tracking

Added by Bryan Ward about 16 years ago

I just setup a project in Redmine using a git repository. The trouble I am having though is that Redmine only allows me to view and browse revisions to the master branch. Currently I am doing a lot of development in a separate branch I am not reading to merge into the master branch yet, but I would like to be able to visually track my revision history in this branch? Is there a way to do this, or is this a feature that still needs work?


Replies (26)

RE: Git branch tracking - Added by Thomas Lecavelier about 16 years ago

The true problem is that git only allow to "see" a branch at once, so the only workaround we could imagine is to play with
git branch
git checkout [branch]
But there are command runnable only on a working tree, not a bare repository as currently used by redmine.
So... Personnaly I'm waiting for grit new features, hoping it'll permit to search a bare repos for branches relative informations.

So... wait & see :)

RE: Git branch tracking - Added by Nicolas Chuche about 16 years ago

I've began to work on something to be able to see all branches/tags in a git repository. It works but need some tests. Not enough time to release it before 0.8 so perhaps in 0.9...

RE: Git branch tracking - Added by Tomi Pieviläinen about 16 years ago

Thomas Lecavelier wrote:

The true problem is that git only allow to "see" a branch at once, so the only workaround we could imagine is to play with
git branch
git checkout [branch]
But there are command runnable only on a working tree, not a bare repository as currently used by redmine.
So... Personnaly I'm waiting for grit new features, hoping it'll permit to search a bare repos for branches relative informations.

So... wait & see :)

I can't claim to be an expert with git, but what additional functionality is needed? git branch -v shows the id for every branch and instead of HEAD you can then use these ids for example with git ls-tree to get the view of that branch.

RE: Git branch tracking - Added by John Dell almost 16 years ago

Tomi Pieviläinen wrote:

Thomas Lecavelier wrote:

The true problem is that git only allow to "see" a branch at once, so the only workaround we could imagine is to play with
git branch
git checkout [branch]
But there are command runnable only on a working tree, not a bare repository as currently used by redmine.
So... Personnaly I'm waiting for grit new features, hoping it'll permit to search a bare repos for branches relative informations.

So... wait & see :)

I can't claim to be an expert with git, but what additional functionality is needed? git branch -v shows the id for every branch and instead of HEAD you can then use these ids for example with git ls-tree to get the view of that branch.

We've also just switched from subversion+trac to redmine+git and we need to be able to view git branches in redmine.

Nicolas Chuche - Do you have your work somewhere we can look at it (github, etc) or contribute and test it? I found an 'official' github mirror of the redmine svn repo here (http://github.com/edavis10/redmine/tree/master) so you could fork there.

Also, it would be nice if the git/redmine code could read 'bare' git repositories. We are using gitosis which only does 'bare' git repos. To get this working with redmine, we are doing a local clone on the server to a non-bare repo.

Thanks,
John

RE: Git branch tracking - Added by Stuart George almost 16 years ago

Nicholas, that sounds awesome. How is it coming along?

RE: Git branch tracking - Added by Eike Bernhardt almost 16 years ago

John Dell wrote:

Also, it would be nice if the git/redmine code could read 'bare' git repositories. We are using gitosis which only does 'bare' git repos. To get this working with redmine, we are doing a local clone on the server to a non-bare repo.

I am currently using gitosis-based 'bare' repositories with redmine and I haven't met any problems? The 'master' branch is showing up just fine in the git-based projects ...

  • git version 1.5.4.4
  • redmine r2113

RE: Git branch tracking - Added by John Dell almost 16 years ago

Hi Eike,

Well, I think I'm losing my mind. I am certain it wasn't working, and when I created the local git clones, those worked, but now I just tried accessing the 'bare' repository directly from a redmine project, and now it works fine also! I must have had a permissions issue with the gitosis home directory that I had fixed when I setup the clones. I remember reading in some other threads that bare repos didn't work sometime in the past, so that obviously got fixed.

Thank you for your reply. I can scratch that off my list! All we need now is branch support!

I'm using git 1.6.0.4 and redmine r2085

Thanks,
John

RE: Git branch tracking - Added by James Turnbull almost 16 years ago

Looks like grit (http://github.com/mojombo/grit/tree/master) now has sufficient features to replace the use of the Git binary. Is anyone actively working on this?

Cheers

James Turnbull

RE: Git branch tracking - Added by Fabian Franz almost 16 years ago

Hi all,

we need git branch support for our commercial development and so I hacked it together.

On the interface not much has changed, but whenever you enter a revision you can enter: 'master' or 'refs/heads/master' or 'master^' or 'master~5' or whatever git magic you need.

If you input a revision that does not exist, '--all' is used for commands that are able to work with multiple commit heads and HEAD is used otherwise.

I also changed it so that all reachable revisions are stored into the database and the stored values are used by default (which makes it faster).

I also fixed the 'changes for path', which did not work at all before for me. (but I haven't long tested it)

Internally for most operations the database is not used, which removes the functionality 'sniff sniff' to go to the next commit and only to the previous, but besides gives the ability to actually be kept in the branch, where you have been and not mix branches together.

So for all operations that have a revision specified git is run, but as git is one of the fastest SCMs I really cannot feel a performance loss - my web browser takes longer to load the page (slow internet to cooperate network) than I have to wait for ruby to finish ...

Oh, this was my first ruby hack, so I might still use constructs, which are not optimal ... but ruby and Ruby on Rails is a lot of fun!

Intern: I used Adapter classes for Changeset and Changes to quickly convert git "revisions" to Changeset compatible classes without querying or using the database.

I hope you enjoy the patch and Have fun!

Best Wishes,

Fabian

fabian-hacking-git-support-v5.diff (22.9 KB) fabian-hacking-git-support-v5.diff Patch for Redmine Git Branch support - Hack -

RE: Git branch tracking - Added by David Smalley almost 16 years ago

I've started working on Grit integration, just adding it as a plugin for now.

Once it's done it'll be up on our github fork, http://github.com/brightbox/redmine/tree/grit

Don't hold your breath though, I'm quite busy at the moment :)

RE: Git branch tracking - Added by Muntek Singh almost 16 years ago

I'd also like to show my support for Git Branch Tracking, could really use this feature!

RE: Git branch tracking - Added by Alban Browaeys over 15 years ago

Another version of git branches support . I made it those past weeks and share in case it feets other needs than the previous one (It shows the all the branches in the browse views and the diffs ... other features I have not tested).

redmine_git_branches2.diff (10.4 KB) redmine_git_branches2.diff Git branches support in the browse and diff views

RE: Git branch tracking - Added by Babar O'Cap over 15 years ago

Is your patch is complete ? Because in browse views I don't see any branches

RE: Git branch tracking - Added by David Smalley over 15 years ago

Nope, I have had zero time to work on this. I did get started and Grit is actually incredibly powerful and will definitely do the job here.

RE: Git branch tracking - Added by Alban Browaeys over 15 years ago

It was broken in that it used hardcoded branch name ... and this hardcode was only working on my git tree . That s why I did not noticed.

This one should work (redmine_git_branches3.diff) . There is a also a second patch that would be needed if you don't have svn version (it is a fix from upstream for the diff view that is redmine_other.diff).

One need to remove the git repository and add it back.

Hopefully this one is hard coded path free. If there are still bugs please tell.

redmine_git_branches3.diff (17.7 KB) redmine_git_branches3.diff GIt branch support "hack" that is does not require any core changes
redmine_other.diff (1.06 KB) redmine_other.diff FIx switch kind of view button in diff view - not needed if using svn.

RE: Git branch tracking - Added by Babar O'Cap over 15 years ago

David Smalley> Sorry, my message was for Alban Browaeys

Thanks Alban, I'll test theses patches tomorrow. If I've svn and git projects, redmine_other_stuff.diff isn't needed ?

RE: Git branch tracking - Added by Alban Browaeys over 15 years ago

Sorry I mean using "redmine svn version" by "using svn", not svn repository. So yes it is needed and you should already have the bug if switching from "inline" to "side by side" in diff view.

There is no order in applying the patches they are on different files. Also one have to reverse my previous one if applied via "patch -R ...". As they both apply on vanilla redmine.

Best regards,
Alban

RE: Git branch tracking - Added by James Turnbull over 15 years ago

Alban - I wonder if it's not worth stripping out the:

refs/heads
refs/remotes
refs/tags

prefixes from the repository view?

Cheers

James Turnbull

RE: Git branch tracking - Added by Babar O'Cap over 15 years ago

Alban Browaeys> I've this error: duplicate key value violates unique constraint "changesets_repos_rev"
But after deleting the index changesets_repos_rev in changesets table, it's works great ! (My Redmine version is 0.8.2)
And I've tweak a little your patch to be compatible with Windows

redmine_git_branches4.diff (17.7 KB) redmine_git_branches4.diff GIt branch support "hack" with Windows shell quote compatibility

RE: Git branch tracking - Added by Babar O'Cap over 15 years ago

Alban Browaeys>I've find a bug :
I've 2 branches on my git repos (master and edge), master is the default branch
If I push to edge I can see in redmine the hash of my commit but not the comment and if I want to see the committed files, redmine doesn't find them.
To see commits comments and diff files, I've doing this on my git repos server

git symbolic-ref HEAD refs/heads/edge

Then i can checkout back to master branch :

git symbolic-ref HEAD refs/heads/master

And it's ok, because the changesets are in database

RE: Git branch tracking - Added by Babar O'Cap over 15 years ago

Of course after each "checkout" you have to reload your browser

RE: Git branch tracking - Added by Alban Browaeys over 15 years ago

James . Yes this would be neat but would require a change to the view shared by all the repositories kinds (svn, git, etc).
In fear of breaking something else by adding a simple workaround (stripping those in the view code ... ugly) I have left them.
Remind this is a hack . I believe the whole controller/view needs an overhaul for to either have separate code for dvcs and vcs or be dvcs conformant and support vcs as a degradated version of it.

Babar . Thanks for testing . Weird what you describe looks partly like what I had before removing/adding back the git repository to the redmine project . Have you done that ? It is needed because redmine read (it takes time) all the changeset from all the branches into the db and cache them . Deleting the repository binding to the project in redmine purge this cache and also makes available all the changesets from all the branches.

If you already did I ll investigate.

RE: Git branch tracking - Added by Babar O'Cap over 15 years ago

Alban Browaeys> It was a bad idea to remove changesets_repos_rev index, because it's duplicate commits messages.
So I've removing/adding back the git repos. On first hit it's raised this error :

duplicate key value violates unique constraint "changesets_repos_rev" 

But after the error is gone.

RE: Git branch tracking - Added by Artem Shutov over 15 years ago

This patch is show changes in Activity section?

RE: Git branch tracking - Added by Ilya Ternovoy about 4 years ago

Bryan Ward wrote:

I just setup a project in Redmine using a git repository. The trouble I am having though is that Redmine only allows me to view and browse revisions to the master branch. Currently I am doing a lot of development in a separate branch I am not reading to merge into the master branch yet, but I would like to be able to visually track my revision history in this branch? Is there a way to do this, or is this a feature that still needs work?

Seems like there is no solution till that moment?

Is there any chance to get all other branches here automatically?

(1-25/26)