<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>「di」タグの記事一覧 - 工夫と趣向と分別と。</title>
	<atom:link href="https://d.akinori.org/tag/di/feed/" rel="self" type="application/rss+xml" />
	<link>https://d.akinori.org/tag/di/</link>
	<description>おもしろく生きたいね</description>
	<lastBuildDate>Wed, 17 Mar 2010 03:48:06 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.5.2</generator>
<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="https://pubsubhubbub.superfeedr.com"/><atom:link rel="hub" href="https://websubhub.com/hub"/>	<item>
		<title>GNU diff(1)のラッパー「di」</title>
		<link>https://d.akinori.org/2010/03/11/gnu-diff1%e3%81%ae%e3%83%a9%e3%83%83%e3%83%91%e3%83%bc%e3%80%8cdi%e3%80%8d/</link>
					<comments>https://d.akinori.org/2010/03/11/gnu-diff1%e3%81%ae%e3%83%a9%e3%83%83%e3%83%91%e3%83%bc%e3%80%8cdi%e3%80%8d/#comments</comments>
		
		<dc:creator><![CDATA[Akinori]]></dc:creator>
		<pubDate>Wed, 10 Mar 2010 16:57:25 +0000</pubDate>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[di]]></category>
		<category><![CDATA[Ruby]]></category>
		<guid isPermaLink="false">http://d.akinori.org/?p=2569</guid>

					<description><![CDATA[<p>WEB+DB PRESS Vol.46で取り上げたGNU diff(1)のラッパー、「di」をGitHubに置いた。GNU diffには多彩なオプションが用意されているが、POSIXなどの規格の縛りもありデフォルト設定が… <span class="read-more"><a href="https://d.akinori.org/2010/03/11/gnu-diff1%e3%81%ae%e3%83%a9%e3%83%83%e3%83%91%e3%83%bc%e3%80%8cdi%e3%80%8d/">続きを読む &#187;</a></span></p>
<p>The post <a href="https://d.akinori.org/2010/03/11/gnu-diff1%e3%81%ae%e3%83%a9%e3%83%83%e3%83%91%e3%83%bc%e3%80%8cdi%e3%80%8d/">GNU diff(1)のラッパー「di」</a> appeared first on <a href="https://d.akinori.org">工夫と趣向と分別と。</a>.</p>
<div class='yarpp yarpp-related yarpp-related-rss yarpp-template-yarpp-template-akinori'>
<!-- YARPP List -->

» 関連記事 «<ul>
<li><a href="https://d.akinori.org/2004/04/19/20040419p04/" rel="bookmark" title="CVSからSubversionへの移行">CVSからSubversionへの移行</a></li>
<li><a href="https://d.akinori.org/2004/04/07/20040407p01/" rel="bookmark" title="inplace(1)を作った">inplace(1)を作った</a></li>
<li><a href="https://d.akinori.org/2006/08/02/20060802p01/" rel="bookmark" title="inplace 1.1.0リリース">inplace 1.1.0リリース</a></li>
</ul>
</div>
]]></description>
										<content:encoded><![CDATA[<p><a title="Amazon で商品の詳細を確認する" href="http://www.amazon.co.jp/WEB-DB-PRESS-Vol-46-PRESS%E7%B7%A8%E9%9B%86%E9%83%A8/dp/4774135607%3FSubscriptionId%3DAKIAJLTKVIIMNRZSEZHA%26tag%3Damusha-22%26linkCode%3Dxm2%26camp%3D2025%26creative%3D165953%26creativeASIN%3D4774135607"><img decoding="async" src="http://ecx.images-amazon.com/images/I/51c6BhzAacL._SL160_.jpg" alt="WEB+DB PRESS Vol.46" width="113" height="160" class="alignright" /></a><a href="http://gihyo.jp/magazine/wdpress/archive/2008/vol46">WEB+DB PRESS Vol.46</a>で取り上げた<a href="http://www.gnu.org/software/diffutils/">GNU diff(1)</a>のラッパー、「di」を<a href="http://github.com/knu/di">GitHubに置いた</a>。GNU diffには多彩なオプションが用意されているが、POSIXなどの規格の縛りもありデフォルト設定が日常利用には不便なものになっている。いちいち<code>diff -Nrpu dir1 dir2</code>なんて面倒くさい。以下の特長を持つラッパーdiで楽をしよう。</p>
<ul>
<li><code>-U3 -N -p -d</code>がデフォルト。</li>
<li>出力が色付き。ページャが起動される。（Gitのまね）</li>
<li>バックアップファイルやオブジェクトファイル、<code>.git</code>, <code>.hg</code>, <code>.svn</code>, <code>CVS</code>などのディレクトリを無視する。</li>
<li>RCS/CVSキーワードタグの違いを無視する。</li>
<li>ディレクトリを与えれば自動で再帰比較。</li>
<li>上記を含むデフォルトのオプション設定は環境変数で変更可能。</li>
<li>GNU diffがサポートしないオプションの組み合わせもサポート。</li>
</ul>
<p>「<code>alias di="diff -ru"</code>でいいんじゃないの？」という人は、理不尽におこられた経験がないのかもしれない。context diffがほしくなって<code>di -c FILE1 FILE2</code>とすると、展開されてこうなる。</p><pre class="urvanov-syntax-highlighter-plain-tag">% diff -ru -c FILE1 FILE2
diff: conflicting output style options
diff: Try `diff --help' for more information.</pre><p>黙って後から指定した方を採用してくれればいいのに、まったく余計なお世話だ。（FreeBSDでは<a href="http://www.freebsd.org/cgi/cvsweb.cgi/src/gnu/usr.bin/diff/diff.c.diff?rev=1.1;content-type=text%2Fx-cvsweb-markup">このエラーは抑止</a>されている）<br />
そして、<code>diff FILE1 DIR</code>は動くのになぜか<code>diff FILE1 FILE2 DIR</code>はエラーになるのも不便だ。</p><pre class="urvanov-syntax-highlighter-plain-tag">% diff FILE1 FILE2 DIR
diff: extra operand `DIR'
diff: Try `diff --help' for more information.</pre><p>diだとちゃんと動く。ほかにも、<code><a href="http://jarp.does.notwork.org/diary/201003a.html#201003081">-r</a></code><a href="http://jarp.does.notwork.org/diary/201003a.html#201003081">と</a><code><a href="http://jarp.does.notwork.org/diary/201003a.html#201003081">-D NAME</a></code><a href="http://jarp.does.notwork.org/diary/201003a.html#201003081">が組み合わせられない問題</a>も自力でディレクトリを辿ることで回避している。<br />
インストールは、単に<code>bin/di</code>をパスの通ったところに置くか、または<code>gem install di</code>でOK。動作にはRubyが必要。<br />
弱点は大きなツリーの比較が遅いこと。GNU diffは<code>-x/--exclude</code>を使ってもファイル名でしか除外できず、二つのファイルリストを渡して比較するということもサポートしていないため、自力でディレクトリ探索を行う場合はディレクトリごとに<code>diff(1)</code>を複数回起動しなければならない。しかし、並列起動で高速化する余地はあるので今後の課題。<br />
もう一つ、<code>--ignore-file-name-case</code>をサポートしていないが、これは面倒な割には使いたいと思ったことがないため。それだけなので、気が向けば実装するかも。あるいは切実にほしいあなたが実装するかも。</p>
<p>The post <a href="https://d.akinori.org/2010/03/11/gnu-diff1%e3%81%ae%e3%83%a9%e3%83%83%e3%83%91%e3%83%bc%e3%80%8cdi%e3%80%8d/">GNU diff(1)のラッパー「di」</a> appeared first on <a href="https://d.akinori.org">工夫と趣向と分別と。</a>.</p>
<div class='yarpp yarpp-related yarpp-related-rss yarpp-template-yarpp-template-akinori'>
<!-- YARPP List -->
<p>» 関連記事 «</p><ul>
<li><a href="https://d.akinori.org/2004/04/19/20040419p04/" rel="bookmark" title="CVSからSubversionへの移行">CVSからSubversionへの移行</a></li>
<li><a href="https://d.akinori.org/2004/04/07/20040407p01/" rel="bookmark" title="inplace(1)を作った">inplace(1)を作った</a></li>
<li><a href="https://d.akinori.org/2006/08/02/20060802p01/" rel="bookmark" title="inplace 1.1.0リリース">inplace 1.1.0リリース</a></li>
</ul>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://d.akinori.org/2010/03/11/gnu-diff1%e3%81%ae%e3%83%a9%e3%83%83%e3%83%91%e3%83%bc%e3%80%8cdi%e3%80%8d/feed/</wfw:commentRss>
			<slash:comments>355</slash:comments>
		
		
			</item>
	</channel>
</rss>
