patch

Diff/compare two files by file descriptor (fd) instead of file name

…衆ロ難τιáo~ 提交于 2019-12-21 18:07:05
问题 Is there any way in Linux, using c, to generate a diff/patch of two files stored in memory, using a common format (ie: unified diff, like with the command-line diff utility)? I'm working on a system where I generate two text files in memory, and no external storage is available, or desired. I need to create a line-by-line diff of the two files, and since they are mmap 'ed, they don't have file names, preventing me from simply calling system("diff file1.txt file2.txt") . I have file

git-apply fails mysteriously, how do I troubleshoot/fix?

心不动则不痛 提交于 2019-12-21 07:02:37
问题 I'm currently trying to to code-style checking on the PRs of a (github) repository, and I want to deliver patches to the submitters with which they can easily fix the codestyle. To this end, I'm pulling down their PR, run our uncrustify script over it to fix any style errors, and want to create a .patch file they can easily apply. However, it consistently breaks on some files. I do (git version 1.7.10.4 with core.autocrlf=input , core.filemode=false ): $ git checkout pr-branch $ git log -1

How to create a PATCH file for the binary difference output file

蓝咒 提交于 2019-12-21 04:24:07
问题 I want to know how to create a PATCH for the difference file I got by comparing two binary files. $cmp -l > output file name I checked for text files 'diff" can be used to compare and generate a PATCH file $ diff -u oldFile newFile > mods.diff # -u tells diff to output unified diff format I want to apply the PATCH on the old binary image file to get my new binary image file. 回答1: Diff and Patch are designed to work with text files, not arbitrary binary data. You should use something like

Better way of making Git to turn a blind eye on my changes

[亡魂溺海] 提交于 2019-12-21 02:55:20
问题 Is there some cleaner way to make Git just ignore some of my changes and never commit them? .gitattributes: config_to_be_deviated.xml filter=qqq .git/config: [filter "qqq"] clean = "perl -ne 'print unless /git_please_dont_look_here/'" smudge = (Q=$(mktemp) && cat > $Q && patch -s $Q < /tmp/pp && cat $Q && rm $Q) The patch /tmp/pp adds my changes with "git_please_dont_look_here" in each line. Git removes all such lines before getting the file into repository and readds my changes when checking

showing differences within a line in diff output

时光怂恿深爱的人放手 提交于 2019-12-20 12:23:04
问题 This StackOverflow answer has an image of KDiff3 highlighting intra-line differences. Does someone know of a tool which can show the same (ex, via color) on the command line? Another way to think of this is wanting to diff each difference in a patch file. 回答1: I don't know if this is sufficiently command line for your purpose, but vimdiff can do this (even does colour). See for example the image in this related question. 回答2: Another intuitive way to see all word-sized differences (though not

How to visualize or format a diff / patch file? [closed]

Deadly 提交于 2019-12-20 11:04:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I have a patch file (unified diff), like the output from svn diff , git diff , or diff -u ... . I want to review it, but the unified diff format - especially with many files & changes - is hard on my eyes. How can I get a nicely-formatted diff view from the patch file? I don't have the files themselves, only the

How to visualize or format a diff / patch file? [closed]

两盒软妹~` 提交于 2019-12-20 11:03:08
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I have a patch file (unified diff), like the output from svn diff , git diff , or diff -u ... . I want to review it, but the unified diff format - especially with many files & changes - is hard on my eyes. How can I get a nicely-formatted diff view from the patch file? I don't have the files themselves, only the

Self Updating

廉价感情. 提交于 2019-12-20 09:44:36
问题 What's the best way to terminate a program and then run additional code from the program that's being terminated? For example, what would be the best way for a program to self update itself? 回答1: You have a couple options: You could use another application .exe to do the auto update. This is probably the best method. You can also rename a program's exe while it is running. Hence allowing you to get the file from some update server and replace it. On the program's next startup it will be using

Creating a Patch with TFS

北战南征 提交于 2019-12-20 08:31:43
问题 Creating a patch is very easy in SubVersion, With Tortoise, you right-click and select Create Patch. But for the life of me, I can't find this functionality in TFS. Is this possible? If not, what's the standard way to submit patches in open source TFS hosted projects (a la CodePlex)? 回答1: tf diff /shelveset:shelveset /format:unified Edit: This writes to standard output. You can pipe the output to a file. For more options, see Difference Command. 回答2: Codeplex uses its own client for creating

Is there are way to patch jar files?

馋奶兔 提交于 2019-12-18 18:53:42
问题 Suppose I sent a large jar or war file to someone. Could I later just change one small section and send that to him? Suppose I just changed one class file. I recompiled the java for into a class file. Other then exchanging the new class file for the old class file it there anything else I would have to do? In java do you have to rebuild the entire jar/war file? Also, is there some open source package available for doing updates? 回答1: The person receiving the class file could simply add that