diff mbox series

[RFC,04/20] for-each-ref: tests for new atom %(rest) added

Message ID 0102016915f49a4f-cdb13ec8-58ea-47aa-a64a-517db120961e-000000@eu-west-1.amazonses.com (mailing list archive)
State New, archived
Headers show
Series [RFC,01/20] cat-file: reuse struct ref_format | expand

Commit Message

Olga Telezhnaya Feb. 22, 2019, 4:05 p.m. UTC
Add tests for new formatting atom %(rest).
We need this atom for cat-file command.

Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
---
 t/t6300-for-each-ref.sh | 6 ++++++
 1 file changed, 6 insertions(+)


--
https://github.com/git/git/pull/568

Comments

Jeff King Feb. 28, 2019, 9:11 p.m. UTC | #1
On Fri, Feb 22, 2019 at 04:05:45PM +0000, Olga Telezhnaya wrote:

> Add tests for new formatting atom %(rest).
> We need this atom for cat-file command.

While I do normally encourage splitting up commits, in this case I think
it would make sense to squash this together with patch 3. There's
nothing to say here about what %(rest) is that isn't already said in
that commit message.

That said, I'm still not sure that for-each-ref should be supporting
%(rest) at all. We should hopefully already have coverage of cat-file
using "%(rest)" (and if not, we should add some to make sure it's not
regressed by the conversion).

-Peff
Olga Telezhnaya March 1, 2019, 6:10 a.m. UTC | #2
пт, 1 мар. 2019 г. в 00:11, Jeff King <peff@peff.net>:
>
> On Fri, Feb 22, 2019 at 04:05:45PM +0000, Olga Telezhnaya wrote:
>
> > Add tests for new formatting atom %(rest).
> > We need this atom for cat-file command.
>
> While I do normally encourage splitting up commits, in this case I think
> it would make sense to squash this together with patch 3. There's
> nothing to say here about what %(rest) is that isn't already said in
> that commit message.

Agree, will squash.

>
> That said, I'm still not sure that for-each-ref should be supporting
> %(rest) at all. We should hopefully already have coverage of cat-file
> using "%(rest)" (and if not, we should add some to make sure it's not
> regressed by the conversion).

If we want to use ref-filter formatting logic in cat-file, we have to
add this atom in ref-filter. I agree that we do not need it in
ref-filter, and that's why I left %(rest) in cat-file docs (it's in
the end of the patch). But in the code, I am not sure we want to make
one more array with specific cat-file atoms (or atoms for other
command).

>
> -Peff
diff mbox series

Patch

diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 0ffd63071392e..fb361369a037c 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -322,6 +322,12 @@  test_expect_success 'exercise strftime with odd fields' '
 	test_cmp expected actual
 '
 
+test_expect_success 'Check format %(rest) gives empty output ' '
+	echo >expected &&
+	git for-each-ref --format="%(rest)" refs/heads >actual &&
+	test_cmp expected actual
+'
+
 cat >expected <<\EOF
 refs/heads/master
 refs/remotes/origin/master