Re: [PATCH] t1401: test symbolic-ref exit codes on a non-symbolic ref
Nikolaus Schuetz <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
> Out of curiosity, what made you address these gaps in particular? Is > there any motivation, or are you just picking random things to work on? Not random -- I've been going through git commands, checking whether the behavior their man pages promise is actually exercised from t/, and filling the gaps. The idea is to pin the documented contract in a test so a later refactor can't quietly change it. git-symbolic-ref(1) spells out both the exit status and the --quiet silence, but neither was tested, so they stood out. > This is testing the status quo, but what I think would be good to > research in this context is why the error codes are different in the > first place. Agreed it's surprising, though it's not unique to symbolic-ref: git rev-parse --verify --quiet does the same thing (exit 1 and silent, vs a fatal 128 without --quiet). It falls out of how the two paths report in check_symref() (builtin/symbolic-ref.c): the non-quiet path calls die(), which always exits 128, while --quiet can't die() -- that would print -- so it returns 1. > Do we also want to verify that stdout is empty in both cases? Great idea. I've revised the added tests to redirect stdout and check for empty stdout in both cases. Thanks, Nikolaus