Skip to content

Commit 99e63ef

Browse files
committed
Merge branch 'maint'
* maint: rebase -i: clarify in-editor documentation of "exec" tests: sanitize more git environment variables fast-import: treat filemodify with empty tree as delete rebase: give a better error message for bogus branch rebase: use explicit "--" with checkout Conflicts: t/t9300-fast-import.sh
2 parents 630fc78 + 960ac5f commit 99e63ef

File tree

5 files changed

+55
-3
lines changed

5 files changed

+55
-3
lines changed

fast-import.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,6 +2231,12 @@ static void file_change_m(struct branch *b)
22312231
p = uq.buf;
22322232
}
22332233

2234+
/* Git does not track empty, non-toplevel directories. */
2235+
if (S_ISDIR(mode) && !memcmp(sha1, EMPTY_TREE_SHA1_BIN, 20) && *p) {
2236+
tree_content_remove(&b->branch_tree, p, NULL);
2237+
return;
2238+
}
2239+
22342240
if (S_ISGITLINK(mode)) {
22352241
if (inline_data)
22362242
die("Git links cannot be specified 'inline': %s",

git-rebase--interactive.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -894,7 +894,7 @@ first and then run 'git rebase --continue' again."
894894

895895
if test ! -z "$1"
896896
then
897-
output git checkout "$1" ||
897+
output git checkout "$1" -- ||
898898
die "Could not checkout $1"
899899
fi
900900

@@ -1021,7 +1021,7 @@ first and then run 'git rebase --continue' again."
10211021
# e, edit = use commit, but stop for amending
10221022
# s, squash = use commit, but meld into previous commit
10231023
# f, fixup = like "squash", but discard this commit's log message
1024-
# x <cmd>, exec <cmd> = Run a shell command <cmd>, and stop if it fails
1024+
# x, exec = run command (the rest of the line) using shell
10251025
#
10261026
# If you remove a line here THAT COMMIT WILL BE LOST.
10271027
# However, if you remove everything, the rebase will be aborted.

git-rebase.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,7 @@ case "$#" in
482482
then
483483
head_name="detached HEAD"
484484
else
485+
echo >&2 "fatal: no such branch: $1"
485486
usage
486487
fi
487488
;;
@@ -513,7 +514,7 @@ then
513514
if test -z "$force_rebase"
514515
then
515516
# Lazily switch to the target branch if needed...
516-
test -z "$switch_to" || git checkout "$switch_to"
517+
test -z "$switch_to" || git checkout "$switch_to" --
517518
say "Current branch $branch_name is up to date."
518519
exit 0
519520
else

t/t9300-fast-import.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,48 @@ test_expect_success \
919919
git diff-tree -C --find-copies-harder -r N4 N6 >actual &&
920920
compare_diff_raw expect actual'
921921

922+
test_expect_success \
923+
'N: delete directory by copying' \
924+
'cat >expect <<-\EOF &&
925+
OBJID
926+
:100644 000000 OBJID OBJID D foo/bar/qux
927+
OBJID
928+
:000000 100644 OBJID OBJID A foo/bar/baz
929+
:000000 100644 OBJID OBJID A foo/bar/qux
930+
EOF
931+
empty_tree=$(git mktree </dev/null) &&
932+
cat >input <<-INPUT_END &&
933+
commit refs/heads/N-delete
934+
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
935+
data <<COMMIT
936+
collect data to be deleted
937+
COMMIT
938+
939+
deleteall
940+
M 100644 inline foo/bar/baz
941+
data <<DATA_END
942+
hello
943+
DATA_END
944+
C "foo/bar/baz" "foo/bar/qux"
945+
C "foo/bar/baz" "foo/bar/quux/1"
946+
C "foo/bar/baz" "foo/bar/quuux"
947+
M 040000 $empty_tree foo/bar/quux
948+
M 040000 $empty_tree foo/bar/quuux
949+
950+
commit refs/heads/N-delete
951+
committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE
952+
data <<COMMIT
953+
delete subdirectory
954+
COMMIT
955+
956+
M 040000 $empty_tree foo/bar/qux
957+
INPUT_END
958+
git fast-import <input &&
959+
git rev-list N-delete |
960+
git diff-tree -r --stdin --root --always |
961+
sed -e "s/$_x40/OBJID/g" >actual &&
962+
test_cmp expect actual'
963+
922964
test_expect_success \
923965
'N: modify copied tree' \
924966
'cat >expect <<-\EOF &&

t/test-lib.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ unset GIT_NOTES_REF
7070
unset GIT_NOTES_DISPLAY_REF
7171
unset GIT_NOTES_REWRITE_REF
7272
unset GIT_NOTES_REWRITE_MODE
73+
unset GIT_REFLOG_ACTION
74+
unset GIT_CHERRY_PICK_HELP
75+
unset GIT_QUIET
7376
GIT_MERGE_VERBOSITY=5
7477
export GIT_MERGE_VERBOSITY
7578
export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME

0 commit comments

Comments
 (0)