summaryrefslogtreecommitdiff
path: root/Makefile
AgeCommit message (Collapse)AuthorFilesLines
2013-07-05Merge branch 'maint'Libravatar Junio C Hamano1-3/+0
* maint: fixup-builtins: retire an old transition helper script
2013-07-03fixup-builtins: retire an old transition helper scriptLibravatar Ramkumar Ramachandra1-3/+0
This script was added in 36e5e70 (Start deprecating "git-command" in favor of "git command", 2007-06-30) with the intent of aiding the transition away from dashed forms. It has already been used to help the transision and served its purpose, and is no longer very useful for follow-up work, because the majority of remaining matches it finds are false positives. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-01Merge branch 'jc/topo-author-date-sort'Libravatar Junio C Hamano1-0/+3
"git log" learned the "--author-date-order" option, with which the output is topologically sorted and commits in parallel histories are shown intermixed together based on the author timestamp. * jc/topo-author-date-sort: t6003: add --author-date-order test topology tests: teach a helper to set author dates as well t6003: add --date-order test topology tests: teach a helper to take abbreviated timestamps t/lib-t6000: style fixes log: --author-date-order sort-in-topological-order: use prio-queue prio-queue: priority queue of pointers to structs toposort: rename "lifo" field
2013-06-30Merge branch 'fc/macos-x-clipped-write' into maintLibravatar Junio C Hamano1-0/+8
Mac OS X does not like to write(2) more than INT_MAX number of bytes; work it around by chopping write(2) into smaller pieces. * fc/macos-x-clipped-write: compate/clipped-write.c: large write(2) fails on Mac OS X/XNU
2013-06-24Merge branch 'jh/libify-note-handling'Libravatar Junio C Hamano1-0/+2
Make it possible to call into copy-notes API from the sequencer code. * jh/libify-note-handling: Move create_notes_commit() from notes-merge.c into notes-utils.c Move copy_note_for_rewrite + friends from builtin/notes.c to notes-utils.c finish_copy_notes_for_rewrite(): Let caller provide commit message
2013-06-20Merge branch 'rs/discard-index-discard-array'Libravatar Junio C Hamano1-0/+1
* rs/discard-index-discard-array: read-cache: free cache in discard_index read-cache: add simple performance test
2013-06-20Merge branch 'fc/makefile'Libravatar Junio C Hamano1-4/+6
Makefile simplification. * fc/makefile: Makefile: use $^ to avoid listing prerequisites on the command line build: do not install git-remote-testgit build: generate and clean test scripts
2013-06-20Merge branch 'nd/make-wildmatch-default'Libravatar Junio C Hamano1-2/+2
* nd/make-wildmatch-default: Makefile: promote wildmatch to be the default fnmatch implementation
2013-06-12Move copy_note_for_rewrite + friends from builtin/notes.c to notes-utils.cLibravatar Johan Herland1-0/+2
This is a pure code movement of the machinery for copying notes to rewritten objects. This code was located in builtin/notes.c for historical reasons. In order to make it available to builtin/commit.c it was declared in builtin.h. This was more of an accident of history than a concious design, and we now want to make this machinery more widely available. Hence, this patch moves the code into the new notes-utils.[hc] files which are included into libgit.a. Except for adjusting #includes accordingly, this patch merely moves the relevant functions verbatim into the new files. Cc: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11prio-queue: priority queue of pointers to structsLibravatar Junio C Hamano1-0/+3
Traditionally we used a singly linked list of commits to hold a set of in-flight commits while traversing history. The most typical use of the list is to add commits that are newly discovered to it, keep the list sorted by commit timestamp, pick up the newest one from the list, and keep digging. The cost of keeping the singly linked list sorted is nontrivial, and this typical use pattern better matches a priority queue. Introduce a prio-queue structure, that can be used either as a LIFO stack, or a priority queue. This will be used in the next patch to hold in-flight commits during sort-in-topological-order. Tests and the idea to make it usable for any "void *" pointers to "things" are by Jeff King. Bugs are mine. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11Merge branch 'rj/mingw-cygwin'Libravatar Junio C Hamano1-7/+0
Update build for Cygwin 1.[57]. Torsten Bögershausen reports that this is fine with Cygwin 1.7 ($gmane/225824) so let's try moving it ahead. * rj/mingw-cygwin: cygwin: Remove the CYGWIN_V15_WIN32API build variable mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVE
2013-06-09read-cache: add simple performance testLibravatar René Scharfe1-0/+1
Add the helper test-read-cache, which can be used to call read_cache and discard_cache in a loop as well as a performance check based on it. Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-09Makefile: use $^ to avoid listing prerequisites on the command lineLibravatar Felipe Contreras1-3/+3
There's no need to list again the prerequisites. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-07build: do not install git-remote-testgitLibravatar Felipe Contreras1-0/+1
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-07build: generate and clean test scriptsLibravatar Felipe Contreras1-1/+2
Commit 416fda6 (build: do not install git-remote-testpy) made it so git-remote-testpy is not only not installed, but also not generated by default. From a fresh checkout, "make --test=5800 test" would have failed. This was not found primarily because "make clean" failed to remove git-remote-testpy, which is another bug in the same commit. Fix the former by having 'all' target depend on $(NO_INSTALL) and the latter by removing $(NO_INSTALL) in the 'clean' target. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-07Merge branch 'js/transport-helper-error-reporting-fix' into fc/makefileLibravatar Junio C Hamano1-0/+1
* js/transport-helper-error-reporting-fix: git-remote-testgit: build it to run under $SHELL_PATH git-remote-testgit: further remove some bashisms git-remote-testgit: avoid process substitution t5801: "VAR=VAL shell_func args" is forbidden transport-helper: update remote helper namespace transport-helper: trivial code shuffle transport-helper: warn when refspec is not used transport-helper: clarify pushing without refspecs transport-helper: update refspec documentation transport-helper: clarify *:* refspec transport-helper: improve push messages transport-helper: mention helper name when it dies transport-helper: report errors properly Conflicts: t/t5801-remote-helpers.sh
2013-06-07Merge tag 'post183-for-junio' of http://github.com/msysgit/gitLibravatar Junio C Hamano1-1/+7
Collected msysgit build patches for upstream This set of patches collects a number of build fixes that have been used on the msysgit port for a while and merging upstream should simplify future maintenance. * tag 'post183-for-junio' of http://github.com/msysgit/git: Set the default help format to html for msys builds. Ensure the resource file is rebuilt when the version changes. Windows resource: handle dashes in the Git version gracefully Provide a Windows version resource for the git executables. msysgit: Add the --large-address-aware linker directive to the makefile. Define NO_GETTEXT for Git for Windows Makefile: Do not use OLD_ICONV on MINGW anymore
2013-06-05Merge branch 'fc/makefile'Libravatar Junio C Hamano1-18/+24
Update Makefile to use handy automatic variables where appropriate, and stop installing a script that is only used for testing. * fc/makefile: build: do not install git-remote-testpy build: add NO_INSTALL variable build: cleanup using $< build: cleanup using $^ build: trivial simplification
2013-06-04Ensure the resource file is rebuilt when the version changes.Libravatar Pat Thoyts1-1/+1
Acked-by: Erik Faye-Lund <kusmabite@gmail.com> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2013-06-04Windows resource: handle dashes in the Git version gracefullyLibravatar Johannes Schindelin1-1/+1
Reported by postiffm as issue #14. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2013-06-04Provide a Windows version resource for the git executables.Libravatar Pat Thoyts1-1/+7
Embeds the git version and description into the git executable thus implementing the request in issue #5. Acked-by: Heiko Voigt <hvoigt@hvoigt.net> Acked-by: Sebastian Schuberth <sschuberth@gmail.com> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2013-06-02Merge branch 'tr/line-log'Libravatar Junio C Hamano1-0/+4
* tr/line-log: git-log(1): remove --full-line-diff description line-log: fix documentation formatting log -L: improve comments in process_all_files() log -L: store the path instead of a diff_filespec log -L: test merge of parallel modify/rename t4211: pass -M to 'git log -M -L...' test log -L: fix overlapping input ranges log -L: check range set invariants when we look it up Speed up log -L... -M log -L: :pattern:file syntax to find by funcname Implement line-history search (git log -L) Export rewrite_parents() for 'log -L' Refactor parse_loc
2013-06-02Merge branch 'tr/coverage'Libravatar Junio C Hamano1-8/+13
Update the test coverage support that was left to bitrot for some time. * tr/coverage: coverage: build coverage-untested-functions by default coverage: set DEFAULT_TEST_TARGET to avoid using prove coverage: do not delete .gcno files before building coverage: split build target into compile and test
2013-06-02Merge branch 'da/darwin'Libravatar Junio C Hamano1-0/+15
Newer MacOS X encourages the programs to compile and link with their CommonCrypto, not with OpenSSL. * da/darwin: imap-send: eliminate HMAC deprecation warnings on Mac OS X cache.h: eliminate SHA-1 deprecation warnings on Mac OS X Makefile: add support for Apple CommonCrypto facility Makefile: fix default regex settings on Darwin
2013-06-02Merge branch 'fc/macos-x-clipped-write'Libravatar Junio C Hamano1-0/+8
Mac OS X does not like to write(2) more than INT_MAX number of bytes. * fc/macos-x-clipped-write: compate/clipped-write.c: large write(2) fails on Mac OS X/XNU
2013-06-02Makefile: promote wildmatch to be the default fnmatch implementationLibravatar Nguyễn Thái Ngọc Duy1-2/+2
This makes git use wildmatch by default for all fnmatch() calls. Users who want to use system fnmatch (or compat fnmatch) need to set NO_WILDMATCH flag. wildmatch is a drop-in fnmatch replacement with more features. Using wildmatch gives us a consistent behavior across platforms. The tentative plan is make it default with an opt-out for about 2 cycles, then remove NO_WILDMATCH and compat/fnmatch. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-29Merge branch 'jk/test-output'Libravatar Junio C Hamano1-0/+3
When TEST_OUTPUT_DIRECTORY setting is used, it was handled somewhat inconsistently between the test framework and t/Makefile, and logic to summarize the results looked at a wrong place. * jk/test-output: t/Makefile: don't define TEST_RESULTS_DIRECTORY recursively test output: respect $TEST_OUTPUT_DIRECTORY t/Makefile: fix result handling with TEST_OUTPUT_DIRECTORY
2013-05-29Merge branch 'rj/sparse'Libravatar Junio C Hamano1-0/+1
* rj/sparse: sparse: Fix mingw_main() argument number/type errors compat/mingw.c: Fix some sparse warnings compat/win32mmap.c: Fix some sparse warnings compat/poll/poll.c: Fix a sparse warning compat/win32/pthread.c: Fix a sparse warning compat/unsetenv.c: Fix a sparse warning compat/nedmalloc: Fix compiler warnings on linux compat/nedmalloc: Fix some sparse warnings compat/fnmatch/fnmatch.c: Fix a sparse error compat/regex/regexec.c: Fix some sparse warnings
2013-05-29Merge branch 'mh/packed-refs-various'Libravatar Junio C Hamano1-2/+0
Update reading and updating packed-refs file, correcting corner case bugs. * mh/packed-refs-various: (33 commits) refs: handle the main ref_cache specially refs: change do_for_each_*() functions to take ref_cache arguments pack_one_ref(): do some cheap tests before a more expensive one pack_one_ref(): use write_packed_entry() to do the writing pack_one_ref(): use function peel_entry() refs: inline function do_not_prune() pack_refs(): change to use do_for_each_entry() refs: use same lock_file object for both ref-packing functions pack_one_ref(): rename "path" parameter to "refname" pack-refs: merge code from pack-refs.{c,h} into refs.{c,h} pack-refs: rename handle_one_ref() to pack_one_ref() refs: extract a function write_packed_entry() repack_without_ref(): write peeled refs in the rewritten file t3211: demonstrate loss of peeled refs if a packed ref is deleted refs: change how packed refs are deleted search_ref_dir(): return an index rather than a pointer repack_without_ref(): silence errors for dangling packed refs t3210: test for spurious error messages for dangling packed refs refs: change the internal reference-iteration API refs: extract a function peel_entry() ...
2013-05-26build: do not install git-remote-testpyLibravatar Felipe Contreras1-0/+2
It's only meant for testing. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-26build: add NO_INSTALL variableLibravatar Felipe Contreras1-6/+10
So that we can specify which scripts we do not want to install (they are for testing). Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-26build: cleanup using $<Libravatar Felipe Contreras1-5/+5
No need to list the first prerequisite. No functional changes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-26build: cleanup using $^Libravatar Felipe Contreras1-4/+4
There's no need to list again the prerequisites. No functional changes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-26build: trivial simplificationLibravatar Felipe Contreras1-3/+3
SCRIPT_PYTHON_GEN is '$(patsubst %.py,%,$(SCRIPT_PYTHON))', so replace '$(patsubst %.py,%,$(SCRIPT_PYTHON))' with it Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-20cache.h: eliminate SHA-1 deprecation warnings on Mac OS XLibravatar David Aguilar1-0/+6
As of Mac OS X 10.7, Apple deprecated all OpenSSL functions due to OpenSSL ABI instability, thus leading to build diagnostics such as: warning: 'SHA1_Init' is deprecated (declared at /usr/include/openssl/sha.h:121) Silence the warnings by using Apple's CommonCrypto SHA-1 replacement functions for SHA1_Init(), SHA1_Update(), and SHA1_Final(). COMMON_DIGEST_FOR_OPENSSL is defined to instruct <CommonCrypto/CommonDigest.h> to provide compatibility macros associating OpenSSL SHA-1 functions with their CommonCrypto counterparts. [es: reworded commit message] Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-20Makefile: add support for Apple CommonCrypto facilityLibravatar David Aguilar1-0/+8
As of Mac OS X 10.7, Apple deprecated all OpenSSL functions due to OpenSSL ABI instability, thus leading to build warnings. As a replacement, Apple encourages developers to migrate to its own (stable) CommonCrypto facility. Introduce boilerplate which controls whether Apple's CommonCrypto facility is employed (enabled by default). Also add a NO_APPLE_COMMON_CRYPTO build flag with which the user can opt out to use OpenSSL instead. [es: extracted CommonCrypto-related Makefile boilerplate into separate introductory patch] Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-17compate/clipped-write.c: large write(2) fails on Mac OS X/XNULibravatar Filipe Cabecinhas1-0/+8
Due to a bug in the Darwin kernel, write(2) calls have a maximum size of INT_MAX bytes. Introduce a new compat function, clipped_write(), that only writes at most INT_MAX bytes and returns the number of bytes written, as a substitute for write(2), and allow platforms that need this to enable it from the build mechanism with NEEDS_CLIPPED_WRITE. Set it for Mac OS X by default. It may be necessary to include this function on Windows, too. Signed-off-by: Filipe Cabecinhas <filcab+git@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-13coverage: build coverage-untested-functions by defaultLibravatar Thomas Rast1-1/+1
Change the 'coverage' target to build coverage-untested-functions by default, so as to make it more discoverable. Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-13coverage: set DEFAULT_TEST_TARGET to avoid using proveLibravatar Thomas Rast1-1/+1
If the user sets DEFAULT_TEST_TARGET=prove in his config.mak, that carries over into the coverage tests. Which is really bad if he also sets GIT_PROVE_OPTS=-j<..> as that completely breaks the coverage runs. Instead of attempting to mess with the GIT_PROVE_OPTS, just force the test target to 'test' so that we run under make, like we intended all along. Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-13coverage: do not delete .gcno files before buildingLibravatar Thomas Rast1-3/+6
The coverage-compile target depends on coverage-clean, which is supposed to remove the earlier build products that would get in the way of the next coverage test run. However, removing *.gcno is actively wrong. These are the files that contain the compile-time coverage related data. They are only rebuilt if the source is compiled. So if one ran 'make coverage' two times in a row, the second run would remove *.gcno, but then fail to recreate them because neither source files nor build flags have changed. (This remained hidden for so long most likely because any other intervening use of 'make' will change the build flags, causing a full rebuild.) So we make an exception for *.gcno. The *.gcda are the coverage results, written when the gcov-instrumented program is run. We still remove those, so as to get a one-test-run view of the data; you could probably argue the other way too. Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-13coverage: split build target into compile and testLibravatar Thomas Rast1-3/+5
Confusingly, the coverage-build target in fact builds with gcov support _and runs tests_. Split it into two targets that actually are named after what they do. Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-11Makefile: fix default regex settings on DarwinLibravatar David Aguilar1-0/+1
t0070-fundamental.sh fails on Mac OS X 10.8: $ uname -a Darwin lustrous 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64 $ ./t0070-fundamental.sh -v fatal: regex bug confirmed: re-build git with NO_REGEX=1 Fix it by using Git's regex library. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-08cygwin: Remove the CYGWIN_V15_WIN32API build variableLibravatar Ramsay Jones1-7/+0
Commit 380a4d92 ("Update cygwin.c for new mingw-64 win32 api headers", 11-11-2012) solved an header include order problem on cygwin 1.7 when using the new mingw-64 WIN32 API headers. The solution involved using a new build variable (V15_MINGW_HEADERS) to conditionally compile the cygwin.c source file to use an include order appropriate for the old and new header files. (The build variable was later renamed in commit 9fca6cff to CYGWIN_V15_WIN32API). The include order used for cygwin 1.7 includes the "win32.h" header before "../git-compat-util.h". This order was problematic on cygwin 1.5, since it lead to the WIN32 symbol being defined along with the inclusion of some WIN32 API headers (e.g. <winsock2.h>) which cause compilation errors. The header include order problem on cygwin 1.5 has since been fixed (see commit "mingw: rename WIN32 cpp macro to GIT_WINDOWS_NATIVE"), so we can now remove the conditional compilation along with the associated CYGWIN_V15_WIN32API build variable. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-05-01pack-refs: merge code from pack-refs.{c,h} into refs.{c,h}Libravatar Michael Haggerty1-2/+0
pack-refs.c doesn't contain much code, and the code it does contain is closely related to reference handling. Moreover, there is some duplication between pack_refs() and repack_without_ref(). Therefore, merge pack-refs.c into refs.c and pack-refs.h into refs.h. The code duplication will be addressed in future commits. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-29test output: respect $TEST_OUTPUT_DIRECTORYLibravatar John Keeping1-0/+3
Most test results go in $TEST_OUTPUT_DIRECTORY, but the output files for tests run with --tee or --valgrind just use bare "test-results". Changes these so that they do respect $TEST_OUTPUT_DIRECTORY. As a result of this, the valgrind/analyze.sh script may no longer inspect the correct files so it is also updated to respect $TEST_OUTPUT_DIRECTORY by adding it to GIT-BUILD-OPTIONS. This may be a regression for people who have TEST_OUTPUT_DIRECTORY in their config.mak but want to override it in the environment, but this change merely brings it into line with GIT_TEST_OPTS which already cannot be overridden if it is specified in config.mak. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28git-remote-testgit: build it to run under $SHELL_PATHLibravatar Junio C Hamano1-0/+1
Just like all the other shell scripts, replace the shebang line to make sure it runs under the shell the user specified. As this no longer depends on bashisms, t5801 does not have to say bash must be available somewhere on the system. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-28compat/nedmalloc: Fix some sparse warningsLibravatar Ramsay Jones1-0/+1
Sparse issues many "Using plain integer as NULL pointer" warnings while checking nedmalloc.c (at least 98 such warnings before giving up due to "too many warnings"). In addition, sparse issues some "non-ANSI function declaration" type warnings for the symbols 'win32_getcurrentthreadid', 'malloc_stats' and 'malloc_footprint'. In order to suppress the NULL pointer warnings, rather than replace all uses of '0' as a null pointer representation with NULL, we add -Wno-non-pointer-null to SPARSE_FLAGS while checking nedmalloc.c. In order to suppress the "non-ANSI function declaration" warnings, we simply include the missing 'empty parameter list' prototype (void) in the function declarations. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-01Merge branch 'jk/common-make-variables-export-safety'Libravatar Junio C Hamano1-15/+21
Make the three variables safer to be exported to submakes by ensuring that they are full paths so that they can be used as installation location. * jk/common-make-variables-export-safety: Makefile: make mandir, htmldir and infodir absolute
2013-03-28Implement line-history search (git log -L)Libravatar Thomas Rast1-0/+2
This is a rewrite of much of Bo's work, mainly in an effort to split it into smaller, easier to understand routines. The algorithm is built around the struct range_set, which encodes a series of line ranges as intervals [a,b). This is used in two contexts: * A set of lines we are tracking (which will change as we dig through history). * To encode diffs, as pairs of ranges. The main routine is range_set_map_across_diff(). It processes the diff between a commit C and some parent P. It determines which diff hunks are relevant to the ranges tracked in C, and computes the new ranges for P. The algorithm is then simply to process history in topological order from newest to oldest, computing ranges and (partial) diffs. At branch points, we need to merge the ranges we are watching. We will find that many commits do not affect the chosen ranges, and mark them TREESAME (in addition to those already filtered by pathspec limiting). Another pass of history simplification then gets rid of such commits. This is wired as an extra filtering pass in the log machinery. This currently only reduces code duplication, but should allow for other simplifications and options to be used. Finally, we hook a diff printer into the output chain. Ideally we would wire directly into the diff logic, to optionally use features like word diff. However, that will require some major reworking of the diff chain, so we completely replace the output with our own diff for now. As this was a GSoC project, and has quite some history by now, many people have helped. In no particular order, thanks go to Jakub Narebski <jnareb@gmail.com> Jens Lehmann <Jens.Lehmann@web.de> Jonathan Nieder <jrnieder@gmail.com> Junio C Hamano <gitster@pobox.com> Ramsay Jones <ramsay@ramsay1.demon.co.uk> Will Palmer <wmpalmer@gmail.com> Apologies to everyone I forgot. Signed-off-by: Bo Yang <struggleyb.nku@gmail.com> Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-28Refactor parse_locLibravatar Bo Yang1-0/+2
We want to use the same style of -L n,m argument for 'git log -L' as for git-blame. Refactor the argument parsing of the range arguments from builtin/blame.c to the (new) file that will hold the 'git log -L' logic. To accommodate different data structures in blame and log -L, the file contents are abstracted away; parse_range_arg takes a callback that it uses to get the contents of a line of the (notional) file. The new test is for a case that made me pause during debugging: the 'blame -L with invalid end' test was the only one that noticed an outright failure to parse the end *at all*. So make a more explicit test for that. Signed-off-by: Bo Yang <struggleyb.nku@gmail.com> Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>