How to Make It
In a very small saucepan, submerge the garlic in the olive oil and cook over moderate heat until bubbles begin to appear. Reduce the heat to low and cook until the garlic is very soft, about 30 minutes.
In a large skillet, heat the oil until shimmering. Add the onions, season with salt and pepper and cook over moderate heat, stirring occasionally, until the onions are soft, about 20 minutes. Add the sugar and cook over moderately low heat, stirring frequently, until the onions look dry, about 10 minutes. Add the vinegar and cook over low heat, stirring occasionally, until the onions are very soft and dry, about 45 minutes.
Stir the garlic confit with its oil into the onions and cook for 5 minutes. Serve warm or at room temperature.