{"thread":{"id":"4285","subject":"[PATCH] Test that git-branch -l works.","startedAt":"2006-05-25T03:34:04Z","lastAt":"2006-05-25T03:34:04Z","messageCount":1,"participants":["Shawn Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"20664","messageId":"20060525033404.GC4403@spearce.org","threadId":"4285","inReplyTo":null,"subject":"[PATCH] Test that git-branch -l works.","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-05-25T03:34:04Z","receivedAt":"2006-05-25T03:34:04Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"If the user supplies -l to git-branch when creating a new branch\nthen the new branch's log should be created automatically and the\nbranch creation should be logged in that log.\n\nFurther if a branch is being deleted and it had a log then also\nverify that the log was deleted.\n\nTest git-checkout -b foo -l for creating a new branch foo with a\nlog and checking out that branch.\n\nFixed git-checkout -b foo -l as the branch variable name was\nincorrect in the script.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n git-checkout.sh   |    4 ++--\n t/t3200-branch.sh |   31 ++++++++++++++++++++++++++++++-\n 2 files changed, 32 insertions(+), 3 deletions(-)\n\ndiff --git a/git-checkout.sh b/git-checkout.sh\nindex 360aabf..564117f 100755\n--- a/git-checkout.sh\n+++ b/git-checkout.sh\n@@ -197,8 +197,8 @@ #\n if [ \"$?\" -eq 0 ]; then\n \tif [ \"$newbranch\" ]; then\n \t\tif [ \"$newbranch_log\" ]; then\n-\t\t\tmkdir -p $(dirname \"$GIT_DIR/logs/refs/heads/$branchname\")\n-\t\t\ttouch \"$GIT_DIR/logs/refs/heads/$branchname\"\n+\t\t\tmkdir -p $(dirname \"$GIT_DIR/logs/refs/heads/$newbranch\")\n+\t\t\ttouch \"$GIT_DIR/logs/refs/heads/$newbranch\"\n \t\tfi\n \t\tgit-update-ref -m \"checkout: Created from $new_name\" \"refs/heads/$newbranch\" $new || exit\n \t\tbranch=\"$newbranch\"\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex c3de151..5b04efc 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -14,7 +14,8 @@ test_expect_success \\\n     'prepare an trivial repository' \\\n     'echo Hello > A &&\n      git-update-index --add A &&\n-     git-commit -m \"Initial commit.\"'\n+     git-commit -m \"Initial commit.\" &&\n+     HEAD=$(git-rev-parse --verify HEAD)'\n \n test_expect_success \\\n     'git branch --help should return success now.' \\\n@@ -32,4 +33,32 @@ test_expect_success \\\n     'git branch a/b/c should create a branch' \\\n     'git-branch a/b/c && test -f .git/refs/heads/a/b/c'\n \n+cat >expect <<EOF\n+0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000\tbranch: Created from HEAD\n+EOF\n+test_expect_success \\\n+    'git branch -l d/e/f should create a branch and a log' \\\n+\t'GIT_COMMITTER_DATE=\"2005-05-26 23:30\" \\\n+     git-branch -l d/e/f &&\n+\t test -f .git/refs/heads/d/e/f &&\n+\t test -f .git/logs/refs/heads/d/e/f &&\n+\t diff expect .git/logs/refs/heads/d/e/f'\n+\n+test_expect_success \\\n+    'git branch -d d/e/f should delete a branch and a log' \\\n+\t'git-branch -d d/e/f &&\n+\t test ! -f .git/refs/heads/d/e/f &&\n+\t test ! -f .git/logs/refs/heads/d/e/f'\n+\n+cat >expect <<EOF\n+0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000\tcheckout: Created from master^0\n+EOF\n+test_expect_success \\\n+    'git checkout -b g/h/i -l should create a branch and a log' \\\n+\t'GIT_COMMITTER_DATE=\"2005-05-26 23:30\" \\\n+     git-checkout -b g/h/i -l master &&\n+\t test -f .git/refs/heads/g/h/i &&\n+\t test -f .git/logs/refs/heads/g/h/i &&\n+\t diff expect .git/logs/refs/heads/g/h/i'\n+\n test_done\n-- \n1.3.3.g45d8\n"}]}