Sparse Checkout!

I’m happy to announce that my extension is now working with sparse checkout! Sparse checkout was a feature that we decided to try instead of git clone. It’s a feature of git that allows a user to keep just a certain file or directory from a git repository. It’s pretty neat because it’ll help conserve space.

I think my commit message will explain best what I’ve done:

Added sparse checkout functionality.

Created two new functions: SparseCheckoutNewRepo and AddToSparseCheckout. SparseCheckoutNewRepo will clone the repo and keep only the file given by the tag #snippet. Sparse checkout will only take the file from the given branch. The md5 hash has been updated to include the branch name so that each branch from the same repo will have its own folder.

AddToSparseCheckout will add files to the sparse checkout if the git repo/branch combination already exists. It will update the tree with `git read-tree -mu HEAD` whenever the file is edited.

This one took a while since there were many more things to check and find out. I didn’t realize that the sparse checkout will only check out one branch, which is staunchly set after it’s called so if you wanted something from branch2 but you had created your repo with master as the branch, you would need to make a new git repo for it. That’s why I added the branch name to the md5 hash.

Anyways, I’m really proud of this new change because it was a feature of git that I really didn’t know and didn’t understand. I had to test the commands on my computer several times to really grasp what was happening.

There has been some people who have taken an interest in my project lately and I can’t say how excited I am at the prospect that my code will help anyone. When I first started this, I was a bit disheartened when people said that they didn’t understand how my extension could be useful. But now that people might actually find it useful, it’s been a really nice bonus. I’ve found that project to be pretty fulfilling already because I learned so much in just two months.

Also, I noticed that people are translating the description of my extension in my i18n file. Sorry to be a parrot, but that’s so cool. I can’t believe people actually bothered to give my modest extension a translation. The mediawiki community is so amazing.

I will keep working hard and push myself. I feel that whenever I come across something I don’t know or understand, I tend to freeze. I have to learn to push myself into a project. I’ve been talking about doing unit testing for a few days now, but I’m still quite intimidated by it even though it should be a simple process. It’s a mental thing that I must overcome. I feel that once I start, I should be able to get the ball rolling and do it quickly, but getting the ball rolling is harder than I expected.


Updates on my project

Inevitably, blogging has gotten the best of me and I pushed it to the wayside. But I’ve made some pretty good progress, IMO, on my extension. It basically does all the things that my initial application does but in a much better format.

I’ve implemented a few error catching and messaging, which wasn’t present in my initial application. Also, I’ve created a shiny new class GitRepository which will hopefully be used later on by other applications. I’ve just added the functions that are relevant to my project, but perhaps in due time, it’ll be fleshed out more with more functionality.

I’ve been wanting to get into unit testing so that I don’t have to test manually. This is a totally new field for me since I’ve grown accustomed to testing things via printing things out or, more rarely, using a debugging tool. Having a testing environment is pretty important to the software world and I would really like to develop the skills for it. There’s been a surge of test driven development and behavior driven development so learning how to write unit tests is pretty important.