Pick over the rice an put in a bowl. Wash in several changes of water. Drain. Pour fresh water over the rice and let it soak for 1/2 hour. Drain in sieve for 20 minutes. Heat the oil in a heavy-bottomed saucepan over a medium flame. When hot, put in the onion. Stir and fry until the onion bits have browned. Add the rice, green chili, garlic, garam masala and salt. Stir gently for 3 to 4 minutes until all the grains are coated with oil. If the rice begins to stick to the bottom of the pan, turn down the heat. Now pour in the stock and bring the rice to a boil. Cover with a very tight-fitting lid, turn heat to very, very low and cook for 15 to 20 minutes.