Re: [PATCHv4 04/15] t4002 (diff-basic): use test_might_fail for commands that might fail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Elijah Newren wrote:

> --- a/t/t4002-diff-basic.sh
> +++ b/t/t4002-diff-basic.sh
> @@ -205,8 +205,8 @@ test_expect_success \
>      'rm -fr Z [A-Z][A-Z] &&
>       git read-tree $tree_A &&
>       git checkout-index -f -a &&
> -     git read-tree --reset $tree_O || return 1
> -     git update-index --refresh >/dev/null ;# this can exit non-zero
> +     git read-tree --reset $tree_O &&
> +     test_might_fail git update-index --refresh >/dev/null &&
>       git diff-files >.test-a &&

Makes sense; thanks.  But aren't we actually guaranteed that it will
fail, since the index does not match the work tree?

Meanwhile, what was the point of refreshing the index like this?
I would guess it was to make sure that files that match the work tree
are marked as matching, but if so, this is not guaranteed if
update-index --refresh exits early.  Adding -q would fix that.

Why redirect to /dev/null?  I would think the extra output would
be useful while debugging with -v.
---
diff --git a/t/t4002-diff-basic.sh b/t/t4002-diff-basic.sh
index 340aa7d..9fb8ca0 100755
--- a/t/t4002-diff-basic.sh
+++ b/t/t4002-diff-basic.sh
@@ -206,7 +206,7 @@ test_expect_success \
      git read-tree $tree_A &&
      git checkout-index -f -a &&
      git read-tree --reset $tree_O &&
-     test_might_fail git update-index --refresh >/dev/null &&
+     test_must_fail git update-index --refresh -q &&
      git diff-files >.test-a &&
      cmp_diff_files_output .test-a .test-recursive-OA'
 
@@ -216,7 +216,7 @@ test_expect_success \
      git read-tree $tree_B &&
      git checkout-index -f -a &&
      git read-tree --reset $tree_O &&
-     test_might_fail git update-index --refresh >/dev/null &&
+     test_must_fail git update-index --refresh -q &&
      git diff-files >.test-a &&
      cmp_diff_files_output .test-a .test-recursive-OB'
 
@@ -226,7 +226,7 @@ test_expect_success \
      git read-tree $tree_B &&
      git checkout-index -f -a &&
      git read-tree --reset $tree_A &&
-     test_might_fail git update-index --refresh >/dev/null &&
+     test_must_fail git update-index --refresh -q &&
      git diff-files >.test-a &&
      cmp_diff_files_output .test-a .test-recursive-AB'
 
-- 
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]