Skip to content

Commit 317efa6

Browse files
committed
Merge branch 'maint'
* maint: Document additional 1.5.3.5 fixes in release notes Avoid 'expr index' on Mac OS X as it isn't supported filter-branch: update current branch when rewritten fix filter-branch documentation helpful error message when send-pack finds no refs in common. Fix setup_git_directory_gently() with relative GIT_DIR & GIT_WORK_TREE Correct typos in release notes for 1.5.3.5
2 parents 54f0db7 + 0995520 commit 317efa6

File tree

8 files changed

+60
-9
lines changed

8 files changed

+60
-9
lines changed

Documentation/RelNotes-1.5.3.5.txt

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,36 @@ GIT v1.5.3.5 Release Notes
44
Fixes since v1.5.3.4
55
--------------------
66

7-
* "git-config" silently ignored options after --list; now it wilh
7+
* "git-config" silently ignored options after --list; now it will
88
error out with a usage message.
99

1010
* "git-config --file" failed if the argument used a relative path
1111
as it changed directories before opening the file.
1212

13+
* "git-config", "git-diff", "git-apply" failed if run from a
14+
subdirectory with relative GIT_DIR and GIT_WORK_TREE set.
15+
1316
* "git-add -i" did not handle single line hunks correctly.
1417

18+
* "git-rebase -i" failed if external diff drivers were used for one
19+
or more files in a commit. It now avoids calling the external
20+
diff drivers.
21+
1522
* "git-log --follow" did not work unless diff generation (e.g. -p)
1623
was also requested.
1724

1825
* "git-log" printed extra newlines between commits when a diff
1926
was generated internally (e.g. -S or --follow) but not displayed.
2027

21-
* Documention updates for supported (but previously undocumented)
28+
* "git-push" error message is more helpful when pushing to a
29+
repository with no matching refs and none specified.
30+
31+
* "git-filter-branch" now updates the working directory when it
32+
has finished filtering the current branch.
33+
34+
* "git-instaweb" no longer fails on Mac OS X.
35+
36+
* Documentation updates for supported (but previously undocumented)
2237
options of "git-archive" and "git-reflog".
2338

2439
* "make clean" no longer deletes the configure script that ships

Documentation/git-filter-branch.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,7 @@ A significantly faster version:
180180
git filter-branch --index-filter 'git update-index --remove filename' HEAD
181181
--------------------------------------------------------------------------
182182

183-
Now, you will get the rewritten history saved in the branch 'newbranch'
184-
(your current branch is left untouched).
183+
Now, you will get the rewritten history saved in HEAD.
185184

186185
To set a commit (which typically is at the tip of another
187186
history) to be the parent of the current initial commit, in

git-filter-branch.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ USAGE="[--env-filter <command>] [--tree-filter <command>] \
9494

9595
. git-sh-setup
9696

97+
git diff-files --quiet &&
98+
git diff-index --cached --quiet HEAD ||
99+
die "Cannot rewrite branch(es) with a dirty working directory."
100+
97101
tempdir=.git-rewrite
98102
filter_env=
99103
filter_tree=
@@ -196,6 +200,9 @@ do
196200
esac
197201
done < "$tempdir"/backup-refs
198202

203+
ORIG_GIT_DIR="$GIT_DIR"
204+
ORIG_GIT_WORK_TREE="$GIT_WORK_TREE"
205+
ORIG_GIT_INDEX_FILE="$GIT_INDEX_FILE"
199206
export GIT_DIR GIT_WORK_TREE=.
200207

201208
# These refs should be updated if their heads were rewritten
@@ -413,4 +420,12 @@ echo
413420
test $count -gt 0 && echo "These refs were rewritten:"
414421
git show-ref | grep ^"$orig_namespace"
415422

423+
unset GIT_DIR GIT_WORK_TREE GIT_INDEX_FILE
424+
test -z "$ORIG_GIT_DIR" || GIT_DIR="$ORIG_GIT_DIR" && export GIT_DIR
425+
test -z "$ORIG_GIT_WORK_TREE" || GIT_WORK_TREE="$ORIG_GIT_WORK_TREE" &&
426+
export GIT_WORK_TREE
427+
test -z "$ORIG_GIT_INDEX_FILE" || GIT_INDEX_FILE="$ORIG_GIT_INDEX_FILE" &&
428+
export GIT_INDEX_FILE
429+
git read-tree -u -m HEAD
430+
416431
exit $ret

git-instaweb.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ test -z "$port" && port=1234
3030

3131
start_httpd () {
3232
httpd_only="`echo $httpd | cut -f1 -d' '`"
33-
if test "`expr index $httpd_only /`" -eq '1' || \
34-
which $httpd_only >/dev/null
33+
if case "$httpd_only" in /*) : ;; *) which $httpd_only >/dev/null;; esac
3534
then
3635
$httpd $fqgitdir/gitweb/httpd.conf
3736
else

send-pack.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,8 @@ static int send_pack(int in, int out, struct remote *remote, int nr_refspec, cha
205205
return -1;
206206

207207
if (!remote_refs) {
208-
fprintf(stderr, "No refs in common and none specified; doing nothing.\n");
208+
fprintf(stderr, "No refs in common and none specified; doing nothing.\n"
209+
"Perhaps you should specify a branch such as 'master'.\n");
209210
return 0;
210211
}
211212

setup.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,20 @@ const char *setup_git_directory_gently(int *nongit_ok)
227227
if (PATH_MAX - 40 < strlen(gitdirenv))
228228
die("'$%s' too big", GIT_DIR_ENVIRONMENT);
229229
if (is_git_directory(gitdirenv)) {
230+
static char buffer[1024 + 1];
231+
const char *retval;
232+
230233
if (!work_tree_env)
231234
return set_work_tree(gitdirenv);
232-
return NULL;
235+
retval = get_relative_cwd(buffer, sizeof(buffer) - 1,
236+
get_git_work_tree());
237+
if (!retval || !*retval)
238+
return NULL;
239+
set_git_dir(make_absolute_path(gitdirenv));
240+
if (chdir(work_tree_env) < 0)
241+
die ("Could not chdir to %s", work_tree_env);
242+
strcat(buffer, "/");
243+
return retval;
233244
}
234245
if (nongit_ok) {
235246
*nongit_ok = 1;

t/t1501-worktree.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,13 @@ test_expect_success 'repo finds its work tree from work tree, too' '
103103
test sub/dir/tracked = "$(git ls-files)")
104104
'
105105

106+
test_expect_success '_gently() groks relative GIT_DIR & GIT_WORK_TREE' '
107+
cd repo.git/work/sub/dir &&
108+
GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \
109+
git diff --exit-code tracked &&
110+
echo changed > tracked &&
111+
! GIT_DIR=../../.. GIT_WORK_TREE=../.. GIT_PAGER= \
112+
git diff --exit-code tracked
113+
'
114+
106115
test_done

t/t7003-filter-branch.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ test_expect_success 'rewrite, renaming a specific file' '
4141
'
4242

4343
test_expect_success 'test that the file was renamed' '
44-
test d = $(git show HEAD:doh)
44+
test d = $(git show HEAD:doh) &&
45+
test -f doh &&
46+
test d = $(cat doh)
4547
'
4648

4749
git tag oldD HEAD~4

0 commit comments

Comments
 (0)