Lab 4This lab was about learning how to use remotes and the fetch commands. One part of the lab was working on implementing some code into another students repo, while the other was about reviewing a new feature someone else added to your own repo.
Working on someone else's project I looked through the release 0.1 list of all the other students and found Philips WISA project. It took a little while to understand what each part of his code meant but implementing the new ignore URL feature was easier then I thought it would be. I had to add one new function and a new section to the main function. The new function takes in a string array that is filled with a list of ignore URLs, and the loops through each list of URLs comparing them against one another. If there is a match I would remove the URL from the original list. Using the strings library "HasPrefix" function was a huge help for finding the matching URLs.
//Goes through the url list and removes any url that matches with the ignore url list
func ignoreURL(url []string, ignoreList []string) []string {
//Loop through the url list
for i := 0; i < len(url); i++ {
//Loop through the ignore url list
for k := 0; k < len(ignoreList); k++ {
//If the beginning of the url matches the ignoreList value, set the url value to ""
if strings.HasPrefix(url[i], ignoreList[k]) == true {
url[i] = ""
}
}
}
return url
}
I tried to match the process of reading and saving the ignore data file to how it was done in his code for the normal URL file. I called the same functions to perform the same tasks on it such as the "RemoveDuplicate" function and the regex expressions he had already made.
Right before the URL list was processed by his link checker function, I called my new function to remove any links that matched. This way I didn't have to change most of the code in his main function.
Reviewing someone's branch of my own codeAndy was the one that worked on adding the ignore feature to my own project. At first he opened up a new issue which I assigned him to. Once his work was done, I made added his fork as a remote under the name "AndyYang/issue-16". I used git fetch to bring there work into my own local repo. The code was great and I really liked the default ignore file that he had implemented just in case a user did not enter a second file. I tested every command to make sure they still worked, which they did.
After reviewing his branch I suggested he should add updates to the ReadMe file and the help message command to show how to use the ignore option. Later on he pushed up a new version on his branch which I accepted and merged into my own repo. I then closed the issue, completing this part of the lab.
Links
What I learned
Overall I thought this lab was pretty good. I learned how to add a new remote and how to remove remotes since I made a mistake adding one at the beginning. I learned how to fetch the latest commit of a branch to view someone else's work without merging. I did actually run into an issue near the end where I couldn't fetch Andy's work. This was because I had setup his remote with the ssh link to his fork, I simply just removed his remote and added a new with the HTTPS link. I believe this was caused by my GitHub account not being verified on my local editor.
Comments
Post a Comment