On Mon, May 13, 2024 at 06:14:34PM -0700, Junio C Hamano wrote:
A few commands, like "git apply" and "git patch-id", have been
broken with a recent change to stop setting the default hash
algorithm to SHA-1. Test them and fix them in later commits.
Is there a specific reason why this needs a whole patch suite, as
opposed to adding the tests to the respective test suites of the
commands?
quoted hunk ↗ jump to hunk
Signed-off-by: Junio C Hamano <redacted>
---
t/t1517-outside-repo.sh | 61 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
create mode 100755 t/t1517-outside-repo.sh
diff --git a/t/t1517-outside-repo.sh b/t/t1517-outside-repo.sh
new file mode 100755
index 0000000000..e0fd495ec1
--- /dev/null
+++ b/t/t1517-outside-repo.sh
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+test_description='check random commands outside repo'
+
+TEST_PASSES_SANITIZE_LEAK=true
+. ./test-lib.sh
+
+test_expect_success 'set up a non-repo directory and test file' '
+ GIT_CEILING_DIRECTORIES=$(pwd) &&
+ export GIT_CEILING_DIRECTORIES &&
+ mkdir non-repo &&
+ (
+ cd non-repo &&
+ # confirm that git does not find a repo
+ test_must_fail git rev-parse --git-dir
+ ) &&
+ test_write_lines one two three four >nums &&
+ git add nums &&
+ cp nums nums.old &&
+ test_write_lines five >>nums &&
+ git diff >sample.patch
+'
We have the "nongit" command that does most of this for us.
Patrick