On 10/01/2024 16:35, Ghanshyam Thakkar wrote:
I don't have much to add to what Junio said, I've just left one comment
below
+test_expect_success '--only excludes staged changes' '
+ echo content >file &&
+ echo content >baz &&
+ git add baz &&
+ git commit --only -m "file" file &&
+
+ git diff --name-only >actual &&
+ test_must_be_empty actual &&
+ git diff --name-only --staged >actual &&
+ test_grep "baz" actual
using test_grep feels a bit weak here, I think it would be better to use
test_cmp to ensure that there are no other staged changes.
Best Wishes
Phillip