-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'jc/undecided-is-not-necessarily-sha1-fix' into seen
The base topic started to make it an error for a command to leave the hash algorithm unspecified, which revealed a few commands that were not ready for the change. Give users a knob to revert back to the "default is sha-1" behaviour as an escape hatch, and start fixing these breakages. Comments? * jc/undecided-is-not-necessarily-sha1-fix: apply: fix uninitialized hash function builtin/hash-object: fix uninitialized hash function builtin/patch-id: fix uninitialized hash function t1517: test commands that are designed to be run outside repository setup: add an escape hatch for "no more default hash algorithm" change
- Loading branch information
Showing
9 changed files
with
162 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
' | ||
|
||
test_expect_success 'compute a patch-id outside repository' ' | ||
git patch-id <sample.patch >patch-id.expect && | ||
( | ||
cd non-repo && | ||
git patch-id <../sample.patch >../patch-id.actual | ||
) && | ||
test_cmp patch-id.expect patch-id.actual | ||
' | ||
|
||
test_expect_success 'hash-object outside repository' ' | ||
git hash-object --stdin <sample.patch >hash.expect && | ||
( | ||
cd non-repo && | ||
git hash-object --stdin <../sample.patch >../hash.actual | ||
) && | ||
test_cmp hash.expect hash.actual | ||
' | ||
|
||
test_expect_success 'apply a patch outside repository' ' | ||
( | ||
cd non-repo && | ||
cp ../nums.old nums && | ||
git apply ../sample.patch | ||
) && | ||
test_cmp nums non-repo/nums | ||
' | ||
|
||
test_expect_success 'grep outside repository' ' | ||
git grep --cached two >expect && | ||
( | ||
cd non-repo && | ||
cp ../nums.old nums && | ||
git grep --no-index two >../actual | ||
) && | ||
test_cmp expect actual | ||
' | ||
|
||
test_done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters