git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Raible <raible@gmail.com>
To: Paolo Bonzini <bonzini@gnu.org>
Cc: git@vger.kernel.org
Subject: Re: Does CVS has a easy way to compare file with its previous  version?
Date: Mon, 6 Jul 2009 16:39:43 -0700	[thread overview]
Message-ID: <279b37b20907061639o6d6c72e7qf7bbc2459c7fc77e@mail.gmail.com> (raw)
In-Reply-To: <4A4DA7A5.7020303@gnu.org>

On Thu, Jul 2, 2009 at 11:39 PM, Paolo Bonzini<bonzini@gnu.org> wrote:
> On 07/02/2009 08:04 PM, Eric Raible wrote:
>>
>> Isn't the first one incorrect because<file>  needs to be inside the
>> backticks?
>> git diff `git log -2 --pretty=format:%h<file>` --<file>
>>
>> And isn't the replacement incorrect also (the diffs are backwards)?
>> git log --no-merges -p -R -1<file>
>
> Yes and no.
>
> Paolo
>

Are you sure that you didn't mean yes and yes?

As the transcript shows the git-diff form produces a
backwards diff.  Thus to get the same output git-log
needs the -R:

$ git init
$ perl -e 'for (0..10) { print "$_\n" }' > file
$ git add file
$ git commit -minitial
[master (root-commit) 2d451ec] initial
 1 files changed, 11 insertions(+), 0 deletions(-)
 create mode 100644 file
$ sed -e 's/4/four/' < file > file1
$ mv file1 file
$ git commit -a -m'updated'
[master d49613a] updated
 1 files changed, 1 insertions(+), 1 deletions(-)
$ git diff `git log -2 --pretty=format:%h file` -- file
diff --git a/file b/file
index b29b605..b033488 100644
--- a/file
+++ b/file
@@ -2,7 +2,7 @@
 1
 2
 3
-four
+4
 5
 6
 7

$ git log --no-merges -p -1 file
commit d49613a1d16c9ece551f9a52f56f16a3dae8bebc
Author: Eric Raible <raible@nextest.com>
Date:   Mon Jul 6 16:25:29 2009 -0700

    updated

diff --git a/file b/file
index b033488..b29b605 100644
--- a/file
+++ b/file
@@ -2,7 +2,7 @@
 1
 2
 3
-4
+four
 5
 6
 7

$ git log --no-merges -p -R -1 file
commit d49613a1d16c9ece551f9a52f56f16a3dae8bebc
Author: Eric Raible <raible@nextest.com>
Date:   Mon Jul 6 16:25:29 2009 -0700

    updated

diff --git b/file a/file
index b29b605..b033488 100644
--- b/file
+++ a/file
@@ -2,7 +2,7 @@
 1
 2
 3
-four
+4
 5
 6
 7

  reply	other threads:[~2009-07-06 23:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-30  7:41 Does CVS has a easy way to compare file with its previous version? dtletmn
2009-06-30 11:32 ` Andreas Ericsson
2009-06-30 12:36 ` Jakub Narebski
2009-06-30 23:28   ` Paolo Bonzini
2009-07-01  1:18     ` Linus Torvalds
2009-07-02 18:04       ` Eric Raible
2009-07-03  6:39         ` Paolo Bonzini
2009-07-06 23:39           ` Eric Raible [this message]
2009-07-07 19:57             ` Paolo Bonzini
2009-07-01  0:29 ` dtletmn

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=279b37b20907061639o6d6c72e7qf7bbc2459c7fc77e@mail.gmail.com \
    --to=raible@gmail.com \
    --cc=bonzini@gnu.org \
    --cc=git@vger.kernel.org \
    /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).