From 5c09f321729c2f1ce6718a0cfefa5e647fa808fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Steinbrink?= Date: Mon, 3 Mar 2008 05:08:43 +0100 Subject: receive-pack: Initialize PATH to include exec-dir. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 511707d (use only the $PATH for exec'ing git commands) made it a requirement to call setup_path() to include the git exec-dir in PATH before spawning any other git commands. git-receive-pack was not yet adapted to do this and therefore fails to spawn git-unpack-objects if that is not in the standard PATH. Signed-off-by: Björn Steinbrink Signed-off-by: Junio C Hamano diff --git a/receive-pack.c b/receive-pack.c index 3267495..c90ec7d 100644 --- a/receive-pack.c +++ b/receive-pack.c @@ -469,6 +469,8 @@ int main(int argc, char **argv) if (!dir) usage(receive_pack_usage); + setup_path(NULL); + if (!enter_repo(dir, 0)) die("'%s': unable to chdir or not a git archive", dir); -- cgit v0.10.2-6-g49f6 From fcbcfe707ae23b37d72025a229f31c450fb4d3b3 Mon Sep 17 00:00:00 2001 From: Ping Yin Date: Mon, 3 Mar 2008 10:03:18 +0800 Subject: git-submodule: Fix typo 'url' which should be '$url' Fix typo in 'test -z "url"' when checking whether a submodule url is empty. "url" should be "$url". Signed-off-by: Ping Yin Signed-off-by: Junio C Hamano diff --git a/git-submodule.sh b/git-submodule.sh index a6aaf40..67d3224 100755 --- a/git-submodule.sh +++ b/git-submodule.sh @@ -362,7 +362,7 @@ cmd_status() do name=$(module_name "$path") || exit url=$(git config submodule."$name".url) - if test -z "url" || ! test -d "$path"/.git + if test -z "$url" || ! test -d "$path"/.git then say "-$sha1 $path" continue; -- cgit v0.10.2-6-g49f6 From 90d0ed96b76ee51f8ae6f32923b92e7b20ba73c0 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Thu, 28 Feb 2008 13:09:30 -0800 Subject: tests: introduce test_must_fail When we expect a git command to notice and signal errors, we carelessly wrote in our tests: test_expect_success 'reject bogus request' ' do something && do something else && ! git command ' but a non-zero exit could come from the "git command" segfaulting. A new helper function "tset_must_fail" is introduced and it is meant to be used to make sure the command gracefully fails (iow, dying and exiting with non zero status is counted as a failure to "gracefully fail"). The above example should be written as: test_expect_success 'reject bogus request' ' do something && do something else && test_must_fail git command ' Signed-off-by: Junio C Hamano diff --git a/t/t2008-checkout-subdir.sh b/t/t2008-checkout-subdir.sh index f78945e..3e098ab 100755 --- a/t/t2008-checkout-subdir.sh +++ b/t/t2008-checkout-subdir.sh @@ -67,16 +67,16 @@ test_expect_success 'checkout with simple prefix' ' ' -test_expect_failure 'relative path outside tree should fail' \ - 'git checkout HEAD -- ../../Makefile' +test_expect_success 'relative path outside tree should fail' \ + 'test_must_fail git checkout HEAD -- ../../Makefile' -test_expect_failure 'incorrect relative path to file should fail (1)' \ - 'git checkout HEAD -- ../file0' +test_expect_success 'incorrect relative path to file should fail (1)' \ + 'test_must_fail git checkout HEAD -- ../file0' -test_expect_failure 'incorrect relative path should fail (2)' \ - '( cd dir1 && git checkout HEAD -- ./file0 )' +test_expect_success 'incorrect relative path should fail (2)' \ + '( cd dir1 && test_must_fail git checkout HEAD -- ./file0 )' -test_expect_failure 'incorrect relative path should fail (3)' \ - '( cd dir1 && git checkout HEAD -- ../../file0 )' +test_expect_success 'incorrect relative path should fail (3)' \ + '( cd dir1 && test_must_fail git checkout HEAD -- ../../file0 )' test_done diff --git a/t/test-lib.sh b/t/test-lib.sh index 142540e..c0c5e21 100644 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@ -257,6 +257,23 @@ test_expect_code () { echo >&3 "" } +# This is not among top-level (test_expect_success | test_expect_failure) +# but is a prefix that can be used in the test script, like: +# +# test_expect_success 'complain and die' ' +# do something && +# do something else && +# test_must_fail git checkout ../outerspace +# ' +# +# Writing this as "! git checkout ../outerspace" is wrong, because +# the failure could be due to a segv. We want a controlled failure. + +test_must_fail () { + "$@" + test $? -gt 0 -a $? -le 128 +} + # Most tests can use the created repository, but some may need to create more. # Usage: test_create_repo test_create_repo () { -- cgit v0.10.2-6-g49f6 From 0f2d4476c12c15106be20d53c507035e157b66f1 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Mon, 3 Mar 2008 01:30:56 -0500 Subject: revert: actually check for a dirty index The previous code mistakenly used wt_status_prepare to check whether the index had anything commitable in it; however, that function is just an init function, and will never report a dirty index. The correct way with wt_status_* would be to call wt_status_print with the output pointing to /dev/null or similar. However, that does extra work by both examining the working tree and spewing status information to nowhere. Instead, let's just implement the useful subset of wt_status_print as an "is_index_dirty" function. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano diff --git a/builtin-revert.c b/builtin-revert.c index 358af53..64f0d0e 100644 --- a/builtin-revert.c +++ b/builtin-revert.c @@ -8,6 +8,8 @@ #include "exec_cmd.h" #include "utf8.h" #include "parse-options.h" +#include "diff.h" +#include "revision.h" /* * This implements the builtins revert and cherry-pick. @@ -245,6 +247,17 @@ static char *help_msg(const unsigned char *sha1) return helpbuf; } +static int index_is_dirty(void) +{ + struct rev_info rev; + init_revisions(&rev, NULL); + setup_revisions(0, NULL, &rev, "HEAD"); + DIFF_OPT_SET(&rev.diffopt, QUIET); + DIFF_OPT_SET(&rev.diffopt, EXIT_WITH_STATUS); + run_diff_index(&rev, 1); + return !!DIFF_OPT_TST(&rev.diffopt, HAS_CHANGES); +} + static int revert_or_cherry_pick(int argc, const char **argv) { unsigned char head[20]; @@ -273,12 +286,11 @@ static int revert_or_cherry_pick(int argc, const char **argv) if (write_tree(head, 0, NULL)) die ("Your index file is unmerged."); } else { - struct wt_status s; - if (get_sha1("HEAD", head)) die ("You do not have a valid HEAD"); - wt_status_prepare(&s); - if (s.commitable) + if (read_cache() < 0) + die("could not read the index"); + if (index_is_dirty()) die ("Dirty index: cannot %s", me); discard_cache(); } diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh index 2dbe04f..6da2128 100755 --- a/t/t3501-revert-cherry-pick.sh +++ b/t/t3501-revert-cherry-pick.sh @@ -59,4 +59,13 @@ test_expect_success 'revert after renaming branch' ' ' +test_expect_success 'revert forbidden on dirty working tree' ' + + echo content >extra_file && + git add extra_file && + test_must_fail git revert HEAD 2>errors && + grep "Dirty index" errors + +' + test_done -- cgit v0.10.2-6-g49f6 From d3df4271b900c9bf529cf495afeb77fbbf621221 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 2 Mar 2008 21:49:28 -0800 Subject: Update draft release notes for 1.5.4.4 Signed-off-by: Junio C Hamano diff --git a/Documentation/RelNotes-1.5.4.4.txt b/Documentation/RelNotes-1.5.4.4.txt index 5bfdb35..5635977 100644 --- a/Documentation/RelNotes-1.5.4.4.txt +++ b/Documentation/RelNotes-1.5.4.4.txt @@ -4,6 +4,10 @@ GIT v1.5.4.4 Release Notes Fixes since v1.5.4.3 -------------------- + * Building and installing with an overtight umask such as 077 made + installed templates unreadable by others, while the rest of the install + are done in a way that is friendly to umask 022. + * "git cvsexportcommit -w $cvsdir" misbehaved when GIT_DIR is set to a relative directory. @@ -17,10 +21,26 @@ Fixes since v1.5.4.3 * "git send-email" in 1.5.4.3 issued a bogus empty In-Reply-To: header. + * "git bisect" showed mysterious "won't bisect on seeked tree" error message. + This was leftover from Cogito days to prevent "bisect" starting from a + cg-seeked state. We still keep the Cogito safety, but running "git bisect + start" when another bisect was in effect will clean up and start over. + + * "git push" with an explicit PATH to receive-pack did not quite work if + receive-pack was not on usual PATH. We earlier fixed the same issue + with "git fetch" and upload-pack, but somehow forgot to do so in the + other direction. + + * git-gui's info dialog was not displayed correctly when the user tries + to commit nothing (i.e. without staging anything). + + * "git revert" did not properly fail when attempting to run with a + dirty index. + Also included are a handful documentation updates. --- exec >/var/tmp/1 echo O=$(git describe maint) -O=v1.5.4.3 +O=v1.5.4.3-32-g0f2d447 git shortlog --no-merges $O..maint -- cgit v0.10.2-6-g49f6