git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Make sure diff-helper can tell rename/copy in the new diff-raw format.
Date: Wed, 25 May 2005 17:55:51 -0700	[thread overview]
Message-ID: <7v7jhmhkko.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.58.0505230736180.2307@ppc970.osdl.org> (Linus Torvalds's message of "Mon, 23 May 2005 07:49:01 -0700 (PDT)")

>>>>> "LT" == Linus Torvalds <torvalds@osdl.org> writes:

LT> ... But the thing is,
LT> that's actually what I _want_, because I was planning on writing a tool
LT> that applies patches that applies them all-or-nothing.

I was going through past messages and realized I missed this
part of your message.  Now I think I understand what git-apply
program is all about.

There is one thing [*1*] currently missing from diff-patch
output for your plan to fully work.

A type change, like a file turning into a symlink, is currently
something built-in diff punts.  Your earlier response to "What
about modified and type changed" question suggests that you
would want it to be expressed as a delete and a create, so I
imagine that the "diff --git" output for this diff-raw:

    :100644 120000 abcdef... abcdef... T	frotz	frotz

you would want to see output as this:

    diff --git a/frotz b/frotz
    deleted file mode 100644
    --- frotz
    +++ /dev/null
    @@ -1 +0,0 @@
    -rezrov
    \ No newline at end of file
    diff --git a/frotz b/frotz
    new file mode 120000
    --- /dev/null
    +++ frotz
    @@ -0,0 +1 @@
    +rezrov
    \ No newline at end of file

Even simpler for me is not to do this "splitting a filepair into
create and delete", and have diff compare the two blobs
directly, though that would make a patch that does not make
sense to humans:

    diff --git a/frotz b/frotz
    old mode 100644
    new mode 120000
    ... diff between readlink and file contents if any ...

A tree turning into a file and vice versa is something you are
already taking care of in diff-tree when feeding the diffcore,
and diff-cache and diff-files do not even see tree objects to
begin with, so tree-to-file is something that will never be fed
to the output routine as a matched filepair, and you will always
get a delete/create pair with the current code.  I am fairly
certain, therefore, tree-to-file is not a problem.  Only symlink
vs file case is problematic with the current output routine.


[Footnote]

*1* Strictly speaking, there is another.  Changes in tree object
are not shown, either.  This however will not be a problem for
git-apply, because as long as the files underneath are handled
correctly you will end up with the right tree.


      parent reply	other threads:[~2005-05-26  0:54 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-23  7:26 [PATCH] Make sure diff-helper can tell rename/copy in the new diff-raw format Junio C Hamano
2005-05-23 14:49 ` Linus Torvalds
2005-05-23 18:43   ` Junio C Hamano
2005-05-23 19:03     ` Linus Torvalds
2005-05-23 19:16       ` Linus Torvalds
2005-05-23 21:55       ` [PATCH] diff-raw format update take #2 Junio C Hamano
2005-05-23 22:08         ` Junio C Hamano
2005-05-24  0:12         ` Chris Wedgwood
2005-05-24  0:25           ` Junio C Hamano
2005-05-24  0:31             ` Chris Wedgwood
2005-05-24  0:45               ` Junio C Hamano
2005-05-24  1:03                 ` Linus Torvalds
2005-05-24  1:05                   ` Chris Wedgwood
2005-05-24  1:29                   ` David Lang
2005-05-24  1:33                     ` Chris Wedgwood
2005-05-24  1:39                       ` Thomas Glanzmann
     [not found]                         ` <20050524013947.ADFEE528F53@taniwha.stupidest.org>
2005-05-24  1:44                           ` Thomas Glanzmann
2005-05-24  1:50                       ` Linus Torvalds
2005-05-24  0:51               ` Linus Torvalds
2005-05-26  0:55   ` Junio C Hamano [this message]

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=7v7jhmhkko.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.org \
    --cc=torvalds@osdl.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).