Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDerrick Stolee <derrickstolee@github.com>2022-08-05 20:58:33 +0300
committerJunio C Hamano <gitster@pobox.com>2022-08-06 00:13:11 +0300
commitb877e617e6e582553e21055deb272ce3a1354e1a (patch)
tree155c9631cd264a9861e043c0181864c237ccaa9d /t/t4202-log.sh
parentbbea4dcf42b28eb7ce64a6306cdde875ae5d09ca (diff)
refs: allow "HEAD" as decoration filter
The normalize_glob_ref() method was introduced in 65516f586b693 (log: add option to choose which refs to decorate, 2017-11-21) to help with decoration filters such as --decorate-refs=<filter> and --decorate-refs-exclude=<filter>. The method has not been used anywhere else. At the moment, it is impossible to specify HEAD as a decoration filter since normalize_glob_ref() prepends "refs/" to the filter if it isn't already there. Allow adding HEAD as a decoration filter by allowing the exact string "HEAD" to not be prepended with "refs/". Add a test in t4202-log.sh that would previously fail since the HEAD decoration would exist in the output. It is sufficient to only cover "HEAD" here and not include other special refs like REBASE_HEAD. This is because HEAD is the only ref outside of refs/* that is added to the list of decorations. However, we may want to special-case these other refs in normalize_glob_ref() in the future. Leave a NEEDSWORK comment for now. Signed-off-by: Derrick Stolee <derrickstolee@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t4202-log.sh')
-rwxr-xr-xt/t4202-log.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 6e66352558..6b7d8e269f 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -1025,6 +1025,12 @@ test_expect_success 'decorate-refs and simplify-by-decoration without output' '
test_cmp expect actual
'
+test_expect_success 'decorate-refs-exclude HEAD' '
+ git log --decorate=full --oneline \
+ --decorate-refs-exclude="HEAD" >actual &&
+ ! grep HEAD actual
+'
+
test_expect_success 'log.decorate config parsing' '
git log --oneline --decorate=full >expect.full &&
git log --oneline --decorate=short >expect.short &&