git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Petr Baudis <pasky@ucw.cz>
Cc: git@vger.kernel.org
Subject: Re: [script] ge: export commits as patches
Date: Tue, 19 Apr 2005 20:56:07 +0200	[thread overview]
Message-ID: <20050419185607.GA26756@elte.hu> (raw)
In-Reply-To: <20050419170320.GG12757@pasky.ji.cz>


* Petr Baudis <pasky@ucw.cz> wrote:

> Dear diary, on Tue, Apr 19, 2005 at 03:48:43PM CEST, I got a letter
> where Ingo Molnar <mingo@elte.hu> told me that...
> > is there any 'export commit as patch' support in git-pasky? I didnt find 
> > any such command (maybe it got added meanwhile), so i'm using the 'ge' 
> > hack below.
> > 
> > e.g. i typically look at commits via 'git log', and then when i see 
> > something interesting, i look at the commit via the 'ge' script. E.g.  
> > "ge 834f6209b22af2941a8640f1e32b0f123c833061" done in the kernel tree 
> > will output a particular commit's header and the patch.
> 
> Nice idea. I will add it, probably as 'git patch'.
> 
> > TREE1=$(cat-file commit 2>/dev/null $1 | head -4 | grep ^tree | cut -d' ' -f2)
> > if [ "$TREE1" = "" ]; then echo 'ge <commit-ID>'; exit -1; fi
> > PARENT=$(cat-file commit 2>/dev/null $1 | head -4 | grep ^parent | cut -d' ' -f2)
> > if [ "$PARENT" = "" ]; then echo 'ge <commit-ID>'; exit -1; fi
> > TREE2=$(cat-file commit 2>/dev/null $PARENT | head -4 | grep ^tree | cut -d' ' -f2)
> > if [ "$TREE2" = "" ]; then echo 'ge <commit-ID>'; exit -1; fi
> 
> commit-id and parent-id tools might be useful. ;-)

find a cleaned up 'ge' script below.

and please fix gitXnormid.sh to simply echo nothing and return with a -1 
exit value when a nonsensical ID is passed to it. Right now the output 
is quite ugly if you do 'ge blah'.

	Ingo

#!/bin/bash

usage ()
{
 echo 'usage: ge <commit-ID>'
 exit -1
}

if [ $# != 1 ]; then
 usage
fi

ME=    $(commit-id $1);      [ "$ME"     = "" ] && usage
PARENT=$(parent-id $ME);     [ "$PARENT" = "" ] && usage
TREE1= $(tree-id   $ME);     [ "$TREE1"  = "" ] && usage
TREE2= $(tree-id   $PARENT); [ "$TREE2"  = "" ] && usage

cat-file commit $ME
echo
git diff -r $TREE2:$TREE1


  reply	other threads:[~2005-04-19 18:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-19 13:48 [script] ge: export commits as patches Ingo Molnar
2005-04-19 17:03 ` Petr Baudis
2005-04-19 18:56   ` Ingo Molnar [this message]
2005-04-19 19:41     ` Petr Baudis
2005-04-20  2:34       ` David A. Wheeler
2005-04-19 19:11   ` Greg KH
2005-04-19 22:56   ` David A. Wheeler
2005-04-20 17:21 ` Zlatko Calusic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050419185607.GA26756@elte.hu \
    --to=mingo@elte.hu \
    --cc=git@vger.kernel.org \
    --cc=pasky@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).