Skip to main content

Command Palette

Search for a command to run...

GitRaven: April 2026 updates

Published
6 min read

Hey folks!

It's been a while since I've written about GitRaven.

This post will cover the new features I have introduced and talk about bug fixes.

AI Usage

I used ChatGPT or Google Gemini to help me for the updates shared below. They were very helpful in helping me see what I was doing wrong when working on stuff with GitRaven. For example, I ran into quite a few use-after-free bugs in the app because my understanding of freeing memory is different when compared to C++.

The most useful aspect of current AI is it's NLP tech that can understand the problem at hand and offer solutions for the code snippets and error logs I've shared.

I like to learn stuff by building apps and AI tech has made this approach less painful than it usually is.

Context menu actions in Tree:

GitRaven now supports context menu actions in the tree. This will allow users to quickly interact with a file/folder to stage/unstage, view in file manager or delete it entirely.

There are more items I'd like to bring onto context-menus but right now, my attention is drawn towards adding more Git related features (push/pull, fetch), etc.

GitRaven context-menu actions

Use Initializer Lists for initializing the app

This is a good milestone in my opinion. The research that went to helping me realize the problem with memory bugs in the app was mind-numbing.

Bug:
The app would randomly crash when performing git status equivalent. GitManager is an important class, used to perform all Git related actions on the repository.

Cause:

The crash happens at a function call when referenced via a pointer to GitManager class instance.

// inside header
// GitManager *m_gitManager;

// cpp code below
class Foo(GitManager *gitManager, QWidget *parent = nullptr)
    : QWidget{parent}
{
    m_gitManager = gitManager; // yikes!! but I didn't know this was bad then :(
}

void Foo::something()
{
  
  m->gitManager->doSomething(); // <- app crashed here
}

This class is initialized in main.cpp along with QApplication and MainWindow. It was my first "use-after-free" bug. I read about these in CVEs but to experience it first-hand in my app was a definite first.

Anyway, after back-and-forth with ChatGPT, I updated the code to init member variables at the initializer list so that they are available for constructor() to do stuff. It also ensures other widgets that depend on this widget can also safely access stuff as it's not corrupted memory anymore.

I have posted about this on my Mastodon at the time.

Checkout to different branches and tags

I am so happy to report git checkout is working on GitRaven. This feature has been on my mind since the project's inception and I am all here for it!!

There is a known issue at the time of writing where checking to remote branches or tags do not show their names rather they show the git commit hash that points to it.

I added a FIXME in the code so I might eventually get around to it.

Fun Fact: Testing this feature led to discovering more memory leaks within the app which I will in the next item :)

Memory leaks galore!!

The meat of this post is here! I ran into so many segmentation faults while testing the checkout feature with larger number of new/modified files. The app's would be stuck for few seconds while it renders the tree and updates the status bar.

It turns out, the leading cause for this was either missing destructors for QObject/QWidget classes and/or deleting variables or data incorrectly.

RavenTree class was notorious for crashing the app at unexpected times. The issue turned out to be incorrectly deleting QList<> foo; items.
The app kept allocating memory on every git status call without properly freeing the memory which was previously allocated to the QTreeView.

My JS experience is to be blamed here. JS has a garbage collector which in simple terms, is a background thread that runs as long as the app is running to check and free memory when it's no longer in use.
In the case of C++ with Qt, that job has fallen on to me. Although C++ offers smart pointers to address this issue, Gemini suggested not to use it with Qt because it messes with Qt's parent-child relationship. I didn't quite fully understand what it meant because on paper, smart pointers are the solution to my problem. They would manage the memory for me while I focus on building my app.

Also, I am familiar with the smart pointers concept because of Rust. I built a text editor with GTK + Rust few years back for fun.

Link to the fixed code:
https://github.com/shanmukhateja/gitraven/blob/9d5151009a777b0d88a1a18687b5580e1fdb8777/raventree.cpp#L117

The fix was two steps:

  1. Add destructors to all classes that extend QObject or QWidget.

  2. In order to clear a QList which holds list of pointers, we need to call qDeleteAll() followed by manually calling QList::clear on the member variables in RavenTree

Note: This isn't over yet. I have found another set of memory related bugs with my libgit2 usage code and I plan on fixing them someday.

I mentioned this briefly on Mastodon recently after struggling to understand why this was happening.

Async Git status checks

We now use a separate thread to handle GitManager::status for git status functionality via libgit2. Previously, the GUI thread would freeze up when GitManager::status was running on repositories with 100+ files.

The benefit is, the GUI thread isn't frozen although it stays a blank page - no indication that something is happening to the user.

Note to self - I need to add a progress bar when running long running tasks.

CLion migration

This is a personal change, not completely related to the project but I thought I'd share it here anyway. I migrated from Qt Creator to CLion last month to their free, non-commercial usage license tier.

Qt Creator is an excellent IDE however I am familiar with Jetbrains IDEs for work so I gave it a shot and I liked it.

Minor cosmetic things and bug fixes

  1. The app now shows the currently open folder's full path in title bar like "GitRaven - '/home/user/app'"

  2. Rewrite RavenTree's absolute path detection logic for individual node in the tree to fix bugs with parent-child relationship shown in the tree.

  3. Add CLion specific folders/files to .gitignore

Thank you

Thank you for sticking to the end.

I hope to make time for this project and improve it further while I learn C++ and Qt.

You can follow me on Mastodon.

Bye for now :)

GitRaven

Part 1 of 5

This series follows my dev journey of building GitRaven project. It is a hobby project which aims to replace SourceTree & GitHub Desktop on my desktop. It is written in C++ and Qt. Follow along to find out where the story goes!

Up next

GitRaven: How to setup Monaco Editor for QWebEngine

Hello, This blog post will talk about integrating Monaco Editor into a Qt + C++ app using QWebEngine. Background GitRaven is being built to serve as a near-identical replacement to VSCode’s source control management. It aims to offer a similar, yet o...