git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Christian MICHON" <christian.michon@gmail.com>
Cc: "git list" <git@vger.kernel.org>
Subject: Re: patches in context format ?
Date: Mon, 12 Jan 2009 01:28:57 -0800	[thread overview]
Message-ID: <7vy6xgj2jq.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <46d6db660901120100g7f62a0c2k68c96cbfc23dab5@mail.gmail.com> (Christian MICHON's message of "Mon, 12 Jan 2009 10:00:11 +0100")

"Christian MICHON" <christian.michon@gmail.com> writes:

> I'm maintaining a git tree of the vim project: this work can be seen
> at http://github.com/cmichon/vim
>
> vim patches do not come as unified format, but only as context format
> instead (from a "diff -c").
> ...
> I guess the answer is no, but has anyone on the list been working on
> this ? is there another way to translate from "context" to "unified"
> format ?

Not that I know of.

If you want to add support for the copied context format patches to your
workflow, I think the first step (and easiest one) would be to find an
external program that lets you convert from the copied context format to
the unified context format.  Perhaps "interdiff /dev/null copied >unified"
would suffice (but I haven't tested this).

Then find the place that feeds "git apply" with a patch, and add an option
to "git am" to instead do something like this:

-	git apply --index "$dotest/patch"
+	case "$input_is_in_the_copied_context_format"
+	yes)
+		interdiff /dev/null "$dotest/patch" | git apply --index
+		;;
+	*)
+		# unified context as before...
+		git apply --index "$dotest/patch"
+		;;
+	esac

In the longer term, if we were to update "git-apply" to support the copied
context format, I think we should take the same approach.  

Inside read_patch_file(), you detect that the patch is in the copied
context format, and convert it to the unified context format and return
the result.  All the rest of the program can then be left alone and you
will have little chance of regression.

  reply	other threads:[~2009-01-12  9:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-12  9:00 patches in context format ? Christian MICHON
2009-01-12  9:28 ` Junio C Hamano [this message]
2009-01-12  9:52   ` Christian MICHON
2009-01-12  9:34 ` Teemu Likonen
2009-01-12  9:53   ` Christian MICHON
2009-01-12  9:52 ` Jeff King
2009-01-12  9:57   ` Christian MICHON

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=7vy6xgj2jq.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=christian.michon@gmail.com \
    --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).