CINXE.COM

LKML: Petr Baudis: [PATCH] Re: Kernel SCM saga..

<?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: Petr Baudis: [PATCH] Re: Kernel SCM saga..</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 Petr Baudis" href="/groupie.php?aid=3517" /><!--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/95" onclick="this.href='/lkml/headers'+'/2005/4/9/95';">[headers]</a>聽 <a href="/lkml/bounce/2005/4/9/95">[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/6/121">First message in thread</a></li><li><a href="/lkml/2005/4/8/341">Petr Baudis</a><ul><li><a href="/lkml/2005/4/9/19">"Randy.Dunlap"</a><ul><li class="origin"><a href="">Petr Baudis</a></li></ul></li><li><a href="/lkml/2005/4/9/144">Phillip Lougher</a><ul><li><a href="/lkml/2005/4/9/147">Petr Baudis</a><ul><li><a href="/lkml/2005/4/9/148">Phillip Lougher</a></li></ul></li></ul></li></ul></li></ul><div class="threadlist">Patch in this message</div><ul class="threadlist"><li><a href="/lkml/diff/2005/4/9/95/1">Get diff 1</a></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 20:06:13 +0200</td></tr><tr><td class="lp">From</td><td class="rp" itemprop="author">Petr Baudis &lt;&gt;</td></tr><tr><td class="lp">Subject</td><td class="rp" itemprop="name">[PATCH] Re: Kernel SCM saga..</td></tr></table></td><td></td></tr></table><pre itemprop="articleBody">Dear diary, on Sat, Apr 09, 2005 at 09:08:59AM CEST, I got a letter<br />where "Randy.Dunlap" &lt;rddunlap&#64;osdl.org&gt; told me that...<br />&gt; On Sat, 9 Apr 2005 04:53:57 +0200 Petr Baudis wrote:<br />..snip..<br />&gt; | FWIW, I made few small fixes (to prevent some trivial usage errors to<br />&gt; | cause cache corruption) and added scripts gitcommit.sh, gitadd.sh and<br />&gt; | gitlog.sh - heavily inspired by what already went through the mailing<br />&gt; | list. Everything is available at <a href="http://pasky.or.cz/~pasky/dev/git/">http://pasky.or.cz/~pasky/dev/git/</a><br />&gt; | (including .dircache, even though it isn't shown in the index), the<br />&gt; | cumulative patch can be found below. The scripts aim to provide some<br />&gt; | (obviously very interim) more high-level interface for git.<br />&gt; | <br />&gt; | I'm now working on tree-diff.c which will (surprise!) produce a diff<br />&gt; | of two trees (I'll finish it after I get some sleep, though), and then I<br />&gt; | will probably do some dwimmy gitdiff.sh wrapper for tree-diff and<br />&gt; | show-diff. At that point I might get my hand on some pull more kind to<br />&gt; | local changes.<br />&gt; <br />&gt; Hi,<br /><br /> Hi,<br /><br />&gt; I'll look at your scripts this weekend. I've also been<br />&gt; working on some, but mine are a bit more experimental (cruder)<br />&gt; than yours are. Anyway, here they are (attached) -- also<br />&gt; available at <a href="http://developer.osdl.org/rddunlap/git/">http://developer.osdl.org/rddunlap/git/</a><br />&gt; <br />&gt; gitin : checkin/commit<br />&gt; gitwhat sha1 : what is that sha1 file (type and contents if blob or commit)<br />&gt; gitlist (blob, commit, tree, or all) :<br />&gt; list all objects with type (commit, tree, blob, or all)<br /><br /> thanks - I had a look, but so far I borrowed only the prompt message<br />from your gitin. ;-) I'm not sure if gitwhat would be useful for me in<br />any way and gitlist doesn't appear too practical to me either.<br /><br /> In the meantime, I've made some progress too. I made ls-tree, which<br />will just convert the tree object to a human readable (and script<br />processable) form, and wrapper gitls.sh, which will also try to guess<br />the tree ID. parent-id will just return the commit ID(s) of the previous<br />commit(s), practical if you want to diff against the previous commit<br />easily etc. And finally, there is gitdiff.sh, which will produce a diff<br />of any two trees.<br /><br /> Everything is again available at <a href="http://pasky.or.cz/~pasky/dev/git/">http://pasky.or.cz/~pasky/dev/git/</a><br />and again including .dircache, even though it's invisible in the index.<br />The cumulative patch (against 0.03) is there as well as below, generated<br />by the<br /><br /> ./gitdiff.sh 0af20307bb4c634722af0f9203dac7b3222c4a4f<br /><br />command. The empty entries are changed modes (664 vs 644), I will yet<br />have to think about how to denote them if the content didn't change;<br />or I might ignore them altogether...?<br /><br /> You can obviously fetch any arbitrary change by doing the appropriate<br />gitdiff.sh call. You can find the ids in the ChangeLog, which was<br />generated by the plain<br /><br /> ./gitlog.sh<br /><br />command. (That is for HEAD. 0af20307bb4c634722af0f9203dac7b3222c4a4f is<br />the last commit on the Linus' branch, pass that to gitlog.sh to get his<br />ChangeLog. ;-)<br /><br /> Next, I will probably do some bk-style pull tool. Or perhaps first<br />a gitpatch.sh which will verify the sha1s and do the mode changes.<br /><br /> Linus, could you please have a look and tell me what do you think<br />about it so far?<br /><br /> Thanks,<br /><br /> Petr Baudis<br /><br />Index: Makefile<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/Makefile (mode:100664 sha1:270cd4f8a8bf10cd513b489c4aaf76c14d4504a7)<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/Makefile (mode:100644 sha1:185ff422e68984e68da011509dec116f05fc6f8d)<br />&#64;&#64; -1,7 +1,7 &#64;&#64;<br /> CFLAGS=-g -O3 -Wall<br /> CC=gcc<br /> <br />-PROG=update-cache show-diff init-db write-tree read-tree commit-tree cat-file fsck-cache<br />+PROG=update-cache show-diff init-db write-tree read-tree commit-tree cat-file fsck-cache ls-tree<br /> <br /> all: $(PROG)<br /> <br />&#64;&#64; -30,6 +30,9 &#64;&#64;<br /> cat-file: cat-file.o read-cache.o<br /> $(CC) $(CFLAGS) -o cat-file cat-file.o read-cache.o $(LIBS)<br /> <br />+ls-tree: ls-tree.o read-cache.o<br />+ $(CC) $(CFLAGS) -o ls-tree ls-tree.o read-cache.o $(LIBS)<br />+<br /> fsck-cache: fsck-cache.o read-cache.o<br /> $(CC) $(CFLAGS) -o fsck-cache fsck-cache.o read-cache.o $(LIBS)<br /> <br />Index: README<br />===================================================================<br />Index: cache.h<br />===================================================================<br />Index: cat-file.c<br />===================================================================<br />Index: commit-tree.c<br />===================================================================<br />Index: fsck-cache.c<br />===================================================================<br />Index: gitadd.sh<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/gitadd.sh<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/gitadd.sh (mode:100755 sha1:d23be758c0c9fc1cf9756bcd3ee4d7266c60a2c9)<br />&#64;&#64; -0,0 +1,13 &#64;&#64;<br />+#!/bin/sh<br />+#<br />+# Add new file to a GIT repository.<br />+# Copyright (c) Petr Baudis, 2005<br />+#<br />+# Takes a list of file names at the command line, and schedules them<br />+# for addition to the GIT repository at the next commit.<br />+#<br />+# FIXME: Those files are omitted from show-diff output!<br />+<br />+for file in "$&#64;"; do<br />+ echo $file &gt;&gt;.dircache/add-queue<br />+done<br />Index: gitcommit.sh<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/gitcommit.sh<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/gitcommit.sh (mode:100755 sha1:67a743c6cbc9dffaa6f571d3dc83ceec2bd0c039)<br />&#64;&#64; -0,0 +1,38 &#64;&#64;<br />+#!/bin/sh<br />+#<br />+# Commit into a GIT repository.<br />+# Copyright (c) Petr Baudis, 2005<br />+# Based on an example script fragment sent to LKML by Linus Torvalds.<br />+#<br />+# Ignores any parameters for now, excepts changelog entry on stdin.<br />+#<br />+# FIXME: Gets it wrong for filenames containing spaces.<br />+<br />+<br />+if [ -r .dircache/add-queue ]; then<br />+ mv .dircache/add-queue .dircache/add-queue-progress<br />+ addedfiles=$(cat .dircache/add-queue-progress)<br />+else<br />+ addedfiles=<br />+fi<br />+changedfiles=$(show-diff -s | grep -v ': ok$' | cut -d : -f 1)<br />+commitfiles="$addedfiles $changedfiles"<br />+if [ ! "$commitfiles" ]; then<br />+ echo 'Nothing to commit.' &gt;&amp;2<br />+ exit<br />+fi<br />+update-cache $commitfiles<br />+rm -f .dircache/add-queue-progress<br />+<br />+<br />+oldhead=$(cat .dircache/HEAD)<br />+treeid=$(write-tree)<br />+<br />+echo "Enter commit message, terminated by ctrl-D on a separate line:" &gt;&amp;2<br />+newhead=$(commit-tree $treeid -p $oldhead)<br />+<br />+if [ "$newhead" ]; then<br />+ echo $newhead &gt;.dircache/HEAD<br />+else<br />+ echo "Error during commit (oldhead $oldhead, treeid $treeid)" &gt;&amp;2<br />+fi<br />Index: gitdiff.sh<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/gitdiff.sh<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/gitdiff.sh (mode:100755 sha1:17aec840c7c0e0b4e4e78fd94b754fe6bc2f2ff2)<br />&#64;&#64; -0,0 +1,104 &#64;&#64;<br />+#!/bin/sh<br />+#<br />+# Make a diff between two GIT trees.<br />+# Copyright (c) Petr Baudis, 2005<br />+#<br />+# Takes two parameters identifying the two trees/commits to compare.<br />+# Empty string will be substitued to HEAD revision.<br />+#<br />+# Outputs a diff converting the first tree to the second one.<br />+<br />+<br />+TREE="^tree [A-z0-9]{40}$"<br />+<br />+tree1ls=$(mktemp -t gitdiff.XXXXXX)<br />+tree2ls=$(mktemp -t gitdiff.XXXXXX)<br />+diffdir=$(mktemp -d -t gitdiff.XXXXXX)<br />+<br />+function die () {<br />+ echo gitdiff: $&#64; &gt;&amp;2<br />+ rm -f "$tree1ls" "$tree2ls"<br />+ rm -rf "$diffdir"<br />+ exit<br />+}<br />+<br />+function normalize_id () {<br />+ # XXX: This is basically a copy of gitls.sh<br />+ id=$1<br />+ if [ ! "$id" ]; then<br />+ id=$(cat .dircache/HEAD)<br />+ fi<br />+ if [ $(cat-file -t "$id") = "commit" ]; then<br />+ id=$(cat-file commit $id | egrep "$TREE" | cut -d ' ' -f 2)<br />+ fi<br />+ if [ ! $(cat-file -t "$id") = "tree" ]; then<br />+ die "Invalid ID supplied: $id"<br />+ fi<br />+ echo $id<br />+}<br />+<br />+function mkdiff () {<br />+ loc=$1; treeid=$2; fname=$3; mode=$4; sha1=$5;<br />+<br />+ if [ x"$sha1" != x"!" ]; then<br />+ cat-file blob $sha1 &gt;$loc<br />+ else<br />+ &gt;$loc<br />+ fi<br />+<br />+ label="$treeid/$fname";<br />+<br />+ labelapp=""<br />+ [ x"$mode" != x"!" ] &amp;&amp; labelapp="$labelapp mode:$mode"<br />+ [ x"$sha1" != x"!" ] &amp;&amp; labelapp="$labelapp sha1:$sha1"<br />+ labelapp=$(echo "$labelapp" | sed 's/^ *//')<br />+<br />+ [ "$labelapp" ] &amp;&amp; label="$label ($labelapp)"<br />+<br />+ echo $label<br />+}<br />+<br />+id1=$(normalize_id "$1")<br />+id2=$(normalize_id "$2")<br />+<br />+[ "$2" != "$1" ] || die "Cannot diff tree against itself."<br />+<br />+ls-tree "$id1" &gt;$tree1ls<br />+[ -s "$tree1ls" ] || die "Error retrieving the first tree."<br />+ls-tree "$id2" &gt;$tree2ls<br />+[ -s "$tree2ls" ] || die "Error retrieving the second tree."<br />+<br />+diffdir1="$diffdir/$id1"<br />+diffdir2="$diffdir/$id2"<br />+mkdir $diffdir1 $diffdir2<br />+<br />+join -e ! -a 1 -a 2 -j 4 -o 0,1.1,1.3,2.1,2.3 $tree1ls $tree2ls | {<br />+ while read line; do<br />+ name=$(echo $line | cut -d ' ' -f 1)<br />+ mode1=$(echo $line | cut -d ' ' -f 2)<br />+ sha1=$(echo $line | cut -d ' ' -f 3)<br />+ mode2=$(echo $line | cut -d ' ' -f 4)<br />+ sha2=$(echo $line | cut -d ' ' -f 5)<br />+<br />+ # XXX: The diff format is currently pretty ugly;<br />+ # ideally, we should print the sha1 and mode at the<br />+ # +++ and --- lines, but<br />+<br />+ if [ "$mode1" != "$mode2" ] || [ "$sha1" != "$sha2" ]; then<br />+ echo "Index: $name"<br />+ echo "==================================================================="<br />+<br />+ loc1="$diffdir1/$name"<br />+ loc2="$diffdir2/$name"<br />+ mkdir -p $(dirname $loc1) $(dirname $loc2)<br />+<br />+ label1=$(mkdiff "$loc1" $id1 "$name" $mode1 $sha1)<br />+ label2=$(mkdiff "$loc2" $id2 "$name" $mode2 $sha2)<br />+<br />+ diff -L "$label1" -L "$label2" -u "$loc1" "$loc2"<br />+ fi<br />+ done<br />+}<br />+<br />+rm -f "$tree1ls" "$tree2ls"<br />+rm -rf "$diffdir"<br />Index: gitlog.sh<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/gitlog.sh<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/gitlog.sh (mode:100755 sha1:e7a4eed8c0526821d00b08094c73fabb72eff4df)<br />&#64;&#64; -0,0 +1,61 &#64;&#64;<br />+#!/bin/sh<br />+####<br />+#### Call this script with an object and it will produce the change<br />+#### information for all the parents of that object<br />+####<br />+#### This script was originally written by Ross Vandegrift.<br />+# multiple parents test 1d0f4aec21e5b66c441213643426c770dc6dedc0<br />+# parents: ffa098b2e187b71b86a76d3cd5eb77d074a2503c<br />+# 6860e0d9197c7f52155466c225baf39b42d62f63<br />+<br />+# regex for parent declarations<br />+PARENTS="^parent [A-z0-9]{40}$"<br />+<br />+TMPCL="/tmp/gitlog.$$"<br />+<br />+# takes an object and generates the object's parent(s)<br />+function unpack_parents () {<br />+ echo "me $1"<br />+ echo "me $1" &gt;&gt;$TMPCL<br />+ RENTS=""<br />+<br />+ TMPCM=$(mktemp)<br />+ cat-file commit $1 &gt;$TMPCM<br />+ while read line; do<br />+ if echo "$line" | egrep -q "$PARENTS"; then<br />+ RENTS="$RENTS "$(echo $line | sed 's/parent //g')<br />+ fi<br />+ echo $line<br />+ done &lt;$TMPCM<br />+ rm $TMPCM<br />+<br />+ echo -e "\n--------------------------\n"<br />+<br />+ # if the last object had no parents, return<br />+ if [ ! "$RENTS" ]; then<br />+ return;<br />+ fi<br />+<br />+ #useful for testing<br />+ #echo $RENTS<br />+ #read<br />+ for i in `echo $RENTS`; do<br />+ # break cycles<br />+ if grep -q "me $i" $TMPCL; then<br />+ echo "Already visited $i" &gt;&amp;2<br />+ continue<br />+ else<br />+ unpack_parents $i<br />+ fi<br />+ done<br />+}<br />+<br />+base=$1<br />+if [ ! "$base" ]; then<br />+ base=$(cat .dircache/HEAD)<br />+fi<br />+<br />+rm -f $TMPCL<br />+unpack_parents $base<br />+rm -f $TMPCL<br />+<br />Index: gitls.sh<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/gitls.sh<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/gitls.sh (mode:100755 sha1:4fe78b764ac0ab3cdb16631bbfdd65edb138e47b)<br />&#64;&#64; -0,0 +1,22 &#64;&#64;<br />+#!/bin/sh<br />+#<br />+# List contents of a particular tree in a GIT repository.<br />+# Copyright (c) Petr Baudis, 2005<br />+#<br />+# Optionally takes commit or tree id as a parameter, defaulting to HEAD.<br />+<br />+TREE="^tree [A-z0-9]{40}$"<br />+<br />+id=$1<br />+if [ ! "$id" ]; then<br />+ id=$(cat .dircache/HEAD)<br />+fi<br />+if [ $(cat-file -t "$id") = "commit" ]; then<br />+ id=$(cat-file commit $id | egrep "$TREE" | cut -d ' ' -f 2)<br />+fi<br />+if [ ! $(cat-file -t "$id") = "tree" ]; then<br />+ echo "Invalid ID supplied: $id" &gt;&amp;2<br />+ exit<br />+fi<br />+<br />+ls-tree "$id"<br />Index: init-db.c<br />===================================================================<br />Index: ls-tree.c<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/ls-tree.c<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/ls-tree.c (mode:100644 sha1:ed5b82cd7f41c3ea4140fa1ee4b80b786f190151)<br />&#64;&#64; -0,0 +1,51 &#64;&#64;<br />+/*<br />+ * GIT - The information manager from hell<br />+ *<br />+ * Copyright (C) Linus Torvalds, 2005<br />+ */<br />+#include "cache.h"<br />+<br />+static int list(unsigned char *sha1)<br />+{<br />+ void *buffer;<br />+ unsigned long size;<br />+ char type[20];<br />+<br />+ buffer = read_sha1_file(sha1, type, &amp;size);<br />+ if (!buffer)<br />+ usage("unable to read sha1 file");<br />+ if (strcmp(type, "tree"))<br />+ usage("expected a 'tree' node");<br />+ while (size) {<br />+ int len = strlen(buffer)+1;<br />+ unsigned char *sha1 = buffer + len;<br />+ char *path = strchr(buffer, ' ')+1;<br />+ unsigned int mode;<br />+<br />+ if (size &lt; len + 20 || sscanf(buffer, "%o", &amp;mode) != 1)<br />+ usage("corrupt 'tree' file");<br />+ buffer = sha1 + 20;<br />+ size -= len + 20;<br />+ /* XXX: We just assume the type is "blob" as it should be.<br />+ * It seems worthless to read each file just to get this<br />+ * and the file size. -- pasky&#64;ucw.cz */<br />+ printf("%03o\t%s\t%s\t%s\n", mode, "blob", sha1_to_hex(sha1), path);<br />+ }<br />+ return 0;<br />+}<br />+<br />+int main(int argc, char **argv)<br />+{<br />+ unsigned char sha1[20];<br />+<br />+ if (argc != 2)<br />+ usage("ls-tree &lt;key&gt;");<br />+ if (get_sha1_hex(argv[1], sha1) &lt; 0)<br />+ usage("ls-tree &lt;key&gt;");<br />+ sha1_file_directory = getenv(DB_ENVIRONMENT);<br />+ if (!sha1_file_directory)<br />+ sha1_file_directory = DEFAULT_DB_ENVIRONMENT;<br />+ if (list(sha1) &lt; 0)<br />+ usage("list failed");<br />+ return 0;<br />+}<br />Index: parent-id<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/parent-id<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/parent-id (mode:100755 sha1:198c551b7367988b48aa7a69876e098d73c19e88)<br />&#64;&#64; -0,0 +1,15 &#64;&#64;<br />+#!/bin/sh<br />+#<br />+# Get ID of parent commit to a given revision or HEAD.<br />+# Copyright (c) Petr Baudis, 2005<br />+#<br />+# Takes ID of the current commit, defaults to HEAD.<br />+<br />+PARENT="^parent [A-z0-9]{40}$"<br />+<br />+id=$1<br />+if [ ! "$id" ]; then<br />+ id=$(cat .dircache/HEAD)<br />+fi<br />+<br />+cat-file commit $id | egrep "$PARENT" | cut -d ' ' -f 2<br />Index: read-cache.c<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/read-cache.c (mode:100664 sha1:e51c9ee84874b5ff0f22b11dcd4fe1f905e72a5e)<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/read-cache.c (mode:100644 sha1:3dbe6db46933683721ceafdcdd70da521a32269a)<br />&#64;&#64; -264,11 +264,12 &#64;&#64;<br /> size = 0; // avoid gcc warning<br /> map = (void *)-1;<br /> if (!fstat(fd, &amp;st)) {<br />- map = NULL;<br /> size = st.st_size;<br /> errno = EINVAL;<br /> if (size &gt; sizeof(struct cache_header))<br /> map = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);<br />+ else<br />+ return (!hdr-&gt;entries) ? 0 : error("inconsistent cache");<br /> }<br /> close(fd);<br /> if (-1 == (int)(long)map)<br />Index: read-tree.c<br />===================================================================<br />Index: show-diff.c<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/show-diff.c (mode:100664 sha1:45f6e3140b3923497fdec808aec0e86ecf358b92)<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/show-diff.c (mode:100644 sha1:9beda1382103df29914d965fc135def0e6e7e839)<br />&#64;&#64; -49,9 +49,17 &#64;&#64;<br /> <br /> int main(int argc, char **argv)<br /> {<br />+ int silent = 0;<br /> int entries = read_cache();<br /> int i;<br /> <br />+ while (argc-- &gt; 1) {<br />+ if (!strcmp(argv[1], "-s"))<br />+ silent = 1;<br />+ else if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))<br />+ usage("show-diff [-s]");<br />+ }<br />+<br /> if (entries &lt; 0) {<br /> perror("read_cache");<br /> exit(1);<br />&#64;&#64; -77,6 +85,9 &#64;&#64;<br /> for (n = 0; n &lt; 20; n++)<br /> printf("%02x", ce-&gt;sha1[n]);<br /> printf("\n");<br />+ if (silent)<br />+ continue;<br />+<br /> new = read_sha1_file(ce-&gt;sha1, type, &amp;size);<br /> show_differences(ce, &amp;st, new, size);<br /> free(new);<br />Index: update-cache.c<br />===================================================================<br />--- 6be98a9e92a3f131a3fdf0dc3a8576fba6421569/update-cache.c (mode:100664 sha1:9dcee6f628d5accaa5219f72a2e790c082d9dd9a)<br />+++ 3f6cc0ad3e076e05281438b0de69a7d6a5522d17/update-cache.c (mode:100644 sha1:916430a05a9da088dae1ea82eb8d5392033f548a)<br />&#64;&#64; -231,6 +231,9 &#64;&#64;<br /> return -1;<br /> }<br /> <br />+ if (argc &lt; 2)<br />+ usage("update-cache &lt;file&gt;*");<br />+<br /> newfd = open(".dircache/index.lock", O_RDWR | O_CREAT | O_EXCL, 0600);<br /> if (newfd &lt; 0) {<br /> perror("unable to create new cachefile");<br />Index: write-tree.c<br />===================================================================<br />-<br />To unsubscribe from this list: send the line "unsubscribe linux-kernel" in<br />the body of a message to majordomo&#64;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 /></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: 2005-04-09 20:24 聽聽 [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>

Pages: 1 2 3 4 5 6 7 8 9 10