summaryrefslogtreecommitdiff
path: root/t/lib-diff-alternative.sh
Commit message (Collapse)AuthorAgeFilesLines
* attr: teach "--attr-source=<tree>" global option to "git"John Cai2023-05-061-5/+26
| | | | | | | | | | | | | | | | | | | | | | | Earlier, 47cfc9bd (attr: add flag `--source` to work with tree-ish, 2023-01-14) taught "git check-attr" the "--source=<tree>" option to allow it to read attribute files from a tree-ish, but did so only for the command. Just like "check-attr" users wanted a way to use attributes from a tree-ish and not from the working tree files, users of other commands (like "git diff") would benefit from the same. Undo most of the UI change the commit made, while keeping the internal logic to read attributes from a given tree-ish. Expose the internal logic via a new "--attr-source=<tree>" command line option given to "git", so that it can be used with any git command that runs as part of the main git process. Additionally, add an environment variable GIT_ATTR_SOURCE that is set when --attr-source is passed in, so that subprocesses use the same value for the attributes source tree. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* diff: teach diff to read algorithm from diff driverJohn Cai2023-02-211-1/+37
| | | | | | | | | | | | | | | | | | | | | | It can be useful to specify diff algorithms per file type. For example, one may want to use the minimal diff algorithm for .json files, another for .c files, etc. The diff machinery already checks attributes for a diff driver. Teach the diff driver parser a new type "algorithm" to look for in the config, which will be used if a driver has been specified through the attributes. Enforce precedence of the diff algorithm by favoring the command line option, then looking at the driver attributes & config combination, then finally the diff.algorithm config. To enforce precedence order, use a new `ignore_driver_algorithm` member during options parsing to indicate the diff algorithm was set via command line args. Signed-off-by: John Cai <johncai86@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t/lib-diff-alternative: abstract away SHA-1-specific constantsbrian m. carlson2018-05-211-4/+8
| | | | | | | | | Adjust the test code so that it computes variables for blobs instead of using hard-coded hashes. This makes t4033 and t4050 (the patience and histogram tests) pass. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* test: replace shebangs with descriptions in shell librariesJonathan Nieder2013-11-261-1/+2
| | | | | | | | | | | | | | A #! line in these files is misleading, since these scriptlets are meant to be sourced with '.' (using whatever shell sources them) instead of run directly using the interpreter named on the #! line. Removing the #! line shouldn't hurt syntax highlighting since these files have filenames ending with '.sh'. For documentation, add a brief description of how the files are meant to be used in place of the shebang line. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* t4033-diff-patience: factor out testsTay Ray Chuan2011-07-071-0/+165
Group the test cases into two functions, test_diff_(frobnitz|unique). This in preparation for the histogram diff algorithm, which would also re-use these test cases. Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>