Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-11-21commit: discard partial cache before (re-)reading itÆvar Arnfjörð Bjarmason
The read_cache() in prepare_to_commit() would end up clobbering the pointer we had for a previously populated "the_index.cache_tree" in the very common case of "git commit" stressed by e.g. the tests being changed here. We'd populate "the_index.cache_tree" by calling "update_main_cache_tree" in prepare_index(), but would not end up with a "fully prepared" index. What constitutes an existing index is clearly overly fuzzy, here we'll check "active_nr" (aka "the_index.cache_nr"), but our "the_index.cache_tree" might have been malloc()'d already. Thus the code added in 11c8a74a64a (commit: write cache-tree data when writing index anyway, 2011-12-06) would end up allocating the "cache_tree", and would interact here with code added in 7168624c353 (Do not generate full commit log message if it is not going to be used, 2007-11-28). The result was a very common memory leak. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Taylor Blau <me@ttaylorr.com>
2013-06-21apply: carefully strdup a possibly-NULL nameThomas Rast
2901bbe (apply: free patch->{def,old,new}_name fields, 2012-03-21) cleaned up the memory management of filenames in the patches, but forgot that find_name_traditional() can return NULL as a way of saying "I couldn't find a name". That NULL unfortunately gets passed into xstrdup() next, resulting in a segfault. Use null_strdup() so as to safely propagate the null, which will let us emit the correct error message. Reported-by: DevHC on #git Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09tests: add missing &&Jonathan Nieder
Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain. Commands intended to fail should be marked with !, test_must_fail, or test_might_fail. The examples in this patch do not require that. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-04setup: do not forget working dir from subdir of gitdirNguyễn Thái Ngọc Duy
v1.6.1.3~4^2 (Fix gitdir detection when in subdir of gitdir, 2009-01-16) did not go far enough: when a git directory is an ancestor of the original working directory, not only should GIT_DIR be set to point to the .git directory, but the original working directory should be restored before carrying out the relevant command. This way, the effect of running a git command from a subdir of .git will be the same whether or not GIT_DIR is explicitly set. Noticed while investigating v1.6.0.3~1 (rehabilitate 'git index-pack' inside the object store, 2008-10-20). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-04t4111 (apply): refresh index before applying patches to itJonathan Nieder
"git apply", like most plumbing, does not automatically refresh the index file even if it is only stat-dirty. So unless the two "cp" commands in reset_preimage() for a given file happen to have the same time stamp, there will be a spurious error: sub/dir/file: does not match index Refresh the index to eliminate this timing dependency. Noticed by running the test with --valgrind (which slows things down a lot). Reported-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-26tests: try git apply from subdir of toplevelJonathan Nieder
Make sure git apply can apply patches with paths relative to the toplevel of a work tree, a subdirectory, or within the repository metadata directory. Relative paths are broken for most commands when run from a subdirectory of $GIT_DIR, "git apply" being no exception. The other tests are meant to keep the demonstration of that company. Based on a test by Duy. Cc: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>