views:

1073

answers:

6

Here's are examples of git workflows:

Let's say you wanted to take advantage of bug tracker integration with your version control system. Where/how would that fit into these workflows. What would you actually see in the tracker?

I'm the author of BugTracker.NET which like many other bug trackers (Trac, Redmine, FogBugz) integrates with svn. We all do it more or less the same way. But with git, I have trouble imagining what integration with git would look like.

EDIT: I've taken a look at one attempt at github-fogbugz integration, but even the author of that says "It's fairly obvious that FogBugz was written for a more traditional CVS/SVN SCM system in mind. As such, the commit list display doesn't really jive with git".

EDIT2: A thread about Redmine/git workflow: It seems that the most typical setup is that Redmine works with a local clone of whatever is considered to be the "central" repository, so it sees changes when they make it to this clone. Triggers or scheduled jobs automate the pushing to Redmine's clone.

EDIT3: Seems even with linux and Linus, there ultimately IS a main git repository that could be considered the benevolent dictator repository: See http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary

EPILOGUE: Thanks everybody. My BugTracker.NET now includes git integration, according to the guidance you folks gave me.

A: 

Redmine is already integrating with Git and it's opensource. Maybe you can take a look at their integration for ideas.

wes
A: 

Perhaps I'm a bit naive, but would bug tracking be really that different in git than in svn? The repository used by the system will basically have the same structure (branches and tags) as in subversion, right?

I can imagine you'd want a nice graphical representation of how the branches interact, but other than that...

Mark van Lent
+6  A: 

Trac and Redmine both support integration with Git. It looks more or less exactly the same as the Subversion support. The bug tracker follows one repo as the benevolent dictator repo, it doesn't have to care about all the other clones around the place.

One thing I do think is worth mentioning is that any bug tracker needs to support git branches properly. Working on branches is such an important part of the Git methodology, it needs to be supported in the bug tracker. Redmine can do this through a patch, but last I looked (about a month ago), it wasn't in the main source tree (you could only follow master).

Other useful features would be a graphical representation of how branches are created and merged, similar to how gitk looks. I don't know of any bug tracker that does this kind of visualisation.

EDIT by Corey Trager. I copy/pasted @Squelch's answer here (I upvoted @Squelch too):

Due to the distributed nature of Git against the centralized nature of SVN, it is quite possible for every user or copy of the repository to have different branches. The exisitnig trackers typically have a local copy of the repository that is used as a central reference ("benevolent dictator") that can be regarded as the working copy for all users.

It is quite feasible for users to have a different branch structure in their local copy from that of the tracker. They might choose to keep some private, pull only the branches from the remote that they are interested in, or push a new branch to the remote (tracker). Users can even share branches between themselves that the remote may never see.

The bug tracker can really only reference repositories it has access to. Commonly this is local to the tracker, but it is also possible to pull from repositories remote to the tracker, and far harder to manage. If it is accessing a remote, it can only track branches that it has knowledge of, and there is not really a method of initiating this task apart from a scheduled task. This also assumes that users are serving their local copy too.

As you have already noted, a scheduled task, or an event hook can be used to update the tracker using the commit log for details. These details can then be matched to the tracker issues for viewing as required and noted above.

In short, the tracker will typically see whatever changes are made on the branches it currently has access to. With a hook these changes are seen immediately including the creation of a new branch. It will not see or track changes made to users (offline) repositories until they push those changes.

END OF @Squelch

