<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <link>http://persumi.com/u/fredwu/tech/e/blog/t/diff</link>
    <generator>Persumi - Level up your writing and blogging with AI</generator>
    <category>Blog</category>
    <category>Tech</category>
    <pubDate>Fri, 01 May 2026 16:37:20 +0000</pubDate>
    <description/>
    <title>Blog (diff) - Fred Wu&apos;s Tech</title>
    <atom:link type="application/rss+xml" rel="self" href="http://persumi.com/u/fredwu/tech/e/blog/t/diff/feed/rss"></atom:link>
    <item>
      <pubDate>Tue, 13 Nov 2012 07:34:00 +0000</pubDate>
      <guid>http://persumi.com/u/fredwu/tech/e/blog/p/simplecov-test-coverage-for-changed-files-only</guid>
      <comments>http://persumi.com/u/fredwu/tech/e/blog/p/simplecov-test-coverage-for-changed-files-only</comments>
      <category>Blog</category>
      <category>Tech</category>
      <author>ifredwu@gmail.com (Fred Wu)</author>
      <description>&lt;![CDATA[&lt;p&gt;
The other day a colleague asked whether or not it’s possible to have &lt;a href=&quot;https://github.com/colszowka/simplecov&quot;&gt;SimpleCov&lt;/a&gt; return a group that only contains uncommitted changes.&lt;/p&gt;
&lt;p&gt;
The answer is &lt;strong&gt;yes&lt;/strong&gt;! After some digging around, we found the following way:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;ruby language-ruby&quot;&gt;# in spec_helper.rb
SimpleCov.start &apos;rails&apos; do
  add_group &apos;Changed&apos; do |source_file|
    `git ls-files --exclude-standard --others \
      &amp;&amp; git diff --name-only \
      &amp;&amp; git diff --name-only --cached`.split(&quot;\n&quot;).detect do |filename|
      source_file.filename.ends_with?(filename)
    end
  end
end&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;
Basically use &lt;code class=&quot;inline&quot;&gt;git ls-files --exclude-standard --others&lt;/code&gt; for untracked files, &lt;code class=&quot;inline&quot;&gt;git diff --name-only&lt;/code&gt; for unstaged files and &lt;code class=&quot;inline&quot;&gt;git diff --name-only --cached&lt;/code&gt; for staged files.&lt;/p&gt;
]]&gt;</description>
      <link>http://persumi.com/u/fredwu/tech/e/blog/p/simplecov-test-coverage-for-changed-files-only</link>
      <title>SimpleCov: Test Coverage for Changed Files Only</title>
    </item>
  </channel>
</rss>