summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* test: facilitate debugging Git executables in tests with gdbjs/git-gdbJohannes Schindelin2015-10-303-1/+20
| | | | | | | | | | When prefixing a Git call in the test suite with 'debug ', it will now be run with GDB, allowing the developer to debug test failures more conveniently. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Eighth batch for 2.7Junio C Hamano2015-10-291-1/+24
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'jc/am-mailinfo-direct'Junio C Hamano2015-10-291-19/+23
|\ | | | | | | | | | | | | | | | | "git am" used to spawn "git mailinfo" via run_command() API once per each patch, but learned to make a direct call to mailinfo() instead. * jc/am-mailinfo-direct: am: make direct call to mailinfo
| * am: make direct call to mailinfojc/am-mailinfo-directJunio C Hamano2015-10-211-19/+23
| | | | | | | | | | | | | | | | | | | | And finally the endgame. Instead of spawning "git mailinfo" via the run_command() API the same number of times as there are incoming patches, make direct internal call to the libified mailinfo() from "git am" to reduce the spawning overhead, which would matter on some platforms. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'jc/mailinfo-lib'Junio C Hamano2015-10-294-1035/+1099
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The implementation of "git mailinfo" was refactored so that a mailinfo() function can be directly called from inside a process. * jc/mailinfo-lib: (34 commits) mailinfo: remove calls to exit() and die() deep in the callchain mailinfo: handle charset conversion errors in the caller mailinfo: libify mailinfo: keep the parsed log message in a strbuf mailinfo: handle_commit_msg() shouldn't be called after finding patchbreak mailinfo: move content/content_top to struct mailinfo mailinfo: move [ps]_hdr_data to struct mailinfo mailinfo: move cmitmsg and patchfile to struct mailinfo mailinfo: move charset to struct mailinfo mailinfo: move transfer_encoding to struct mailinfo mailinfo: move check for metainfo_charset to convert_to_utf8() mailinfo: move metainfo_charset to struct mailinfo mailinfo: move use_scissors and use_inbody_headers to struct mailinfo mailinfo: move add_message_id and message_id to struct mailinfo mailinfo: move patch_lines to struct mailinfo mailinfo: move filter/header stage to struct mailinfo mailinfo: move global "FILE *fin, *fout" to struct mailinfo mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfo mailinfo: introduce "struct mailinfo" to hold globals mailinfo: move global "line" into mailinfo() function ...
| * mailinfo: remove calls to exit() and die() deep in the callchainJunio C Hamano2015-10-212-8/+23
| | | | | | | | | | | | | | | | The top-level mailinfo() would instead punt when the code in the deeper part of the callchain detects an unrecoverable error in the input. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: handle charset conversion errors in the callerJunio C Hamano2015-10-211-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of dying in convert_to_utf8(), just report an error and let the callers handle it. Between the two callers: - decode_header() silently punts when it cannot parse a broken RFC2047 encoded text (e.g. when it sees anything other than B or Q after it sees "=?<charset>") by jumping to release_return, returning the string it successfully parsed out so far, to the caller. A piece of string that convert_to_utf8() cannot handle can be treated the same way. - handle_commit_msg() doesn't cope with a malformed line well, so die there for now. We'll lift this even higher in later changes in this series. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: libifyJunio C Hamano2015-10-214-1048/+1062
| | | | | | | | | | | | | | | | | | | | Move the bulk of the code from builtin/mailinfo.c to mailinfo.c so that new callers can start calling mailinfo() directly. Note that a few calls to exit() and die() need to be cleaned up for the API to be truly useful, which will come in later steps. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: keep the parsed log message in a strbufJunio C Hamano2015-10-211-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | When mailinfo() is eventually libified, the calling "git am" still will have to write out the log message in the "msg" file for hooks and other users of the information, but it does not have to reopen and reread what it wrote earlier if the function kept it in a strbuf. This also removes the need for seeking and truncating the output file when we see a scissors mark in the input, which in turn allows us to lose two callsites of die_errno(). Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: handle_commit_msg() shouldn't be called after finding patchbreakJunio C Hamano2015-10-211-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is a strange "if (!mi->cmitmsg) return 0" at the very beginning of handle_commit_msg(), but the condition should never trigger, because: * The only place cmitmsg is set to NULL is after this function sees a patch break, closes the FILE * to write the commit log message and returns 1. This function returns non-zero only from that codepath. * The caller of this function, upon seeing a non-zero return, increments filter_stage, starts treating the input as patch text and will never call handle_commit_msg() again. Replace it with an assert(!mi->filter_stage) to ensure the above observation will stay to be true. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move content/content_top to struct mailinfoJunio C Hamano2015-10-211-20/+26
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move [ps]_hdr_data to struct mailinfoJunio C Hamano2015-10-211-14/+23
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move cmitmsg and patchfile to struct mailinfoJunio C Hamano2015-10-211-16/+16
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move charset to struct mailinfoJunio C Hamano2015-10-211-7/+8
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move transfer_encoding to struct mailinfoJunio C Hamano2015-10-211-13/+14
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move check for metainfo_charset to convert_to_utf8()Junio C Hamano2015-10-211-5/+3
| | | | | | | | | | | | | | | | | | All callers of this function refrain from calling it when mi->metainfo_charset is NULL; move the check to the callee, as it already has a few conditions at its beginning to turn it into a no-op. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move metainfo_charset to struct mailinfoJunio C Hamano2015-10-211-19/+19
| | | | | | | | | | | | | | This requires us to pass the struct down to decode_header() and convert_to_utf8() callchain. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move use_scissors and use_inbody_headers to struct mailinfoJunio C Hamano2015-10-211-10/+13
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move add_message_id and message_id to struct mailinfoJunio C Hamano2015-10-211-14/+17
| | | | | | | | | | | | This requires us to pass the structure into check_header() codepath. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move patch_lines to struct mailinfoJunio C Hamano2015-10-211-5/+5
| | | | | | | | | | | | | | This one is trivial thanks to previous steps that started passing the structure throughout the input codepaths. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move filter/header stage to struct mailinfoJunio C Hamano2015-10-211-20/+21
| | | | | | | | | | | | | | | | | | | | Earlier we got rid of two function-scope static variables that kept track of the states of helper functions by making them extra arguments that are passed throughout the callchain. Now we have a convenient place to store and pass them around in the form of "struct mailinfo", change them into two fields in the struct. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move global "FILE *fin, *fout" to struct mailinfoJunio C Hamano2015-10-211-26/+28
| | | | | | | | | | | | | | | | | | This requires us to pass "struct mailinfo" to more functions throughout the codepath that read input lines. Incidentally, later steps are helped by this patch passing the struct to more callchains. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move keep_subject & keep_non_patch_bracket to struct mailinfoJunio C Hamano2015-10-211-8/+8
| | | | | | | | | | | | | | These two are the only easy ones that do not require passing the structure around to deep corners of the callchain. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: introduce "struct mailinfo" to hold globalsJunio C Hamano2015-10-211-24/+47
| | | | | | | | | | | | | | | | | | In this first step, move only 'email' and 'name' fields in there and remove the corresponding globals. In subsequent patches, more globals will be moved to this and the structure will be passed around as a new parameter to more functions. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move global "line" into mailinfo() functionJunio C Hamano2015-10-211-2/+3
| | | | | | | | | | | | | | | | With the previous steps, it becomes clear that the mailinfo() function is the only one that wants the "line" to be directly touchable. Move it to the function scope of this function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: do not let find_boundary() touch global "line" directlyJunio C Hamano2015-10-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With the previous two commits, we established that the local variable "line" in handle_body() and handle_boundary() functions always refer to the global "line" that is used as the common and shared "current line from the input". They are the only callers of the last function that refers to the global line directly, i.e. find_boundary(). Pass "line" as a parameter to this leaf function to complete the clean-up. Now the only function that directly refers to the global "line" is the caller of handle_body() at the very beginning of this whole callchain. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: do not let handle_boundary() touch global "line" directlyJunio C Hamano2015-10-211-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function has a single caller, and called with the global "line" holding the multi-part boundary line the caller saw while processing the e-mail body. The function then goes into a loop to process each line of the input, and fills the same global "line" variable from the input as it needs to read more lines to process the multi-part headers. Let the caller explicitly pass a pointer to this global "line" variable as an argument, and have the function itself use that strbuf throughout, instead of referring to the global "line" itself. There still is a helper function that this function calls that still touches the global directly; it will be updated as the series progresses. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: do not let handle_body() touch global "line" directlyJunio C Hamano2015-10-211-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function has a single caller, and called with the global "line" holding the first line of the e-mail body after the caller finished processing the e-mail headers. The function then goes into a loop to process each line of the input, starting from what was given by its caller, and fills the same global "line" variable from the input as it needs to process more lines. Let the caller explicitly pass a pointer to this global "line" variable as an argument, and have the function itself use that strbuf throughout, instead of referring to the global "line" itself. There are helper functions that this function calls that still touch the global directly; they will be updated as the series progresses. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: get rid of function-local static statesJunio C Hamano2015-10-211-22/+19
| | | | | | | | | | | | | | | | | | | | Two helper functions use "static int" in their scope to keep track of the state while repeatedly getting called once for each input line. Move these state variables to their ultimate caller and pass down pointers to them along the callchain, as a small step in preparation for making this entire callchain more reentrant. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move definition of MAX_HDR_PARSED closer to its useJunio C Hamano2015-10-211-1/+1
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move cleanup_space() before its usersJunio C Hamano2015-10-211-14/+11
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move check_header() after the helpers it usesJunio C Hamano2015-10-211-68/+67
| | | | | | | | | | | | This way, we can lose a forward decl for decode_header(). Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move read_one_header_line() closer to its callersJunio C Hamano2015-10-211-68/+68
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: move handle_boundary() lowerJunio C Hamano2015-10-211-58/+56
| | | | | | | | | | | | | | | | This function wants to call find_boundary() and is called only from one place without any recursing, so it becomes easier to read if it appears after the called function. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: plug strbuf leak during continuation line handlingJunio C Hamano2015-10-211-1/+3
| | | | | | | | | | | | | | | | Whether this loop is left via EOF/break or upon finding a non-continuation line, the storage used for the contination line handling is left behind. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: explicitly close file handle to the patch outputJunio C Hamano2015-10-181-0/+2
| | | | | | | | | | | | | | | | | | | | | | This does not make a difference within the context of "git mailinfo" that runs once and exits, as flushing and closing would happen upon process termination. It however will matter when we eventually make it callable as an API function. Besides, cleaning after yourself once you are done is a good hygiene. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: fix an off-by-one error in the boundary stackJunio C Hamano2015-10-181-1/+1
| | | | | | | | | | | | | | | | We pre-increment the pointer that we will use to store something at, so the pointer is already beyond the end of the array if it points at content[MAX_BOUNDARIES]. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: fold decode_header_bq() into decode_header()Junio C Hamano2015-10-181-16/+7
| | | | | | | | | | | | | | | | | | In olden days we might have wanted to behave differently in decode_header() if the header line was encoded with RFC2047, but we apparently do not do so, hence this helper function can go, together with its return value. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * mailinfo: remove a no-op call convert_to_utf8(it, "")Junio C Hamano2015-10-181-5/+0
| | | | | | | | | | | | | | | | The called function checks if the second parameter is either a NULL or an empty string at the very beginning and returns without doing anything. Remove the useless call. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'rp/link-curl-before-ssl'Junio C Hamano2015-10-292-6/+34
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | The linkage order of libraries was wrong in places around libcurl. * rp/link-curl-before-ssl: configure.ac: detect ssl need with libcurl Makefile: make curl-config path configurable Makefile: link libcurl before zlib
| * | configure.ac: detect ssl need with libcurlrp/link-curl-before-sslRemi Pommarel2015-10-211-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When libcurl has been statically compiled with openssl support they both need to be linked in everytime libcurl is used. During configuration this can be detected by looking for Curl_ssl_init function symbol in libcurl, which will only be present if libcurl has been compiled statically built with openssl. configure.ac checks for Curl_ssl_init function in libcurl and if such function exists; it sets NEEDS_SSL_WITH_CURL that is used by the Makefile to include -lssl alongside with -lcurl. Signed-off-by: Remi Pommarel <repk@triplefau.lt> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Makefile: make curl-config path configurableRemi Pommarel2015-10-212-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are situations, e.g. during cross compilation, where curl-config program is not present in the PATH. Make the makefile use a configurable curl-config program passed through CURL_CONFIG variable which can be set through config.mak. Also make this variable tunable through use of autoconf/configure. Configure will set CURL_CONFIG variable in config.mak.autogen to whatever value has been passed to ac_cv_prog_CURL_CONFIG. Signed-off-by: Remi Pommarel <repk@triplefau.lt> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Makefile: link libcurl before zlibRemi Pommarel2015-10-211-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For static linking especially library order while linking is important. For example, libcurl wants symbols from zlib when building http-push, http-fetch and remote-curl. So for these programs libcurl has to be linked before zlib. Signed-off-by: Remi Pommarel <repk@triplefau.lt> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'dt/name-hash-dir-entry-fix'Junio C Hamano2015-10-294-60/+35
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The name-hash subsystem that is used to cope with case insensitive filesystems keeps track of directories and their on-filesystem cases for all the paths in the index by holding a pointer to a randomly chosen cache entry that is inside the directory (for its ce->ce_name component). This pointer was not updated even when the cache entry was removed from the index, leading to use after free. This was fixed by recording the path for each directory instead of borrowing cache entries and restructuring the API somewhat. * dt/name-hash-dir-entry-fix: name-hash: don't reuse cache_entry in dir_entry
| * | | name-hash: don't reuse cache_entry in dir_entrydt/name-hash-dir-entry-fixDavid Turner2015-10-214-60/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stop reusing cache_entry in dir_entry; doing so causes a use-after-free bug. During merges, we free entries that we no longer need in the destination index. But those entries might have also been stored in the dir_entry cache, and when a later call to add_to_index found them, they would be used after being freed. To prevent this, change dir_entry to store a copy of the name instead of a pointer to a cache_entry. This entails some refactoring of code that expects the cache_entry. Keith McGuigan <kmcguigan@twitter.com> diagnosed this bug and wrote the initial patch, but this version does not use any of Keith's code. Helped-by: Keith McGuigan <kmcguigan@twitter.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'tk/sigchain-unnecessary-post-tempfile'Junio C Hamano2015-10-294-4/+0
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove no-longer used #include. * tk/sigchain-unnecessary-post-tempfile: shallow: remove unused #include "sigchain.h" read-cache: remove unused #include "sigchain.h" diff: remove unused #include "sigchain.h" credential-cache--daemon: remove unused #include "sigchain.h"
| * | | | shallow: remove unused #include "sigchain.h"tk/sigchain-unnecessary-post-tempfileTobias Klauser2015-10-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After switching to use the tempfile module in commit 6e122b44 (setup_temporary_shallow(): use tempfile module), no declarations from sigchain.h are used in read-cache.c anymore. Thus, remove the #include. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | read-cache: remove unused #include "sigchain.h"Tobias Klauser2015-10-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After switching to use the tempfile module in commit f6ecc62d (write_shared_index(): use tempfile module), no declarations from sigchain.h are used in read-cache.c anymore. Thus, remove the #include. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | diff: remove unused #include "sigchain.h"Tobias Klauser2015-10-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After switching to use the tempfile module in commit 284098f1 (diff: use tempfile module), no declarations from sigchain.h are used in diff.c anymore. Thus, remove the #include. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | credential-cache--daemon: remove unused #include "sigchain.h"Tobias Klauser2015-10-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After switching to use the tempfile module in commit 9e903316 (credential-cache--daemon: use tempfile module), no declarations from sigchain.h are used in credential-cache--daemon.c anymore. Thus, remove the #include. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>