google / git-appraise

Distributed code review system for Git repos
Apache License 2.0
5.13k stars 146 forks source link

Comment location parameters are checked after invoking editor #107

Open krobelus opened 3 years ago

krobelus commented 3 years ago

In the git-appraise repo, I did

$ git appraise comment -f .travis.yml -l 10 bd714f195655

and composed a review comment in my editor. After I was done I got

Unable to comment on the given location: Line number 10 does not exist in file ".travis.yml"

This was just my off-by-one error, I should have used -l 9.

Unfortunately, .git/APPRAISE_COMMENT_EDITMSG was deleted despite the error, so I had to write it again. I think we should either check for errors upfront, or preserve APPRAISE_COMMENT_EDITMSG in case of errors.

(I pushed my review to my fork, I'm not sure if that will reach the PR here?)