Re: [solved] how to create a diff in old file new file format (for code reviews)
Hi Michael,
Thanks very much for the reply. Your example with the difftool worked. This was what I was looking for.
--- On Tue, 12/14/10, Michael J Gruber <git@drmicha.warpmail.net> wrote:
Show 64 quoted lines
> From: Michael J Gruber <git@drmicha.warpmail.net>
> Subject: Re: how to create a diff in old file new file format (for code reviews)
> To: "aerosmith" <parvata@rocketmail.com>
> Cc: git@vger.kernel.org
> Date: Tuesday, December 14, 2010, 1:17 AM
> 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
> --
> To unsubscribe from this list: send the line "unsubscribe
> git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>