I am back again to update you all on my 3rd pull request of Hacktober Fest… or should I say 4th since I ran into some issues. I decided to continue on working in the hag repository, which I did my second pull request from. I felt that for the most part I understood where everything was and how the code worked. That is why when I found that they submitted a new issue; I tried to give it a go. The issue was that when player was not pressing a button that they were checking for it did not progress the counter/time in game. I’ll also explain later why I said it was my “4th pull request”.
Since I was already familiar with the repository I knew exactly where to look to fix this issue. I knew that a switch statement in the main.c file was used after reading the button to split the logic for all the different button presses. Since they were not counting button presses that they didn’t check for I knew they had no default case for the switch statement. So to fix the issue all I had to do was add a default case so any invalid button presses would be counted. This can be seen below
Mistakes I Made
So as I was saying earlier this is technically my “4th” pull request. This is because I made a mistake by creating a new branch for this issue in the previous branch I created for my second pull request and as you can see below. It added those commits to this this pull request I made as well… whoops.
The member of the project then asked me to remove the commits/code for my previous fix. I ran into some issues trying to go back and removing it properly. So, In the end I just pulled master and created a brand new branch fresh and pushed a brand new pull request.
All in All
I felt this was a pretty easy issue to fix code wise, but I ran into issues using Git. It was good learning experience and I learned to create a new branch off of the master for every new issue. It was good to learn now rather on a bigger or more serious repository.