Skip to content

Commit 553ea9d

Browse files
committed
Merge branch 'jk/sequencer-missing-author-name-check' into maint-2.38
Typofix in code. * jk/sequencer-missing-author-name-check: sequencer: detect author name errors in read_author_script()
2 parents ff8d1ec + 45350ae commit 553ea9d

File tree

2 files changed

+60
-1
lines changed

2 files changed

+60
-1
lines changed

sequencer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,7 +915,7 @@ int read_author_script(const char *path, char **name, char **email, char **date,
915915
error(_("missing 'GIT_AUTHOR_EMAIL'"));
916916
if (date_i == -2)
917917
error(_("missing 'GIT_AUTHOR_DATE'"));
918-
if (date_i < 0 || email_i < 0 || date_i < 0 || err)
918+
if (name_i < 0 || email_i < 0 || date_i < 0 || err)
919919
goto finish;
920920
*name = kv.items[name_i].util;
921921
*email = kv.items[email_i].util;

t/t3438-rebase-broken-files.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#!/bin/sh
2+
3+
test_description='rebase behavior when on-disk files are broken'
4+
. ./test-lib.sh
5+
6+
test_expect_success 'set up conflicting branches' '
7+
test_commit base file &&
8+
git checkout -b branch1 &&
9+
test_commit one file &&
10+
git checkout -b branch2 HEAD^ &&
11+
test_commit two file
12+
'
13+
14+
create_conflict () {
15+
test_when_finished "git rebase --abort" &&
16+
git checkout -B tmp branch2 &&
17+
test_must_fail git rebase branch1
18+
}
19+
20+
check_resolve_fails () {
21+
echo resolved >file &&
22+
git add file &&
23+
test_must_fail git rebase --continue
24+
}
25+
26+
for item in NAME EMAIL DATE
27+
do
28+
test_expect_success "detect missing GIT_AUTHOR_$item" '
29+
create_conflict &&
30+
31+
grep -v $item .git/rebase-merge/author-script >tmp &&
32+
mv tmp .git/rebase-merge/author-script &&
33+
34+
check_resolve_fails
35+
'
36+
done
37+
38+
for item in NAME EMAIL DATE
39+
do
40+
test_expect_success "detect duplicate GIT_AUTHOR_$item" '
41+
create_conflict &&
42+
43+
grep -i $item .git/rebase-merge/author-script >tmp &&
44+
cat tmp >>.git/rebase-merge/author-script &&
45+
46+
check_resolve_fails
47+
'
48+
done
49+
50+
test_expect_success 'unknown key in author-script' '
51+
create_conflict &&
52+
53+
echo "GIT_AUTHOR_BOGUS=${SQ}whatever${SQ}" \
54+
>>.git/rebase-merge/author-script &&
55+
56+
check_resolve_fails
57+
'
58+
59+
test_done

0 commit comments

Comments
 (0)