MichaelM
It seems that what follows from the idea of following one benevolent dictator repo, that the step where the integration happens is not when the dev does a checkin to his local branch, but rather when there is a push from a local branch into the ben dict repo. The checkin to to the local branch would be invisible to the bug tracker. Am I understanding things right?
Corey Trager
Yes, that is how it would work. It would be impossible for the bug tracker to know about all the local commits and branches. Since they are all local, its quite possible I work on a branch on my laptop and it never gets pushed anywhere. Nobody in the rest of the world needs to see this.Proper branch support is the most important thing, since having several active branches is a very common workflow with Git.
MichaelM
When you say, "several active branches", you mean, branches within the central/benevolent dictator clone, right? The rest of this comment is a digression. Regarding, "It would be impossible...", I'm thinking, "Would it?". I could envision that checking into a local branch could fire a script that would send a message via HTTP to the central bugtracker. If the check in is done when the coder is disconnected from the internet, the messages could be queued until the time when the coder was reconnected to the internet.
Corey Trager
yes, sorry, my newlines were removed. It is common to have several branches active on the 'benevolent dictator' repository that the bug tracker should definitely keep track of.As for keeping track of the private/local branches (the laptop in my previous example), I'm not sure this is really any different to just pushing to a branch in the master repo. Or, if you wanted to keep the repositories separate, you could accomplish what you are describing with a post-commit hook.
MichaelM
+1  A: 

There's also an open source integration with Fogbugz, on GitHub of course.

dove
Thanks. That's useful. But, the author himself writes, "It's fairly obvious that FogBugz was written for a more traditional CVS/SVN SCM system in mind. As such, the commit list display doesn't really jive with git".
Corey Trager
+3  A: 

To echo MichaelM's answer, Redmine has good Git integration. It follows the commit messages for keywords like references. fixes etc and a tracker number of the form #1234.

It is true that branch support isn't quite yet there, but it entered the trunk about a month ago, and is destined for version 0.9. Redmine is currently maintained in SVN, but there is also a mirror on Github

The link to Redmine trunk is indicative of the tracker output for Git repositories with the differences being how the branches are navigated.

$ git log

Can be used to parse commit messages, authors and revisions for use in any tracker if required.

Edit: Due to the distributed nature of Git against the centralized nature of SVN, it is quite possible for every user or copy of the repository to have different branches. The exisitnig trackers typically have a local copy of the repository that is used as a central reference ("benevolent dictator") that can be regarded as the working copy for all users.

It is quite feasible for users to have a different branch structure in their local copy from that of the tracker. They might choose to keep some private, pull only the branches from the remote that they are interested in, or push a new branch to the remote (tracker). Users can even share branches between themselves that the remote may never see.

The bug tracker can really only reference repositories it has access to. Commonly this is local to the tracker, but it is also possible to pull from repositories remote to the tracker, and far harder to manage. If it is accessing a remote, it can only track branches that it has knowledge of, and there is not really a method of initiating this task apart from a scheduled task. This also assumes that users are serving their local copy too.

As you have already noted, a scheduled task, or an event hook can be used to update the tracker using the commit log for details. These details can then be matched to the tracker issues for viewing as required and noted above.

In short, the tracker will typically see whatever changes are made on the branches it currently has access to. With a hook these changes are seen immediately including the creation of a new branch. It will not see or track changes made to users (offline) repositories until they push those changes.

Squelch
Thanks. I understand how branch support is related to Redmine's repository VIEWING functionality, but I think that's a little bit of a different topic than what I'm asking. I'm asking, when I'm a programmer fixing a bug, interacting with git through the steps of checkin, push, etc, at what point or points in that workflow does my activity get recorded in the bug tracker. So far, it's sounding like the point is when the final push is done to the "central" repo. Right?
Corey Trager
I wasn't able to leave a comment, so included some pertinent info about Redmines view of the changes. I see your edit about the use of scheduled and triggered updates, which I omitted from my answer. I've updated my answer with some more git branch methodology.
Squelch
I upvoted and copy/pasted a lot of your text into the accepted answer.
Corey Trager
Thank you and good luck with BugTracker.NET
Squelch
+3  A: 

Great Question.
For answering it, you need to look at what both of those tools (BugTracker.NET, which you know well, obviously ;) and Git, made initially by Linux in 2005) are actually trying to solve.

  • BugTracker.NET: web-based tracker, for bug (or pretty much any other "item" you want to track, since you can define your custom fields, status and workflow)
  • Git: at its core, it is a patch integrator, made to apply lots of patches from lots of people (not all of them known or with specific roles) to a large number of files. Quickly.

