Wednesday, October 13, 2010

Git: What SHA does this tag refer to?

I often have to tag a branch in my Git repo for QA. Our QA people prefer to have a tag to deploy on to their QA environments, so that they do not have a "moving target" to ensure features and bugs are accounted for. Sometimes, however, I forget exactly where in the lineage the tag was created. In other words, on which commit the tag was drawn.

There is a way in Git to see this information. Here is a use case for the situation.

You complete feature A and commit it. You then tag feature A with an annotated tag and immediately start working on feature B, then C, etc. QA asks about the tag. You no longer remember what that tag was for, so you fire up a console and type in the following to find out:

git show-ref --dereference

You can find the tag in the list and perform a simple git log matching the sha from the show-ref to the sha in the git log. Simple. Even easier would be to run a filter using --exclude-existing on the show-ref using a regular expression and then piping the result to git show or git log.

Sunday, October 10, 2010

Debian Unstable (SID) Squeeze: installing Grub2

This is frustrating. Installing the Debian system in development (SID, AKA squeeze) is really broken currently. Installing GRUB or GRUB2 just does not work at all and can ruin your day. You get all the way to the end of the install when the error pops up. During the install of either GRUB or GRUB2.

Here is what you can do to fix this:

1. Choose to install GRUB2 and let it fail; be sure to allow GRUB to write to the MBR.
2. Go back to the main menu of installer items and choose "continue without installing a bootloader". Trust me on this one, it will all work out.
3. reboot your machine, the grub (this will be the GRUB2) bootloader prompt will be presented. This is your ticket back into your newly installed system
4. At the "grub>" prompt, type the following: (you may need to adjust the boot drive)

linux hd(0,1)/boot/vmlinuz-2.6.32-5-amd64 root=/dev/sda1


initrd /boot/initrd-2.6.32-5-amd64



of course substitute the kernel and initrd you are using for the real ones. Also check the root drive for the correct one. Sometimes you can just guess, the machine will just not boot if it is wrong and you can go back and do it again until you get it right.

Then once you have everything booted. You can install GRUB2 properly by doing the following:

apt-get install grub2


grub-install /dev/sda


grub-mkconfig > /boot/grub/grub.cfg



All should be well after the reboot.