Re: patches in context format ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Christian MICHON" <christian.michon@xxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux