From 5fd898141ce2a243abf75192c9a55cb0a4e1ba80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 25 Dec 2010 13:38:46 +0100 Subject: [PATCH 1/6] close file on error in read_mmfile() Reported in http://qa.debian.org/daca/cppcheck/sid/git_1.7.2.3-2.2.html and in http://thread.gmane.org/gmane.comp.version-control.git/123042. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- xdiff-interface.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/xdiff-interface.c b/xdiff-interface.c index 01f14fb50f..b78f757193 100644 --- a/xdiff-interface.c +++ b/xdiff-interface.c @@ -211,8 +211,10 @@ int read_mmfile(mmfile_t *ptr, const char *filename) return error("Could not open %s", filename); sz = xsize_t(st.st_size); ptr->ptr = xmalloc(sz ? sz : 1); - if (sz && fread(ptr->ptr, sz, 1, f) != 1) + if (sz && fread(ptr->ptr, sz, 1, f) != 1) { + fclose(f); return error("Could not read %s", filename); + } fclose(f); ptr->size = sz; return 0; From 0ed748134748579a13cf27e1e8b3e55371bcd9dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Mon, 27 Dec 2010 08:26:04 +0700 Subject: [PATCH 2/6] setup_work_tree: adjust relative $GIT_WORK_TREE after moving cwd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When setup_work_tree() is called, it moves cwd to $GIT_WORK_TREE and makes internal copy of $GIT_WORK_TREE absolute. The environt variable, if set by user, remains unchanged. If the variable is relative, it is no longer correct because its base dir has changed. Instead of making $GIT_WORK_TREE absolute too, we just say "." and let subsequent git processes handle it. Reported-by: Michel Briand Signed-off-by: Nguyễn Thái Ngọc Duy Signed-off-by: Junio C Hamano --- .gitignore | 1 + Makefile | 1 + setup.c | 8 ++++++++ t/t1501-worktree.sh | 7 +++++++ test-subprocess.c | 21 +++++++++++++++++++++ 5 files changed, 38 insertions(+) create mode 100644 test-subprocess.c diff --git a/.gitignore b/.gitignore index 20560b810b..1dcc082a88 100644 --- a/.gitignore +++ b/.gitignore @@ -175,6 +175,7 @@ /test-sha1 /test-sigchain /test-string-pool +/test-subprocess /test-svn-fe /test-treap /common-cmds.h diff --git a/Makefile b/Makefile index 1f1ce04edf..f96d990d5a 100644 --- a/Makefile +++ b/Makefile @@ -425,6 +425,7 @@ TEST_PROGRAMS_NEED_X += test-run-command TEST_PROGRAMS_NEED_X += test-sha1 TEST_PROGRAMS_NEED_X += test-sigchain TEST_PROGRAMS_NEED_X += test-string-pool +TEST_PROGRAMS_NEED_X += test-subprocess TEST_PROGRAMS_NEED_X += test-svn-fe TEST_PROGRAMS_NEED_X += test-treap TEST_PROGRAMS_NEED_X += test-index-version diff --git a/setup.c b/setup.c index 2e2865cc41..be550af42a 100644 --- a/setup.c +++ b/setup.c @@ -221,6 +221,14 @@ void setup_work_tree(void) git_dir = make_absolute_path(git_dir); if (!work_tree || chdir(work_tree)) die("This operation must be run in a work tree"); + + /* + * Make sure subsequent git processes find correct worktree + * if $GIT_WORK_TREE is set relative + */ + if (getenv(GIT_WORK_TREE_ENVIRONMENT)) + setenv(GIT_WORK_TREE_ENVIRONMENT, ".", 1); + set_git_dir(make_relative_path(git_dir, work_tree)); initialized = 1; } diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh index 2c8f01f668..f072a8ed48 100755 --- a/t/t1501-worktree.sh +++ b/t/t1501-worktree.sh @@ -340,4 +340,11 @@ test_expect_success 'make_relative_path handles double slashes in GIT_DIR' ' git --git-dir="$(pwd)//repo.git" --work-tree="$(pwd)" add dummy_file ' +test_expect_success 'relative $GIT_WORK_TREE and git subprocesses' ' + GIT_DIR=repo.git GIT_WORK_TREE=repo.git/work \ + test-subprocess --setup-work-tree rev-parse --show-toplevel >actual && + echo "$TRASH_DIRECTORY/repo.git/work" >expected && + test_cmp expected actual +' + test_done diff --git a/test-subprocess.c b/test-subprocess.c new file mode 100644 index 0000000000..667d3e5079 --- /dev/null +++ b/test-subprocess.c @@ -0,0 +1,21 @@ +#include "cache.h" +#include "run-command.h" + +int main(int argc, char **argv) +{ + const char *prefix; + struct child_process cp; + int nogit = 0; + + prefix = setup_git_directory_gently(&nogit); + if (nogit) + die("No git repo found"); + if (!strcmp(argv[1], "--setup-work-tree")) { + setup_work_tree(); + argv++; + } + memset(&cp, 0, sizeof(cp)); + cp.git_cmd = 1; + cp.argv = (const char **)argv+1; + return run_command(&cp); +} From 5cd3e10737135163f47e97e0338dbf33f4772511 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Mon, 27 Dec 2010 08:03:43 +0000 Subject: [PATCH 3/6] Fix false positives in t3404 due to SHELL=/bin/false If the user's shell in NSS passwd is /bin/false (eg as found during Gentoo's package building), the git-rebase exec tests will fail, because they call $SHELL around the command, and in the existing testcase, $SHELL was not being cleared sufficently. This lead to false positive failures of t3404 on systems where the package build user was locked down as noted above. Signed-off-by: "Robin H. Johnson" X-Gentoo-Bug: 349083 X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=349083 Signed-off-by: Junio C Hamano --- t/t3404-rebase-interactive.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 7d20a74c5c..9e9474e944 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -67,8 +67,9 @@ test_expect_success 'setup' ' # "exec" commands are ran with the user shell by default, but this may # be non-POSIX. For example, if SHELL=zsh then ">file" doesn't work # to create a file. Unseting SHELL avoids such non-portable behavior -# in tests. +# in tests. It must be exported for it to take effect where needed. SHELL= +export SHELL test_expect_success 'rebase -i with the exec command' ' git checkout master && From d2559f734bba7fe5257720356a92f3b7a5b0d37c Mon Sep 17 00:00:00 2001 From: Brandon Casey Date: Wed, 22 Dec 2010 15:58:53 -0800 Subject: [PATCH 4/6] t9001: use older Getopt::Long boolean prefix '--no' rather than '--no-' The '--no-chain-reply-to' option is a Getopt::Long boolean option. The '--no-' prefix (as in --no-chain-reply-to) for boolean options is not supported in Getopt::Long version 2.32 which was released with Perl 5.8.0. This version only supports '--no' as in '--nochain-reply-to'. More recent versions of Getopt::Long, such as version 2.34, support either prefix. So use the older form in the tests. See also: 907a0b1e04ea31cb368e9422df93d8ebb0187914 84eeb687de7a6c7c42af3fb51b176e0f412a979e 3fee1fe87144360a1913eab86af9ad136c810076 Signed-off-by: Brandon Casey Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 5e48318013..1dc4a9228e 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -319,7 +319,7 @@ test_expect_success $PREREQ 'In-Reply-To without --chain-reply-to' ' git send-email \ --from="Example " \ --to=nobody@example.com \ - --no-chain-reply-to \ + --nochain-reply-to \ --in-reply-to="$(cat expect)" \ --smtp-server="$(pwd)/fake.sendmail" \ $patches $patches $patches \ From 17367939ebd64f5e6eb4fa5a32ece513f497e6e6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 28 Dec 2010 13:48:54 -0800 Subject: [PATCH 5/6] Prepare for 1.7.3.5 Signed-off-by: Junio C Hamano --- Documentation/RelNotes/1.7.3.5.txt | 32 ++++++++++++++++++++++++++++++ RelNotes | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 Documentation/RelNotes/1.7.3.5.txt diff --git a/Documentation/RelNotes/1.7.3.5.txt b/Documentation/RelNotes/1.7.3.5.txt new file mode 100644 index 0000000000..8c266cde72 --- /dev/null +++ b/Documentation/RelNotes/1.7.3.5.txt @@ -0,0 +1,32 @@ +Git 1.7.3.5 Release Notes +========================= + + * The xfuncname pattern used by "git diff" and "git grep" to show the + last notable line in context were broken for python and ruby for a long + time. + + * "git merge" into an unborn branch removed an untracked file "foo" from + the working tree when merged branch had "foo" (this fix was already in + 1.7.3.3 but was omitted from the release notes by mistake). + + * "git status -s" did not quote unprintable characters in paths as + documented. + + * "git am --abort" used to always reset to the commit at the beginning of + the last "am" invocation that has stopped, losing any unrelated commits + that may have been made since then. Now it refrains from doing so and + instead issues a warning. + + * "git blame" incorrectly reused bogusly cached result of textconv + filter for files from the working tree. + + * "git commit" used to abort after the user edited the log message + when the committer information was not correctly set up. It now + aborts before starting the editor. + + * "git commit --date=invalid" used to silently ignore the incorrectly + specified date; it is now diagnosed as an error. + + * "git rebase --skip" to skip the last commit in a series used to fail + to run post-rewrite hook and to copy notes from old commits that have + successfully been rebased so far. Now it do (backmerge ef88ad2). diff --git a/RelNotes b/RelNotes index a6103a01d8..39dc075ee0 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes/1.7.3.4.txt \ No newline at end of file +Documentation/RelNotes/1.7.3.5.txt \ No newline at end of file From 01b97a4cb60723d18b437efdc474503d2a9dd384 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 28 Dec 2010 13:52:52 -0800 Subject: [PATCH 6/6] Git 1.7.4-rc0 Signed-off-by: Junio C Hamano --- Documentation/RelNotes/1.7.4.txt | 19 +++++++++---------- GIT-VERSION-GEN | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Documentation/RelNotes/1.7.4.txt b/Documentation/RelNotes/1.7.4.txt index ace061f5fe..b736d398cd 100644 --- a/Documentation/RelNotes/1.7.4.txt +++ b/Documentation/RelNotes/1.7.4.txt @@ -26,8 +26,9 @@ Updates since v1.7.3 cover letter of the previous series; this has been changed to make the patches in the new series replies to the new cover letter. - * Bash completion script in contrib/ has been adjusted to be also - usable by zsh. + * Bash completion script in contrib/ has been adjusted to be usable with + Bash 4 (options with '=value' didn't complete) It has been also made + usable with zsh. * Different pagers can be chosen depending on which subcommand is being run under the pager, using "pager." variable. @@ -76,8 +77,8 @@ Updates since v1.7.3 use the new --empty option to be more explicit instead. * "git repack -f" does not spend cycles to recompress objects in the - non-delta representation anymore (use -F if you really mean it when - e.g. you changed the compression level). + non-delta representation anymore (use -F if you really mean it + e.g. after you changed the core.compression variable setting). * "git merge --log" used to limit the resulting merge log to 20 entries; this is now customizable by giving e.g. "--log=47". @@ -91,8 +92,9 @@ Updates since v1.7.3 * The default "recursive" merge strategy learned --rename-threshold option to influence the rename detection, similar to the -M option - of "git diff". E.g. "git merge -Xrename-threshold=50% ..." to use - this. + of "git diff". From "git merge" frontend, "-X" + interface, e.g. "git merge -Xrename-threshold=50% ...", can be used + to trigger this. * The "recursive" strategy also learned to ignore various whitespace changes; the most notable is -Xignore-space-at-eol. @@ -130,9 +132,6 @@ release, unless otherwise noted. me or by her; instead it looked for commits written by me and by her, which is impossible. - * "git merge" into an unborn branch removed an untracked file "foo" - from the working tree when merged branch had "foo" (2caf20c..172b642). - * "git push --progress" shows progress indicators now. * "git repack" places its temporary packs under $GIT_OBJECT_DIRECTORY/pack @@ -143,6 +142,6 @@ release, unless otherwise noted. --- exec >/var/tmp/1 -O=v1.7.3.4-567-g38a5932 +O=v1.7.3.4-687-g2cd900f echo O=$(git describe master) git shortlog --no-merges ^maint ^$O master diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN index d441d88d6f..2b5133a27a 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.7.3.GIT +DEF_VER=v1.7.4-rc0 LF=' '