1 Star 0 Fork 0

小笼包/git

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
t4136-apply-check.sh 1.17 KB
一键复制 编辑 原始数据 按行查看 历史
Johannes Schindelin 提交于 2018-11-13 04:54 +08:00 . apply --recount: allow "no-op hunks"
#!/bin/sh
test_description='git apply should exit non-zero with unrecognized input.'
. ./test-lib.sh
test_expect_success 'setup' '
test_commit 1
'
test_expect_success 'apply --check exits non-zero with unrecognized input' '
test_must_fail git apply --check - <<-\EOF
I am not a patch
I look nothing like a patch
git apply must fail
EOF
'
test_expect_success 'apply exits non-zero with no-op patch' '
cat >input <<-\EOF &&
diff --get a/1 b/1
index 6696ea4..606eddd 100644
--- a/1
+++ b/1
@@ -1,1 +1,1 @@
1
EOF
test_must_fail git apply --stat input &&
test_must_fail git apply --check input
'
test_expect_success '`apply --recount` allows no-op patch' '
echo 1 >1 &&
git apply --recount --check <<-\EOF
diff --get a/1 b/1
index 6696ea4..606eddd 100644
--- a/1
+++ b/1
@@ -1,1 +1,1 @@
1
EOF
'
test_expect_success 'invalid combination: create and copy' '
test_must_fail git apply --check - <<-\EOF
diff --git a/1 b/2
new file mode 100644
copy from 1
copy to 2
EOF
'
test_expect_success 'invalid combination: create and rename' '
test_must_fail git apply --check - <<-\EOF
diff --git a/1 b/2
new file mode 100644
rename from 1
rename to 2
EOF
'
test_done
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xiaobaola/git.git
git@gitee.com:xiaobaola/git.git
xiaobaola
git
git
main

搜索帮助