#!/usr/bin/env perl

# For issue390: darcs whatsnew somefile" lstats every file in the working copy and pristine/ directory

use lib 'lib/perl', '../tests/lib/perl';
use Test::More 'no_plan';
use Shell::Command;
use Test::Darcs;
use Shell::Command;
use File::Slurp;
use strict;
use warnings;

init_tmp_repo();

touch "file1" ;
touch "file2";
darcs "add file1 file2";
darcs 'record -am "test"';

SKIP: {
  my $file = `which strace`;
  chomp $file; 
  skip "strace not found", 2 unless (-x $file);

  # Expect the following to produce no output:
  my $out = `strace "$DARCS" whatsnew file1 2>&1`;
  like($out, qr/file1/, "A whatsnew for file1 should involve a stat call to file1");
  unlike($out, qr/file2/, "A whatsnew for file1 should not involve a 'stat' call to file2");
}
