git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: aerosmith <parvata@rocketmail.com>
Cc: git@vger.kernel.org
Subject: Re: how to create a diff in old file new file format (for code reviews)
Date: Tue, 14 Dec 2010 10:17:13 +0100	[thread overview]
Message-ID: <4D073619.2010103@drmicha.warpmail.net> (raw)
In-Reply-To: <1292285257962-5832810.post@n2.nabble.com>

aerosmith venit, vidit, dixit 14.12.2010 01:07:
> 
> Hi,
> 
> I am trying to create a diff such that the original file (entire file) is
> saved something like file1.h.old and the new modified file as file1.h.new. I
> have read the various options for git-diff* tools but could not find one
> such utility. All I get is the removals and additions as a diff. Does anyone
> know how to create one with the help the available git utils? The only
> method that I can think of is to do everything manually. Any help w.r.t.
> this is really appreciated. Thanks in advance.

You could script around this e.g. with an external diff-helper. The
easiest way is to reuse difftool. For example,

git difftool -y -x echo <revexpression>

will give you pairs of names of temporary files for old/new, where
<revexpression> is what you would give to "git diff" to specify what to
diff.

With the patch I'm sending in a minute, the helper you specify with "-x"
can also access the basename easily, so that you could use "-x oldnew"
with a script "oldnew" containing

#!/bin/sh
cp "$1" "$BASE".old
cp "$2" "$BASE".new

Even without the patch, you could use

git difftool -y -x 'cp "$LOCAL" "$BASE".old; cp "$REMOTE" "$BASE.new";
#' <revexpression>

(all on one line) directly. But this requires insider knowledge and may
break some day.

Cheers,
Michael

  reply	other threads:[~2010-12-14  9:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-14  0:07 how to create a diff in old file new file format (for code reviews) aerosmith
2010-12-14  9:17 ` Michael J Gruber [this message]
2010-12-14  9:18   ` [PATCH 1/2] git-difftool.txt: correct the description of $BASE and describe $MERGED Michael J Gruber
2010-12-14  9:18     ` [PATCH 2/2] difftool: provide basename to external tools Michael J Gruber
2010-12-16  3:33   ` [solved] how to create a diff in old file new file format (for code reviews) Seshu Parvataneni

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=4D073619.2010103@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=parvata@rocketmail.com \
    /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).