diff --git a/Documentation/RelNotes-1.5.3.5.txt b/Documentation/RelNotes-1.5.3.5.txt index 6a1901a96d827dd90f38e87e2bb6c56a43b7b9e9..de38a84ad634eb42f630c12c007ee47f3fd3450b 100644 --- a/Documentation/RelNotes-1.5.3.5.txt +++ b/Documentation/RelNotes-1.5.3.5.txt @@ -4,21 +4,36 @@ GIT v1.5.3.5 Release Notes Fixes since v1.5.3.4 -------------------- - * "git-config" silently ignored options after --list; now it wilh + * "git-config" silently ignored options after --list; now it will error out with a usage message. * "git-config --file" failed if the argument used a relative path as it changed directories before opening the file. + * "git-config", "git-diff", "git-apply" failed if run from a + subdirectory with relative GIT_DIR and GIT_WORK_TREE set. + * "git-add -i" did not handle single line hunks correctly. + * "git-rebase -i" failed if external diff drivers were used for one + or more files in a commit. It now avoids calling the external + diff drivers. + * "git-log --follow" did not work unless diff generation (e.g. -p) was also requested. * "git-log" printed extra newlines between commits when a diff was generated internally (e.g. -S or --follow) but not displayed. - * Documention updates for supported (but previously undocumented) + * "git-push" error message is more helpful when pushing to a + repository with no matching refs and none specified. + + * "git-filter-branch" now updates the working directory when it + has finished filtering the current branch. + + * "git-instaweb" no longer fails on Mac OS X. + + * Documentation updates for supported (but previously undocumented) options of "git-archive" and "git-reflog". * "make clean" no longer deletes the configure script that ships diff --git a/Documentation/git-filter-branch.txt b/Documentation/git-filter-branch.txt index c878ed395eb27de02efda2e3018ae76fbb799c7b..ba9b4fbca79321003f8cda6341d066f9ccc00349 100644 --- a/Documentation/git-filter-branch.txt +++ b/Documentation/git-filter-branch.txt @@ -180,8 +180,7 @@ A significantly faster version: git filter-branch --index-filter 'git update-index --remove filename' HEAD -------------------------------------------------------------------------- -Now, you will get the rewritten history saved in the branch 'newbranch' -(your current branch is left untouched). +Now, you will get the rewritten history saved in HEAD. To set a commit (which typically is at the tip of another history) to be the parent of the current initial commit, in diff --git a/git-filter-branch.sh b/git-filter-branch.sh index a12f6c2d4c7ad3c4f69a783f7255b3010224d0c3..ffcc408ee5217d7a8f6179a0404ffe387e0dab0f 100755 --- a/git-filter-branch.sh +++ b/git-filter-branch.sh @@ -94,6 +94,10 @@ USAGE="[--env-filter ] [--tree-filter ] \ . git-sh-setup +git diff-files --quiet && + git diff-index --cached --quiet HEAD || + die "Cannot rewrite branch(es) with a dirty working directory." + tempdir=.git-rewrite filter_env= filter_tree= @@ -196,6 +200,9 @@ do esac done < "$tempdir"/backup-refs +ORIG_GIT_DIR="$GIT_DIR" +ORIG_GIT_WORK_TREE="$GIT_WORK_TREE" +ORIG_GIT_INDEX_FILE="$GIT_INDEX_FILE" export GIT_DIR GIT_WORK_TREE=. # These refs should be updated if their heads were rewritten @@ -413,4 +420,12 @@ echo test $count -gt 0 && echo "These refs were rewritten:" git show-ref | grep ^"$orig_namespace" +unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE +test -z "$ORIG_GIT_DIR" || GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR +test -z "$ORIG_GIT_WORK_TREE" || GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" && + export GIT_WORK_TREE +test -z "$ORIG_GIT_INDEX_FILE" || GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" && + export GIT_INDEX_FILE +git read-tree -u -m HEAD + exit $ret diff --git a/git-instaweb.sh b/git-instaweb.sh index 2e4eeccaceb434696071be9a8a2f6af24000d976..95c3e5aa1f9bd5f0cec215ee2f81b2d4c36ea929 100755 --- a/git-instaweb.sh +++ b/git-instaweb.sh @@ -30,8 +30,7 @@ test -z "$port" && port=1234 start_httpd () { httpd_only="`echo $httpd | cut -f1 -d' '`" - if test "`expr index $httpd_only /`" -eq '1' || \ - which $httpd_only >/dev/null + if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null;; esac then $httpd $fqgitdir/gitweb/httpd.conf else diff --git a/send-pack.c b/send-pack.c index 16ed51f6a012899e6e59eac6f4b657aa24f1c8df..c1807f07946ca204bc1e8307eed04150e62c551d 100644 --- a/send-pack.c +++ b/send-pack.c @@ -205,7 +205,8 @@ static int send_pack(int in, int out, struct remote *remote, int nr_refspec, cha return -1; if (!remote_refs) { - fprintf(stderr, "No refs in common and none specified; doing nothing.\n"); + fprintf(stderr, "No refs in common and none specified; doing nothing.\n" + "Perhaps you should specify a branch such as 'master'.\n"); return 0; } diff --git a/setup.c b/setup.c index 06004f15874fbcbab50eafd272c5898a34fcdcfe..145eca50f41d811c4c8fcb21ed2604e6b2971aba 100644 --- a/setup.c +++ b/setup.c @@ -227,9 +227,20 @@ const char *setup_git_directory_gently(int *nongit_ok) if (PATH_MAX - 40 < strlen(gitdirenv)) die("'$%s' too big", GIT_DIR_ENVIRONMENT); if (is_git_directory(gitdirenv)) { + static char buffer[1024 + 1]; + const char *retval; + if (!work_tree_env) return set_work_tree(gitdirenv); - return NULL; + retval = get_relative_cwd(buffer, sizeof(buffer) - 1, + get_git_work_tree()); + if (!retval || !*retval) + return NULL; + set_git_dir(make_absolute_path(gitdirenv)); + if (chdir(work_tree_env) < 0) + die ("Could not chdir to %s", work_tree_env); + strcat(buffer, "/"); + return retval; } if (nongit_ok) { *nongit_ok = 1; diff --git a/t/t1501-worktree.sh b/t/t1501-worktree.sh index 732216184ffc255a385aac81ba970edfc6a9e83a..7ee3820ce97b6c26c9465685a7bc64a962aad3cb 100755 --- a/t/t1501-worktree.sh +++ b/t/t1501-worktree.sh @@ -103,4 +103,13 @@ test_expect_success 'repo finds its work tree from work tree, too' ' test sub/dir/tracked = "$(git ls-files)") ' +test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' ' + cd repo.git/work/sub/dir && + GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \ + git diff --exit-code tracked && + echo changed > tracked && + ! GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \ + git diff --exit-code tracked +' + test_done diff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh index e935b2000ac6589a4940f585616f8bf3be95223b..2089351f7d157ce96a07ed1c6c1465fc58819ec0 100755 --- a/t/t7003-filter-branch.sh +++ b/t/t7003-filter-branch.sh @@ -41,7 +41,9 @@ test_expect_success 'rewrite, renaming a specific file' ' ' test_expect_success 'test that the file was renamed' ' - test d = $(git show HEAD:doh) + test d = $(git show HEAD:doh) && + test -f doh && + test d = $(cat doh) ' git tag oldD HEAD~4