Restrict ref-like names immediately below $GIT_DIR
commit2f6af3820eb61f30cf102b345d35028047300b74
authorJunio C Hamano <gitster@pobox.com>
Wed, 12 Oct 2011 17:39:01 +0000 (12 10:39 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Oct 2011 22:28:20 +0000 (12 15:28 -0700)
tree556b8bef487583a2206c2e601bd31cd6bf385e67
parentff74f7f1187cbf1b46e85ed1bde1f194991f919c
Restrict ref-like names immediately below $GIT_DIR

We have always dwimmed the user input $string into a ref by first looking
directly inside $GIT_DIR, and then in $GIT_DIR/refs, $GIT_DIR/refs/tags,
etc., and that is what made

    git log HEAD..MERGE_HEAD

work correctly. This however means that

    git rev-parse config
    git log index

would look at $GIT_DIR/config and $GIT_DIR/index and see if they are valid
refs.

To reduce confusion, let's not dwim a path immediately below $GIT_DIR that
is not all-caps.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
refs.c