DEV Community

OleksandraKordonets
OleksandraKordonets

Posted on

OSD600 - Lab2

Contributing a Feature to a Classmate’s Repository

For this lab we needed to contribute to one of our classmates’ repos, and I chose to work on the repo of the only other student in our class who was also using C++. Here is his GitHub Repo.

Changes I Made

I worked on adding a Recent Changes filter to the project. The idea was to let the tool include only files that were modified in the last 7 days, instead of packaging the entire repository. I opened an issue describing the feature, then created a branch and implemented the following:

  • Added support for --recent or -r as a command-line flag.
  • Implemented a helper function isRecentlyModified() in utils.cpp/utils.hpp that checks file timestamps using std::filesystem::last_write_time.
  • Modified the file traversal logic in fs_travel.cpp to call isRecentlyModified() whenever the --recent flag is active.
  • Updated the output so that when the flag is used, a Recent Changes section is included in the generated text.

My pull request

Challenges

The biggest challenge for me was setting up the repo I forked. The person I was working with actually used libgit2, which is very impressive but also meant I needed to install some extra dependencies. I had never worked with libgit2 before, so I was stuck for a while trying to get everything to build. Luckily, the repo owner was kind enough to guide me through this process and explain how he had configured his environment.

On the technical side, figuring out file timestamps in C++ took a bit of research. The std::filesystem::last_write_time() function returns a time point, but you have to convert it into something comparable to the current system clock. It wasn’t as straightforward as in higher-level languages where you just call something like fs.stat().mtime. I had to carefully handle the conversion and make sure the time difference was calculated in days.

What Did I Learn?

I never made a pull request before, so I was happy to learn the full workflow. I got hands-on experience with forking a repo, creating a new branch for my feature, and making small, focused commits that clearly explained each step of my work. I also learned how to reference an issue in a pull request so that GitHub automatically links them, which is really convenient for project tracking.

What Would I Do Differently Next Time?

I think this applies to both Lab 2 and Release 0.1: I probably won’t choose C++ for my future labs. It requires you to build so many things from scratch that other languages already have libraries for. For example, my friend used JavaScript, and her gitInfo module was just a single function calling a library. Meanwhile, I had to research how to implement it myself and create a whole module around it.

Top comments (0)