From 52a2e4c1dc270c95366d05687de514caed95f695 Mon Sep 17 00:00:00 2001 From: Ryooooooga Date: Sun, 16 Oct 2022 21:31:42 +0900 Subject: fix: fix ambiguous branch name test: add an integration test for checkout branch by name fix: fix full ref name of detached head refactor: refactor current branch loader chore: use field name explicitly --- .../expected/repo/.git_keep/COMMIT_EDITMSG | 1 + .../checkout_by_name/expected/repo/.git_keep/FETCH_HEAD | 0 .../branch/checkout_by_name/expected/repo/.git_keep/HEAD | 1 + .../expected/repo/.git_keep/commit-template.txt | 0 .../checkout_by_name/expected/repo/.git_keep/config | 12 ++++++++++++ .../checkout_by_name/expected/repo/.git_keep/description | 1 + .../branch/checkout_by_name/expected/repo/.git_keep/index | Bin 0 -> 305 bytes .../checkout_by_name/expected/repo/.git_keep/info/exclude | 0 .../checkout_by_name/expected/repo/.git_keep/logs/HEAD | 7 +++++++ .../expected/repo/.git_keep/logs/refs/heads/@ | 1 + .../expected/repo/.git_keep/logs/refs/heads/master | 4 ++++ .../expected/repo/.git_keep/logs/refs/heads/new-branch | 1 + .../objects/06/47fe4b7302efbfb235b8f0681b592cc3389d36 | Bin 0 -> 30 bytes .../objects/18/565748bda3ca01a67a92f340705af5a11384ae | 3 +++ .../objects/3b/f868a389d0073e715e848f0ee33d71064539ca | Bin 0 -> 30 bytes .../objects/47/d78ad7a27fc7fe483389512ebf7ea34c5514bc | Bin 0 -> 30 bytes .../objects/55/3197193920043fb04f3e39e825916990955204 | Bin 0 -> 55 bytes .../objects/6d/69ac71e12a83769fca195d0a714435e1f4661a | 3 +++ .../objects/95/efd4ea6ed74b904cd8eeeaa6245ec462372f67 | Bin 0 -> 117 bytes .../objects/a0/2c4b36b68df7081152282cf1aabcab7b24e69b | Bin 0 -> 81 bytes .../objects/cf/c66e0e89b1dc11a927cc453dbee025ff03cf83 | 3 +++ .../objects/e6/db1f58c2bb5ead41049a8ef3910360eead21e2 | Bin 0 -> 108 bytes .../checkout_by_name/expected/repo/.git_keep/refs/heads/@ | 1 + .../expected/repo/.git_keep/refs/heads/master | 1 + .../expected/repo/.git_keep/refs/heads/new-branch | 1 + .../branch/checkout_by_name/expected/repo/file01.txt | 1 + .../branch/checkout_by_name/expected/repo/file02.txt | 1 + .../branch/checkout_by_name/expected/repo/file03.txt | 1 + 28 files changed, 43 insertions(+) create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/COMMIT_EDITMSG create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/FETCH_HEAD create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/HEAD create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/commit-template.txt create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/config create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/description create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/index create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/info/exclude create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/HEAD create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/@ create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/master create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/new-branch create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/06/47fe4b7302efbfb235b8f0681b592cc3389d36 create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/18/565748bda3ca01a67a92f340705af5a11384ae create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/3b/f868a389d0073e715e848f0ee33d71064539ca create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/47/d78ad7a27fc7fe483389512ebf7ea34c5514bc create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/55/3197193920043fb04f3e39e825916990955204 create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/6d/69ac71e12a83769fca195d0a714435e1f4661a create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/95/efd4ea6ed74b904cd8eeeaa6245ec462372f67 create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/a0/2c4b36b68df7081152282cf1aabcab7b24e69b create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/cf/c66e0e89b1dc11a927cc453dbee025ff03cf83 create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/e6/db1f58c2bb5ead41049a8ef3910360eead21e2 create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/@ create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/master create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/new-branch create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/file01.txt create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/file02.txt create mode 100644 test/integration_new/branch/checkout_by_name/expected/repo/file03.txt (limited to 'test/integration_new/branch/checkout_by_name') diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/COMMIT_EDITMSG b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/COMMIT_EDITMSG new file mode 100644 index 000000000..907b30816 --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/COMMIT_EDITMSG @@ -0,0 +1 @@ +blah diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/FETCH_HEAD b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/FETCH_HEAD new file mode 100644 index 000000000..e69de29bb diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/HEAD b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/HEAD new file mode 100644 index 000000000..574f30abf --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/HEAD @@ -0,0 +1 @@ +ref: refs/heads/new-branch diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/commit-template.txt b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/commit-template.txt new file mode 100644 index 000000000..e69de29bb diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/config b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/config new file mode 100644 index 000000000..8a748ce32 --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/config @@ -0,0 +1,12 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true + ignorecase = true + precomposeunicode = true +[user] + email = CI@example.com + name = CI +[commit] + gpgSign = false diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/description b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/description new file mode 100644 index 000000000..498b267a8 --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/description @@ -0,0 +1 @@ +Unnamed repository; edit this file 'description' to name the repository. diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/index b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/index new file mode 100644 index 000000000..5e9399cf8 Binary files /dev/null and b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/index differ diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/info/exclude b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/info/exclude new file mode 100644 index 000000000..e69de29bb diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/HEAD b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/HEAD new file mode 100644 index 000000000..d34fb4066 --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/HEAD @@ -0,0 +1,7 @@ +0000000000000000000000000000000000000000 95efd4ea6ed74b904cd8eeeaa6245ec462372f67 CI 1665924398 +0900 commit (initial): commit 01 +95efd4ea6ed74b904cd8eeeaa6245ec462372f67 cfc66e0e89b1dc11a927cc453dbee025ff03cf83 CI 1665924398 +0900 commit: commit 02 +cfc66e0e89b1dc11a927cc453dbee025ff03cf83 6d69ac71e12a83769fca195d0a714435e1f4661a CI 1665924398 +0900 commit: commit 03 +6d69ac71e12a83769fca195d0a714435e1f4661a 6d69ac71e12a83769fca195d0a714435e1f4661a CI 1665924398 +0900 checkout: moving from master to @ +6d69ac71e12a83769fca195d0a714435e1f4661a 6d69ac71e12a83769fca195d0a714435e1f4661a CI 1665924398 +0900 checkout: moving from @ to master +6d69ac71e12a83769fca195d0a714435e1f4661a 18565748bda3ca01a67a92f340705af5a11384ae CI 1665924398 +0900 commit: blah +18565748bda3ca01a67a92f340705af5a11384ae 6d69ac71e12a83769fca195d0a714435e1f4661a CI 1665924403 +0900 checkout: moving from master to new-branch diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/@ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/@ new file mode 100644 index 000000000..96ceab46c --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/@ @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 6d69ac71e12a83769fca195d0a714435e1f4661a CI 1665924398 +0900 branch: Created from HEAD diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/master b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/master new file mode 100644 index 000000000..d04f9469b --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/master @@ -0,0 +1,4 @@ +0000000000000000000000000000000000000000 95efd4ea6ed74b904cd8eeeaa6245ec462372f67 CI 1665924398 +0900 commit (initial): commit 01 +95efd4ea6ed74b904cd8eeeaa6245ec462372f67 cfc66e0e89b1dc11a927cc453dbee025ff03cf83 CI 1665924398 +0900 commit: commit 02 +cfc66e0e89b1dc11a927cc453dbee025ff03cf83 6d69ac71e12a83769fca195d0a714435e1f4661a CI 1665924398 +0900 commit: commit 03 +6d69ac71e12a83769fca195d0a714435e1f4661a 18565748bda3ca01a67a92f340705af5a11384ae CI 1665924398 +0900 commit: blah diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/new-branch b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/new-branch new file mode 100644 index 000000000..dcfac6de4 --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/logs/refs/heads/new-branch @@ -0,0 +1 @@ +0000000000000000000000000000000000000000 6d69ac71e12a83769fca195d0a714435e1f4661a CI 1665924403 +0900 branch: Created from refs/heads/@ diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/06/47fe4b7302efbfb235b8f0681b592cc3389d36 b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/06/47fe4b7302efbfb235b8f0681b592cc3389d36 new file mode 100644 index 000000000..a8a2b586d Binary files /dev/null and b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/06/47fe4b7302efbfb235b8f0681b592cc3389d36 differ diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/18/565748bda3ca01a67a92f340705af5a11384ae b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/18/565748bda3ca01a67a92f340705af5a11384ae new file mode 100644 index 000000000..111cf1d1f --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/18/565748bda3ca01a67a92f340705af5a11384ae @@ -0,0 +1,3 @@ +xM +0@a9Ed3̀U1I&ThL)<=ۏx.т%A 1۔p`=4$XnBB1<.T3~yyyʗ۾-ЀzGQ_ N=~\ +9f \ No newline at end of file diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/3b/f868a389d0073e715e848f0ee33d71064539ca b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/3b/f868a389d0073e715e848f0ee33d71064539ca new file mode 100644 index 000000000..07b07e91f Binary files /dev/null and b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/3b/f868a389d0073e715e848f0ee33d71064539ca differ diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/47/d78ad7a27fc7fe483389512ebf7ea34c5514bc b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/47/d78ad7a27fc7fe483389512ebf7ea34c5514bc new file mode 100644 index 000000000..c562d38cc Binary files /dev/null and b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/47/d78ad7a27fc7fe483389512ebf7ea34c5514bc differ diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/55/3197193920043fb04f3e39e825916990955204 b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/55/3197193920043fb04f3e39e825916990955204 new file mode 100644 index 000000000..ac90c394a Binary files /dev/null and b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/55/3197193920043fb04f3e39e825916990955204 differ diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/6d/69ac71e12a83769fca195d0a714435e1f4661a b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/6d/69ac71e12a83769fca195d0a714435e1f4661a new file mode 100644 index 000000000..075130a92 --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/6d/69ac71e12a83769fca195d0a714435e1f4661a @@ -0,0 +1,3 @@ +x= +1@abzAfgDdq%w `'K06UX Ė4WO9'm ]Dݛ%f͛H5q*DYW*:iəei4ԓ, +c`'8"#SC?; \ No newline at end of file diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/95/efd4ea6ed74b904cd8eeeaa6245ec462372f67 b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/95/efd4ea6ed74b904cd8eeeaa6245ec462372f67 new file mode 100644 index 000000000..4001d6ab3 Binary files /dev/null and b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/95/efd4ea6ed74b904cd8eeeaa6245ec462372f67 differ diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/a0/2c4b36b68df7081152282cf1aabcab7b24e69b b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/a0/2c4b36b68df7081152282cf1aabcab7b24e69b new file mode 100644 index 000000000..85866acd8 Binary files /dev/null and b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/a0/2c4b36b68df7081152282cf1aabcab7b24e69b differ diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/cf/c66e0e89b1dc11a927cc453dbee025ff03cf83 b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/cf/c66e0e89b1dc11a927cc453dbee025ff03cf83 new file mode 100644 index 000000000..3e1a2801d --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/cf/c66e0e89b1dc11a927cc453dbee025ff03cf83 @@ -0,0 +1,3 @@ +xA +1 @Q=E4mADH C,<[Ʀ +bP8s-GXErH)U6} H^[%('KFUa$/78Ϸ~O=_14G5{ݧ,/[; \ No newline at end of file diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/e6/db1f58c2bb5ead41049a8ef3910360eead21e2 b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/e6/db1f58c2bb5ead41049a8ef3910360eead21e2 new file mode 100644 index 000000000..8bcfafeb6 Binary files /dev/null and b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/objects/e6/db1f58c2bb5ead41049a8ef3910360eead21e2 differ diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/@ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/@ new file mode 100644 index 000000000..2f00c9f3a --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/@ @@ -0,0 +1 @@ +6d69ac71e12a83769fca195d0a714435e1f4661a diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/master b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/master new file mode 100644 index 000000000..15e666674 --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/master @@ -0,0 +1 @@ +18565748bda3ca01a67a92f340705af5a11384ae diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/new-branch b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/new-branch new file mode 100644 index 000000000..2f00c9f3a --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/.git_keep/refs/heads/new-branch @@ -0,0 +1 @@ +6d69ac71e12a83769fca195d0a714435e1f4661a diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/file01.txt b/test/integration_new/branch/checkout_by_name/expected/repo/file01.txt new file mode 100644 index 000000000..47d78ad7a --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/file01.txt @@ -0,0 +1 @@ +file01 content \ No newline at end of file diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/file02.txt b/test/integration_new/branch/checkout_by_name/expected/repo/file02.txt new file mode 100644 index 000000000..0647fe4b7 --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/file02.txt @@ -0,0 +1 @@ +file02 content \ No newline at end of file diff --git a/test/integration_new/branch/checkout_by_name/expected/repo/file03.txt b/test/integration_new/branch/checkout_by_name/expected/repo/file03.txt new file mode 100644 index 000000000..3bf868a38 --- /dev/null +++ b/test/integration_new/branch/checkout_by_name/expected/repo/file03.txt @@ -0,0 +1 @@ +file03 content \ No newline at end of file -- cgit v1.2.3