Once upon a time, there was a tester. He knew his way around Ruby, Watir, SVN, Terminal and stuff like that. He heard people talk about Git, and he decided to try it. But Git was strange. He was playing with it a bit, but did not have much luck with setting it up, so he decided to leave it for later.
One day he decided to run his existing Watir tests on Internet Explorer 8 (IE8). He was already running them on IE6 and IE7, so he thought that it would be a piece of cake. He fired up one of his Windows virtual machines, installed IE8 and started the tests.
One of the first things he noticed is that file uploads were not working. File upload pop up would appear, but Watir was not populating it with path to the file that should be uploaded. He thought:
I think I know what is the problem. I have already heard that file uploads are not working if user has Windows language set to anything than English. It was something about the title of the pop up window.
And really, IE6 and IE7 had
Choose file and IE8 had
Choose File to Upload as pop up title.
C:\ruby\lib\ruby\gems\1.8\gems\watir-1.6.2 folder (that is where Watir lived on his Windows machine) to his Watir project in NetBeans, and made a search for
Choose file. The search found 12 matches in 2 files. Both files were in
watir-1.6.2\lib\watir folder. Files were
winClicker.rb. He said (to himself):
I will try
There he found an ugly long line that contained
Choose file three times:
He replaced all three occurrences of
Choose file with
Choose File to Upload.
He tried file upload with Watir, and it worked! He was so proud, that he decided to share it with the world! Since Watir code recently moved from SVN to Git, it was also a perfect chance to try Git again. Watir code is hosted on Github, so he opened an account there.
I will need to download the latest Watir code, make the change there and contribute back.
He found Watir repository and forked it. (It is polite to fork a repository on Github.)
He already had Git installed on his Mac. (Recently he became one of those cool people that use Macs.) He probably installed it a while ago when he tried Git for the first time.
He likes to have the newest versions of any software, so he updated Git.
Then he decided the time is right to download (or clone, as Git calls it) his fork of Watir. Do not make the same mistake he did! He cloned the repository using
public clone URL (
git://github.com/zeljkofilipin/watir.git). No, no and NO! You should use
your clone URL (
firstname.lastname@example.org:zeljkofilipin/watir.git) (He wants to say thanks to Bret Pettichord for teaching him that valuable lesson.) He found those links at Github after logging in and forking the Watir repository.
He followed the instructions. Do not name your files
github.pub, like he did. Leave default file names, otherwise it will not work. You do not need a passphrase for now. Leave it blank. (He wants to say thanks to Mislav Marohnić for teaching him all that SSH stuff.)
Now he had
id_rsa.pub files. He gave contents of
id_rsa.pub to Github. (You should keep your
id_rsa as a secret. Never show it to anybody. Not even your best friend. Seriously.)
Now that chain of trust was made, he got the repository to his machine.
He saw something like this:
He made the changes to the code with NetBeans. That was not such a good idea. But, I will talk about that later.
Then he committed the change to the local repository.
Finally, he pushed the change back to Github:
He saw something like this:
In a blink of eye, he was already at Github looking proudly at his commit.
But, he made one last mistake. (This is the last mistake. I promise. No more mistakes in this story. Enough is enough.) He did not know how to do a diff with Git, and NetBeans messed the whitespace, so his commit was a whitespace mess. Of course, he did not know how to undo. So, he just deleted his local and Github repositories and started over. (He had to wait a bit until he saw
fork button again on Bret's Watir repository.)
This time, he did everything right. After he pushed the change, he was so proud, that he decided to ask Bret Pettichord, the owner of the original Watir repository to merge his change with the original repository. That is called
Don't just love happy ends?! :)
Update: Bret Pettichord points out that instead of deleting local and Github repositories after messing up the whitespace, our hero could undo the change with this: