{"thread":{"id":"4210","subject":"[PATCH 4/5] Create/delete branch ref logs.","startedAt":"2006-05-19T09:16:58Z","lastAt":"2006-05-19T09:16:58Z","messageCount":1,"participants":["Shawn Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"20284","messageId":"20060519091658.GL22257@spearce.org","threadId":"4210","inReplyTo":null,"subject":"[PATCH 4/5] Create/delete branch ref logs.","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-05-19T09:16:58Z","receivedAt":"2006-05-19T09:16:58Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"When crating a new branch offer '-l' as a way for the user to\nquickly enable ref logging for the new branch.\n\nWhen deleting a branch also delete its ref log.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n\n---\n This was discussed on #git earlier today and was thought to be a\n useful feature.  :-)\n\n Documentation/git-branch.txt |   10 ++++++++--\n git-branch.sh                |   12 +++++++++++-\n 2 files changed, 19 insertions(+), 3 deletions(-)\n\ne4fb59c8b73009e3bcae71bfb7edd7de2c648117\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 72fb2f8..a7bec3c 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -9,7 +9,7 @@ SYNOPSIS\n --------\n [verse]\n 'git-branch' [-r]\n-'git-branch' [-f] <branchname> [<start-point>]\n+'git-branch' [-l] [-f] <branchname> [<start-point>]\n 'git-branch' (-d | -D) <branchname>...\n \n DESCRIPTION\n@@ -23,7 +23,8 @@ If no <start-point> is given, the branch\n equal to that of the currently checked out branch.\n \n With a `-d` or `-D` option, `<branchname>` will be deleted.  You may\n-specify more than one branch for deletion.\n+specify more than one branch for deletion.  If the branch currently\n+has a ref log then the ref log will also be deleted.\n \n \n OPTIONS\n@@ -34,6 +35,11 @@ OPTIONS\n -D::\n \tDelete a branch irrespective of its index status.\n \n+-l::\n+\tCreate the branch's ref log.  This activates recording of\n+\tall changes to made the branch ref, enabling use of date\n+\tbased sha1 expressions such as \"<branchname>@{yesterday}\".\n+\n -f::\n \tForce the creation of a new branch even if it means deleting\n \ta branch that already exists with the same name.\ndiff --git a/git-branch.sh b/git-branch.sh\nindex d1e3730..e0501ec 100755\n--- a/git-branch.sh\n+++ b/git-branch.sh\n@@ -1,6 +1,6 @@\n #!/bin/sh\n \n-USAGE='[(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r'\n+USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r'\n LONG_USAGE='If no arguments, show available branches and mark current branch with a star.\n If one argument, create a new branch <branchname> based off of current HEAD.\n If two arguments, create a new branch <branchname> based off of <start-point>.'\n@@ -42,6 +42,7 @@ If you are sure you want to delete it, r\n \t    esac\n \t    ;;\n \tesac\n+\trm -f \"$GIT_DIR/logs/refs/heads/$branch_name\"\n \trm -f \"$GIT_DIR/refs/heads/$branch_name\"\n \techo \"Deleted branch $branch_name.\"\n     done\n@@ -55,6 +56,7 @@ ls_remote_branches () {\n }\n \n force=\n+create_log=\n while case \"$#,$1\" in 0,*) break ;; *,-*) ;; *) break ;; esac\n do\n \tcase \"$1\" in\n@@ -69,6 +71,9 @@ do\n \t-f)\n \t\tforce=\"$1\"\n \t\t;;\n+\t-l)\n+\t\tcreate_log=\"yes\"\n+\t\t;;\n \t--)\n \t\tshift\n \t\tbreak\n@@ -117,4 +122,9 @@ then\n \t\tdie \"cannot force-update the current branch.\"\n \tfi\n fi\n+if test \"$create_log\" = 'yes'\n+then\n+\tmkdir -p $(dirname \"$GIT_DIR/logs/refs/heads/$branchname\")\n+\ttouch \"$GIT_DIR/logs/refs/heads/$branchname\"\n+fi\n git update-ref -m \"branch: Created from $head\" \"refs/heads/$branchname\" $rev\n-- \n1.3.2.g7278\n"}]}