CINXE.COM
LKML: Linus Torvalds: more git updates..
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>LKML: Linus Torvalds: more git updates..</title><link href="/css/message.css" rel="stylesheet" type="text/css" /><link href="/css/wrap.css" rel="alternate stylesheet" type="text/css" title="wrap" /><link href="/css/nowrap.css" rel="stylesheet" type="text/css" title="nowrap" /><link href="/favicon.ico" rel="shortcut icon" /><script src="/js/simple-calendar.js" type="text/javascript"></script><script src="/js/styleswitcher.js" type="text/javascript"></script><link rel="alternate" type="application/rss+xml" title="lkml.org : last 100 messages" href="/rss.php" /><link rel="alternate" type="application/rss+xml" title="lkml.org : last messages by Linus Torvalds" href="/groupie.php?aid=1" /><!--Matomo--><script> var _paq = window._paq = window._paq || []; /* tracker methods like "setCustomDimension" should be called before "trackPageView" */ _paq.push(["setDoNotTrack", true]); _paq.push(["disableCookies"]); _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//m.lkml.org/"; _paq.push(['setTrackerUrl', u+'matomo.php']); _paq.push(['setSiteId', '1']); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s); })(); </script><!--End Matomo Code--></head><body onload="es.jasper.simpleCalendar.init();" itemscope="itemscope" itemtype="http://schema.org/BlogPosting"><table border="0" cellpadding="0" cellspacing="0"><tr><td width="180" align="center"><a href="/"><img style="border:0;width:135px;height:32px" src="/images/toprowlk.gif" alt="lkml.org" /></a></td><td width="32">聽</td><td class="nb"><div><a class="nb" href="/lkml"> [lkml]</a> 聽 <a class="nb" href="/lkml/2005"> [2005]</a> 聽 <a class="nb" href="/lkml/2005/4"> [Apr]</a> 聽 <a class="nb" href="/lkml/2005/4/9"> [9]</a> 聽 <a class="nb" href="/lkml/last100"> [last100]</a> 聽 <a href="/rss.php"><img src="/images/rss-or.gif" border="0" alt="RSS Feed" /></a></div><div>Views: <a href="#" class="nowrap" onclick="setActiveStyleSheet('wrap');return false;">[wrap]</a><a href="#" class="wrap" onclick="setActiveStyleSheet('nowrap');return false;">[no wrap]</a> 聽 <a class="nb" href="/lkml/mheaders/2005/4/9/103" onclick="this.href='/lkml/headers'+'/2005/4/9/103';">[headers]</a>聽 <a href="/lkml/bounce/2005/4/9/103">[forward]</a>聽 </div></td><td width="32">聽</td></tr><tr><td valign="top"><div class="es-jasper-simpleCalendar" baseurl="/lkml/"></div><div class="threadlist">Messages in this thread</div><ul class="threadlist"><li class="root"><a href="/lkml/2005/4/9/103">First message in thread</a></li><li class="origin"><a href="/lkml/2005/4/9/104">Linus Torvalds</a><ul><li><a href="/lkml/2005/4/9/104">Linus Torvalds</a></li><li><a href="/lkml/2005/4/9/105">Petr Baudis</a><ul><li><a href="/lkml/2005/4/9/109">Linus Torvalds</a><ul><li><a href="/lkml/2005/4/9/110">Linus Torvalds</a><ul><li><a href="/lkml/2005/4/9/136">Linus Torvalds</a></li></ul></li><li><a href="/lkml/2005/4/9/150">Paul Jackson</a><ul><li><a href="/lkml/2005/4/9/152">Paul Jackson</a></li></ul></li><li><a href="/lkml/2005/4/9/151">Paul Jackson</a></li><li><a href="/lkml/2005/4/10/8">Junio C Hamano</a><ul><li><a href="/lkml/2005/4/10/13">Christopher Li</a></li><li><a href="/lkml/2005/4/10/37">Rutger Nijlunsing</a></li><li><a href="/lkml/2005/4/10/70">Linus Torvalds</a></li></ul></li><li><a href="/lkml/2005/4/10/44"> tony.luck@intel ...</a><ul><li><a href="/lkml/2005/4/10/71">Linus Torvalds</a></li><li><a href="/lkml/2005/4/10/103">Paul Jackson</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2005/4/9/114">Paul Jackson</a></li><li><a href="/lkml/2005/4/9/134">Ralph Corderoy</a><ul><li><a href="/lkml/2005/4/9/143">Paul Jackson</a><ul><li><a href="/lkml/2005/4/9/145">Bernd Eckenfels</a><ul><li><a href="/lkml/2005/4/9/146">Paul Jackson</a></li></ul></li><li><a href="/lkml/2005/4/10/29">Ralph Corderoy</a><ul><li><a href="/lkml/2005/4/10/83">Paul Jackson</a></li></ul></li></ul></li></ul></li><li><a href="/lkml/2005/4/10/82">Rik van Riel</a><ul><li><a href="/lkml/2005/4/10/85">Ingo Molnar</a></li></ul></li><li><a href="/lkml/2005/4/11/154"> ross@lug ...</a></li></ul></li></ul></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerl.gif" width="32" height="32" alt="/" /></td><td class="c" rowspan="2" valign="top" style="padding-top: 1em"><table><tr><td><table><tr><td class="lp">Date</td><td class="rp" itemprop="datePublished">Sat, 9 Apr 2005 12:45:52 -0700 (PDT)</td></tr><tr><td class="lp">From</td><td class="rp" itemprop="author">Linus Torvalds <></td></tr><tr><td class="lp">Subject</td><td class="rp" itemprop="name">more git updates..</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody"><br />Sorry guys,<br /> several of you have sent me small fixes and scripts to "git", but I've <br />been busy on breaking/changing the core infrastructure, so I didn't get <br />around to looking at the scripts yet.<br /><br />The good news is, the data structures/indexes haven't changed, but many of <br />the tools to interface with them have new (and improved!) semantics:<br /><br />In particular, I changed how "read-tree" works, so that it now mirrors<br />"write-tree", in that instead of actually changing the working directory,<br />it only updates the index file (aka "current directory cache" file from<br />the tree).<br /><br />To actually change the working directory, you'd first get the index file<br />setup, and then you do a "checkout-cache -a" to update the files in your<br />working directory with the files from the sha1 database.<br /><br />Also, I wrote the "diff-tree" thing I talked about: <br /><br /> torvalds@ppc970:~/git> ./diff-tree 8fd07d4b7778cd0233ea0a17acd3fe9d710af035 8c6d29d6a496d12f1c224db945c0c56fd60ce941 | tr '\0' '\n'<br /> <100664 4870bcf91f8666fc788b07578fb7473eda795587 Makefile<br /> >100664 5493a649bb33b9264e8ed26cc1f832989a307d3b Makefile<br /> <100664 9e1bee21e17c134a2fb008db62679048fc819528 cache.h<br /> >100664 56ef561e590fd99e938bd47fd1f2c7ed46126ff0 cache.h<br /> <100664 fd690acc02ef9c06d7c4c3541f69b10ca4b4f8c9 cat-file.c<br /> >100664 6e6d89291ced17a406e64b97fe8bb96a22eefc9d cat-file.c<br /> +100664 fd00e5603dcc4a93acceda0b8cb914fabc8645d5 checkout-cache.c<br /> <100664 a4a8c3d9ef0c4cc6c82b96b5d1a91ac6d3bed466 commit-tree.c<br /> >100664 236ceb7646e3f5d110fd83f815b82e94cc5b2927 commit-tree.c<br /> +100664 01c92f2620a8e13e7cb7fd98ee644c6b65eeccb7 fsck-cache.c<br /> <100664 0eaa053919e0cc400ab9bc40d9272360117e6978 init-db.c<br /> >100664 815743e92dad7e451c65bab01448ee8ae9deeb56 init-db.c<br /> <100664 e7bfaadd5d2331123663a8f14a26604a3cdcb678 read-cache.c<br /> >100664 71d0cb6fe9b7ff79e3b2c5a61e288ac9f62b39dc read-cache.c<br /> <100664 ec0f167a6a505659e5af6911c97f465506534c34 read-tree.c<br /> >100664 f5c50ba79d02f002b9675fd8f129fa388e3282c6 read-tree.c<br /> <100664 00a29c403e751c2a2a61eb24fa2249c8956d1c80 show-diff.c<br /> >100664 b963dd738989bc92bf02352bbedad13a74e66a7d show-diff.c<br /> <100664 aff074c63ac827801a7d02ff92781365957f1430 update-cache.c<br /> >100664 3a672397164d5ff27a19a6888b578af96824ede7 update-cache.c<br /> <100664 7abeeba116b2b251c12ae32c7b38cb048199b574 write-tree.c<br /> >100664 9525c6fc975888a394477339db86216cd5bd5d7c write-tree.c<br /><br />(ie the output of "diff-tree" has the same NUL-termination, but if you <br />insist on getting ASCII output, you can just use "tr" to change the NUL <br />into a NL).<br /><br />The format of the "diff-tree" output is that the first character is "-" <br />for "remove file", "+" for "add file" and "<"/">" for "change file" (where<br />the "<" shows the old state, and ">" shows the new state).<br /><br />Btw, the NUL-termination makes this really easy to use even in shell<br />scripts, ie you can do<br /><br /> diff-tree <sha1> <sha1> | xargs -0 do_something<br /><br />and you'll get each line as one nice argument to your "do_something" <br />script. So a do_diff could be based on something like<br /><br /> #!/bin/sh<br /> while [ "$1" != "" ]; do<br /> filename="$(echo $1 | cut -d' ' -f3-)"<br /> first_sha="$(echo $1 | cut -d' ' -f2)"<br /> second_sha="$(echo $2 | cut -d' ' -f2)"<br /> c="$(echo $1 | cut -c1)"<br /> case "$c" in<br /> "+")<br /> echo diff -u /dev/null "$filename($first_sha)";;<br /> "-")<br /> echo diff -u "$filename($first_sha)" /dev/null;;<br /> "<")<br /> echo diff -u "$filename($first_sha)" "$filename($second_sha)"<br /> shift;;<br /> *)<br /> echo WHAT?<br /> exit 1;;<br /> esac<br /> shift<br /> done<br /><br />which really shows what a horrid shell-person I am (I still use the old <br />tools I learnt to use fifteen years ago. I bet you can do it trivially in <br />perl or something sane, and I'm just stuck in the stone age of UNIX).<br /><br />That makes it _very_ easy to parse. The example above is the diff between <br />the initial commit and one of the more recent trees, so it has changes to <br />everything, but a more normal thing would be<br /><br /> torvalds@ppc970:~/git> diff-tree 787763499dc4f8cc345bc6ed8ee1e0ae31adedd6 5b0c2695634b5bab2f5d63c7bb30f7e5815af470 | tr '\0' '\n'<br /> <100664 01c92f2620a8e13e7cb7fd98ee644c6b65eeccb7 fsck-cache.c<br /> >100664 81aa7bee003264ea302db835158e725eefa4012d fsck-cache.c<br /><br />which tells you that the last commit changed just one file (it's from this <br />one:<br /><br /> torvalds@ppc970:~/git> cat-file commit `cat .dircache/HEAD`<br /> tree 5b0c2695634b5bab2f5d63c7bb30f7e5815af470<br /> parent 81c53a1d3551f358860731481bb2d87179d221e6<br /> author Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005<br /> committer Linus Torvalds <torvalds@ppc970.osdl.org> Sat Apr 9 12:02:30 2005<br /> <br /> Make "fsck-cache" print out all the root commits it finds.<br /> <br /> Once I do the reference tracking, I'll also make it print out all the<br /> HEAD commits it finds, which is even more interesting.<br /><br />in case you care).<br /><br />I've rsync'ed the new git repository to kernel.org, it should all be there<br />in /pub/linux/kernel/people/torvalds/git.git/ (and it looks like the<br />mirror scripts already picked it up on the public side too).<br /><br />Can you guys re-send the scripts you wrote? They probably need some <br />updating for the new semantics. Sorry about that ;(<br /><br /> Linus<br />-<br />To unsubscribe from this list: send the line "unsubscribe linux-kernel" in<br />the body of a message to majordomo@vger.kernel.org<br />More majordomo info at <a href="http://vger.kernel.org/majordomo-info.html">http://vger.kernel.org/majordomo-info.html</a><br />Please read the FAQ at <a href="http://www.tux.org/lkml/">http://www.tux.org/lkml/</a><br /><br /></pre></td><td width="32" rowspan="2" class="c" valign="top"><img src="/images/icornerr.gif" width="32" height="32" alt="\" /></td></tr><tr><td align="right" valign="bottom"> 聽 </td></tr><tr><td align="right" valign="bottom">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerl.gif" width="32" height="32" alt="\" /></td><td class="c">聽</td><td class="c" valign="bottom" style="padding-bottom: 0px"><img src="/images/bcornerr.gif" width="32" height="32" alt="/" /></td></tr><tr><td align="right" valign="top" colspan="2"> 聽 </td><td class="lm">Last update: 2009-11-18 23:46 聽聽 [from the cache]<br />漏2003-2020 <a href="http://blog.jasper.es/"><span itemprop="editor">Jasper Spaans</span></a>|hosted at <a href="https://www.digitalocean.com/?refcode=9a8e99d24cf9">Digital Ocean</a> and my Meterkast|<a href="http://blog.jasper.es/categories.html#lkml-ref">Read the blog</a></td><td>聽</td></tr></table><script language="javascript" src="/js/styleswitcher.js" type="text/javascript"></script></body></html>