Say I want to see whether two variables y and x1 are linearly related, while controlling for the effect of an x2 "nuisace" variable. What is the difference between

(a) regressing y over x1 and x2 and just looking at x1's coefficient; and

(b) doing a partial correlation for y and x1 while controlling for (co-varying) x2?