Server IP : 103.119.228.120 / Your IP : 3.14.132.178 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/local/ssl/share/doc/git-1.8.3.1/technical/ |
Upload File : |
diff API ======== The diff API is for programs that compare two sets of files (e.g. two trees, one tree and the index) and present the found difference in various ways. The calling program is responsible for feeding the API pairs of files, one from the "old" set and the corresponding one from "new" set, that are different. The library called through this API is called diffcore, and is responsible for two things. * finding total rewrites (`-B`), renames (`-M`) and copies (`-C`), and changes that touch a string (`-S`), as specified by the caller. * outputting the differences in various formats, as specified by the caller. Calling sequence ---------------- * Prepare `struct diff_options` to record the set of diff options, and then call `diff_setup()` to initialize this structure. This sets up the vanilla default. * Fill in the options structure to specify desired output format, rename detection, etc. `diff_opt_parse()` can be used to parse options given from the command line in a way consistent with existing git-diff family of programs. * Call `diff_setup_done()`; this inspects the options set up so far for internal consistency and make necessary tweaking to it (e.g. if textual patch output was asked, recursive behaviour is turned on). * As you find different pairs of files, call `diff_change()` to feed modified files, `diff_addremove()` to feed created or deleted files, or `diff_unmerge()` to feed a file whose state is 'unmerged' to the API. These are thin wrappers to a lower-level `diff_queue()` function that is flexible enough to record any of these kinds of changes. * Once you finish feeding the pairs of files, call `diffcore_std()`. This will tell the diffcore library to go ahead and do its work. * Calling `diff_flush()` will produce the output. Data structures --------------- * `struct diff_filespec` This is the internal representation for a single file (blob). It records the blob object name (if known -- for a work tree file it typically is a NUL SHA-1), filemode and pathname. This is what the `diff_addremove()`, `diff_change()` and `diff_unmerge()` synthesize and feed `diff_queue()` function with. * `struct diff_filepair` This records a pair of `struct diff_filespec`; the filespec for a file in the "old" set (i.e. preimage) is called `one`, and the filespec for a file in the "new" set (i.e. postimage) is called `two`. A change that represents file creation has NULL in `one`, and file deletion has NULL in `two`. A `filepair` starts pointing at `one` and `two` that are from the same filename, but `diffcore_std()` can break pairs and match component filespecs with other filespecs from a different filepair to form new filepair. This is called 'rename detection'. * `struct diff_queue` This is a collection of filepairs. Notable members are: `queue`:: An array of pointers to `struct diff_filepair`. This dynamically grows as you add filepairs; `alloc`:: The allocated size of the `queue` array; `nr`:: The number of elements in the `queue` array. * `struct diff_options` This describes the set of options the calling program wants to affect the operation of diffcore library with. Notable members are: `output_format`:: The output format used when `diff_flush()` is run. `context`:: Number of context lines to generate in patch output. `break_opt`, `detect_rename`, `rename-score`, `rename_limit`:: Affects the way detection logic for complete rewrites, renames and copies. `abbrev`:: Number of hexdigits to abbreviate raw format output to. `pickaxe`:: A constant string (can and typically does contain newlines to look for a block of text, not just a single line) to filter out the filepairs that do not change the number of strings contained in its preimage and postimage of the diff_queue. `flags`:: This is mostly a collection of boolean options that affects the operation, but some do not have anything to do with the diffcore library. BINARY, TEXT;; Affects the way how a file that is seemingly binary is treated. FULL_INDEX;; Tells the patch output format not to use abbreviated object names on the "index" lines. FIND_COPIES_HARDER;; Tells the diffcore library that the caller is feeding unchanged filepairs to allow copies from unmodified files be detected. COLOR_DIFF;; Output should be colored. COLOR_DIFF_WORDS;; Output is a colored word-diff. NO_INDEX;; Tells diff-files that the input is not tracked files but files in random locations on the filesystem. ALLOW_EXTERNAL;; Tells output routine that it is Ok to call user specified patch output routine. Plumbing disables this to ensure stable output. QUIET;; Do not show any output. REVERSE_DIFF;; Tells the library that the calling program is feeding the filepairs reversed; `one` is two, and `two` is one. EXIT_WITH_STATUS;; For communication between the calling program and the options parser; tell the calling program to signal the presence of difference using program exit code. HAS_CHANGES;; Internal; used for optimization to see if there is any change. SILENT_ON_REMOVE;; Affects if diff-files shows removed files. RECURSIVE, TREE_IN_RECURSIVE;; Tells if tree traversal done by tree-diff should recursively descend into a tree object pair that are different in preimage and postimage set. (JC)