]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/name-rev.c
name-rev: extend --refs to accept multiple patterns
authorJacob Keller <jacob.keller@gmail.com>
Wed, 18 Jan 2017 23:06:05 +0000 (15:06 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 24 Jan 2017 02:33:17 +0000 (18:33 -0800)
commit290be6674a4c89594105faa19061523e7380d586
treed94004e4b7b6c4a1e6d6700b6549c52b8d6c4e85
parent4a68748893e62d66ebab1591f6da91eeb18d08e9
name-rev: extend --refs to accept multiple patterns

Teach git name-rev to take multiple --refs stored as a string list of
patterns. The list of patterns will be matched inclusively, and each ref
only needs to match one pattern to be included. A ref will only be
excluded if it does not match any of the given patterns. Additionally,
if any of the patterns would allow abbreviation, then we will abbreviate
the ref, even if another pattern is more strict and would not have
allowed abbreviation on its own.

Add tests and documentation for this change. The tests expected output
is dynamically generated.  This is in order to avoid hard-coding
a commit object name in the test results (as the expected output is to
simply leave the commit object unnamed).

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-name-rev.txt
builtin/name-rev.c
t/t6007-rev-list-cherry-pick-file.sh