So you can see the dissonance here, between a central referential and a distributed code aggregation tool.

The lowest common denominator between those two model remain the "Benevolent dictator workflow", which is the most distributed workflow out there which still have a central repository for you to monitor.

But should you follow that path (monitor one repository acting as the "official referential", while having a loose distributed merge workflow below that one repo), you then need to re-define what is a user and its role.
Especially when it comes to integrate Git with your centralized role-based bug tracking tool.

If you watch Linus's presentation of Git at Google, around 18'35, you will get to the passage where you realize using Git means not having all the users identified and attached to a role.

Here is a couple of quick quotes/points that illustrate that fact:

  • > “ Because you have a central repository means everybody who is working on that project needs to write to the central repository.
    Which means that, since you don't want everybody to write to the central repository, because most people are morons, you create this class of people who are ostensibly not morons. ”

So, not everyone will end up pushing to the central repository, and most of the actual work there (small fixes, validations, testing, ...) will be done by a limited number of people anyway.

That "Benevolent dictator workflow" means you works with a "network of trust": a selected group of people. Again, not all the developers are directly visible.

  • From the same presentation, what you also realize is that a "all repository" can be part of the lifecycle of the code (as opposed to branches 'integration', 'testing', 'to be released', or labels 'release1.0', ...):

“ One of the things for commercial companies: the distributed model also helps with the release process.
You can have a verification team that has its own tree. And they pull from people and they verify it, and they verified it, they can push it to the release team, and say "Hey. We have now verified our version, and the development people, they can go on, playing with their head, instead of having to create tags, branches, whatever you do to try to keep off each other toes.
Again, you keep off each other toes by just every single group can have its own tree, and track its work and what they want done. ”.

That reinforce the previous point: if you monitor only one repo, you could only monitory commits from a limited number of people.
And it add a twist:
While you cannot monitor all the repos out there, you may not want to monitor only one repo: if the bug tracking overlap several phases (namely 'contrinous integration', 'functional testing', 'user validation', 'pre-production', ...), each of them potentially having their own tree, and each of them being a potential source for filling a bug report.
In that respect, the "Git branch support by Redmine" (Revision 2840) is still made with a "centralized repo" mindset, where you use a branch for a development lifecycle modelisation (where you do tasks about and around development, instead of doing an actual "development effort" which is what a branch should be all about).


Where does all that leave you?

  • either imposing a strict central repository model (everybody must push to one repo), which, in my experience, is never good when a tool try to force you to work one way instead of letting you adapt the tool to the way you want to work.

  • or redefining the bug lifecycle management to take into account:

    • potentially multiple trees, each one a potential step in a bug resolution.
    • users that will be register as working on a bug, but with no complete code history: i.e. the code monitored might not be directly associated with them, since the resolution can be done in private branches on developer's repositories, while the monitored code is made from multiple merges by one 'integrator' on dedicated repositories.
    • intelligent reporting able to tell what bugs are detected/fixed in an "official revision" of the code, limiting themselves to point out the origin of those changes (it comes from the merges of such remote branches, for such remote repo)

In short, this is not a trivial task.

The issues remain:

  • Git publication workflow, which is inter-repo (push/pull) as well as intra-repo (merge/rebase): which ones do you want to track?
  • Git private branching: not all the history of the code will ever be visible, and should not be tracked. Only public branches (which are pulled/pushed, but also modified within their own repo by some merge or rebase) should be tracked
  • Git users: according to their place within the "network of trust", they have different roles that the tracker needs to reflect.
VonC
Thanks for putting so much into the answer. I've had to to learn more, and think more, and here's where I am now: The benevolent dictator style reflects how almost everybody is using git. Even Linus. See http://www.kernel.org/ and http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary
Corey Trager
Above should read "I've had time to learn more".
Corey Trager