]> git.ipfire.org Git - thirdparty/git.git/commit - ref-filter.c
ref-filter: modify the 'lstrip=<N>' option to work with negative '<N>'
authorKarthik Nayak <karthik.188@gmail.com>
Tue, 10 Jan 2017 08:49:48 +0000 (14:19 +0530)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 Jan 2017 20:38:59 +0000 (12:38 -0800)
commit1a0ca5e358c1af14160e610e346c706e5dccf535
tree1728a6743b9b837307398d392873547b3fa84d12
parent3a42980f9e5ecc2b74c538109d4007c630881f1c
ref-filter: modify the 'lstrip=<N>' option to work with negative '<N>'

Currently the 'lstrip=<N>' option only takes a positive value '<N>'
and strips '<N>' slash-separated path components from the left. Modify
the 'lstrip' option to also take a negative number '<N>' which would
strip from the left as necessary and _leave_ behind only 'N'
slash-separated path components from the right-most end.

For e.g. %(refname:lstrip=-1) would make 'foo/goo/abc' into 'abc'.

Add documentation and tests for the same.

Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-for-each-ref.txt
ref-filter.c
t/t6300-for-each-ref.sh