Message ID | 20200116203622.4694-3-shouryashukla.oo@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | t6025: updating tests | expand |
Shourya Shukla <shouryashukla.oo@gmail.com> writes: > - echo "120000 $l symlink" | > - git update-index --index-info && > + echo "120000 $l symlink" >foo && > + git update-index --index-info <foo && If we had "git" on the left-hand-side (i.e. upstream) of a pipe, it would make sense to split the pipeline like this, but this (and the other one this patch touches) is on the right side, whose exit status is not lost. And we are not in the business of preparing for broken implementation of "echo". So this rewrite is unnecessary and unwarranted. By the way, I think the pipeline echo ... | git update-index --index-info && should be written on a single line in the previous step 1/3. > git commit -m master && > git checkout b-symlink && > l=$(printf file-different | git hash-object -t blob -w --stdin) && > - echo "120000 $l symlink" | > - git update-index --index-info && > + echo "120000 $l symlink" >foo && > + git update-index --index-info <foo && > git commit -m b-symlink && > git checkout b-file && > echo plain-file >symlink &&
diff --git a/t/t6025-merge-symlinks.sh b/t/t6025-merge-symlinks.sh index b9219af659..41bae56ea9 100755 --- a/t/t6025-merge-symlinks.sh +++ b/t/t6025-merge-symlinks.sh @@ -18,13 +18,13 @@ test_expect_success 'setup' ' git branch b-symlink && git branch b-file && l=$(printf file | git hash-object -t blob -w --stdin) && - echo "120000 $l symlink" | - git update-index --index-info && + echo "120000 $l symlink" >foo && + git update-index --index-info <foo && git commit -m master && git checkout b-symlink && l=$(printf file-different | git hash-object -t blob -w --stdin) && - echo "120000 $l symlink" | - git update-index --index-info && + echo "120000 $l symlink" >foo && + git update-index --index-info <foo && git commit -m b-symlink && git checkout b-file && echo plain-file >symlink &&
The exit code of pipes(|) are always ignored, which will create errors in subsequent statements. Let's handle it by redirecting its output to a file and capturing return values. Replace pipe with redirect(>) operator. Signed-off-by: Shourya Shukla <shouryashukla.oo@gmail.com> --- t/t6025-merge-symlinks.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)