Infuse the oil: In a large skillet or Dutch oven over medium-low heat, combine the olive oil, sliced garlic, rosemary sprig, and red pepper flakes. Cook gently, stirring occasionally, until the garlic is pale gold and fragrant, about 4-5 minutes. Do not let it brown deeply. Remove the rosemary sprig and discard.
Cook the pasta: While the oil infuses, bring a pot of salted water to a boil. Add the ditalini and cook according to package directions until al dente. Reserve 1/2 cup of starchy pasta water before draining.
Warm the chickpeas: Once the garlic is ready, add the rinsed chickpeas directly into the skillet with the oil. Stir well to coat and let them simmer for 2-3 minutes so they absorb some of the garlicky flavor. Season lightly with salt.
Combine and emulsify: Add the drained pasta to the skillet with the chickpeas. Pour in a splash (about 1/4 cup) of the reserved pasta water. Toss vigorously over medium heat for 1 minute until the liquid reduces into a glossy sauce that coats the noodles. If it looks dry, add another splash of water.
Finish and serve: Remove from heat. Season generously with black pepper. Serve immediately, topped with Parmesan if using.