From 5b16b090211f549c501f2cd9e8ea1bd227a575c5 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Wed, 17 May 2006 05:55:19 -0400 Subject: Convert update-ref to use ref_lock API. This conversion also adds the '-m' switch to update-ref allowing the caller to record why the ref is changing. At present this is merely copied down into the ref_lock API. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- Documentation/git-update-ref.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/git-update-ref.txt b/Documentation/git-update-ref.txt index 475237f19..f0e710a6f 100644 --- a/Documentation/git-update-ref.txt +++ b/Documentation/git-update-ref.txt @@ -7,7 +7,7 @@ git-update-ref - update the object name stored in a ref safely SYNOPSIS -------- -'git-update-ref' [] +'git-update-ref' [] [-m ] DESCRIPTION ----------- -- cgit v1.2.1 From 6de08ae688b9f2426410add155079e04baff33bd Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Wed, 17 May 2006 05:55:40 -0400 Subject: Log ref updates to logs/refs/ If config parameter core.logAllRefUpdates is true or the log file already exists then append a line to ".git/logs/refs/" whenever git-update-ref is executed. Each log line contains the following information: oldsha1 newsha1 committer where committer is the current user, date, time and timezone in the standard GIT ident format. If the caller is unable to append to the log file then git-update-ref will fail without updating . An optional message may be included in the log line with the -m flag. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- Documentation/config.txt | 8 ++++++++ Documentation/git-update-ref.txt | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) (limited to 'Documentation') diff --git a/Documentation/config.txt b/Documentation/config.txt index d1a4bec0d..e178ee2de 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -70,6 +70,14 @@ core.preferSymlinkRefs:: This is sometimes needed to work with old scripts that expect HEAD to be a symbolic link. +core.logAllRefUpdates:: + If true, `git-update-ref` will append a line to + "$GIT_DIR/logs/" listing the new SHA1 and the date/time + of the update. If the file does not exist it will be + created automatically. This information can be used to + determine what commit was the tip of a branch "2 days ago". + This value is false by default (no logging). + core.repositoryFormatVersion:: Internal variable identifying the repository format and layout version. diff --git a/Documentation/git-update-ref.txt b/Documentation/git-update-ref.txt index f0e710a6f..dfbd88697 100644 --- a/Documentation/git-update-ref.txt +++ b/Documentation/git-update-ref.txt @@ -49,6 +49,32 @@ for reading but not for writing (so we'll never write through a ref symlink to some other tree, if you have copied a whole archive by creating a symlink tree). +Logging Updates +--------------- +If config parameter "core.logAllRefUpdates" is true or the file +"$GIT_DIR/logs/" exists then `git-update-ref` will append +a line to the log file "$GIT_DIR/logs/" (dereferencing all +symbolic refs before creating the log name) describing the change +in ref value. Log lines are formatted as: + + . oldsha1 SP newsha1 SP committer LF ++ +Where "oldsha1" is the 40 character hexadecimal value previously +stored in , "newsha1" is the 40 character hexadecimal value of + and "committer" is the committer's name, email address +and date in the standard GIT committer ident format. + +Optionally with -m: + + . oldsha1 SP newsha1 SP committer TAB message LF ++ +Where all fields are as described above and "message" is the +value supplied to the -m option. + +An update will fail (without changing ) if the current user is +unable to create a new log file, append to the existing log file +or does not have committer information available. + Author ------ Written by Linus Torvalds . -- cgit v1.2.1 From d556fae2c0ea063f15ea4c3678fe931cc426f1ca Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Wed, 17 May 2006 05:56:09 -0400 Subject: Support 'master@2 hours ago' syntax Extended sha1 expressions may now include date specifications which indicate a point in time within the local repository's history. If the ref indicated to the left of '@' has a log in $GIT_DIR/logs/ then the value of the ref at the time indicated by the specification is obtained from the ref's log. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'Documentation') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index ab896fcf8..df308c3f5 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -124,6 +124,12 @@ syntax. happen to have both heads/master and tags/master, you can explicitly say 'heads/master' to tell git which one you mean. +* A suffix '@' followed by a date specification such as 'yesterday' + (24 hours ago) or '1 month 2 weeks 3 days 1 hour 1 second ago' + to specify the value of the ref at a prior point in time. + This suffix may only be used immediately following a ref name + and the ref must have an existing log ($GIT_DIR/logs/). + * A suffix '{caret}' to a revision parameter means the first parent of that commit object. '{caret}' means the th parent (i.e. 'rev{caret}' -- cgit v1.2.1 From c22a7f0fb96d5c742581422452d3d68139b79ad6 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Fri, 19 May 2006 03:28:46 -0400 Subject: Added logs/ directory to repository layout. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- Documentation/repository-layout.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Documentation') diff --git a/Documentation/repository-layout.txt b/Documentation/repository-layout.txt index 98fbe7db5..b52dfdc30 100644 --- a/Documentation/repository-layout.txt +++ b/Documentation/repository-layout.txt @@ -128,3 +128,14 @@ remotes:: Stores shorthands to be used to give URL and default refnames to interact with remote repository to `git fetch`, `git pull` and `git push` commands. + +logs:: + Records of changes made to refs are stored in this + directory. See the documentation on git-update-ref + for more information. + +logs/refs/heads/`name`:: + Records all changes made to the branch tip named `name`. + +logs/refs/tags/`name`:: + Records all changes made to the tag named `name`. -- cgit v1.2.1 From cce91a2caef9296bd4a69e51e48f1d679935d868 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Fri, 19 May 2006 03:29:43 -0400 Subject: Change 'master@noon' syntax to 'master@{noon}'. Its ambiguous to parse "master@2006-05-17 18:30:foo" when foo is meant as a file name and ":30" is meant as 30 minutes past 6 pm. Therefore all date specifications in a sha1 expression must now appear within brackets and the ':' splitter used for the path name in a sha1 expression ignores ':' appearing within brackets. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index df308c3f5..b89469436 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -124,11 +124,12 @@ syntax. happen to have both heads/master and tags/master, you can explicitly say 'heads/master' to tell git which one you mean. -* A suffix '@' followed by a date specification such as 'yesterday' - (24 hours ago) or '1 month 2 weeks 3 days 1 hour 1 second ago' - to specify the value of the ref at a prior point in time. - This suffix may only be used immediately following a ref name - and the ref must have an existing log ($GIT_DIR/logs/). +* A suffix '@' followed by a date specification enclosed in a brace + pair (e.g. '\{yesterday\}', '\{1 month 2 weeks 3 days 1 hour 1 + second ago\}' or '\{1979-02-26 18:30:00\}') to specify the value + of the ref at a prior point in time. This suffix may only be + used immediately following a ref name and the ref must have an + existing log ($GIT_DIR/logs/). * A suffix '{caret}' to a revision parameter means the first parent of that commit object. '{caret}' means the th parent (i.e. -- cgit v1.2.1 From 7792cc2fa1574b66b69a38a816a9b4bdca5c3731 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Fri, 19 May 2006 05:15:50 -0400 Subject: Change order of -m option to update-ref. The actual position doesn't matter but most people prefer to see options appear before the arguments. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- Documentation/git-update-ref.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/git-update-ref.txt b/Documentation/git-update-ref.txt index dfbd88697..e062030e9 100644 --- a/Documentation/git-update-ref.txt +++ b/Documentation/git-update-ref.txt @@ -7,7 +7,7 @@ git-update-ref - update the object name stored in a ref safely SYNOPSIS -------- -'git-update-ref' [] [-m ] +'git-update-ref' [-m ] [] DESCRIPTION ----------- -- cgit v1.2.1 From 3a4b3f269c4ba1eebd5ab7206ee0915667b20cc8 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Fri, 19 May 2006 05:16:58 -0400 Subject: Create/delete branch ref logs. When crating a new branch offer '-l' as a way for the user to quickly enable ref logging for the new branch. When deleting a branch also delete its ref log. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- Documentation/git-branch.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt index 72fb2f89b..a7bec3c10 100644 --- a/Documentation/git-branch.txt +++ b/Documentation/git-branch.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] 'git-branch' [-r] -'git-branch' [-f] [] +'git-branch' [-l] [-f] [] 'git-branch' (-d | -D) ... DESCRIPTION @@ -23,7 +23,8 @@ If no is given, the branch will be created with a head equal to that of the currently checked out branch. With a `-d` or `-D` option, `` will be deleted. You may -specify more than one branch for deletion. +specify more than one branch for deletion. If the branch currently +has a ref log then the ref log will also be deleted. OPTIONS @@ -34,6 +35,11 @@ OPTIONS -D:: Delete a branch irrespective of its index status. +-l:: + Create the branch's ref log. This activates recording of + all changes to made the branch ref, enabling use of date + based sha1 expressions such as "@{yesterday}". + -f:: Force the creation of a new branch even if it means deleting a branch that already exists with the same name. -- cgit v1.2.1 From 969d326d6b54573e171c903fdf9fdc6b107c18d1 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Fri, 19 May 2006 05:17:16 -0400 Subject: Enable ref log creation in git checkout -b. Switch git checkout -b to use git-update-ref rather than echo and a shell I/O redirection. This is more in line with typical GIT commands and allows -b to be logged according to the normal ref logging rules. Added -l option to allow users to create the ref log at the same time as creating a branch. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- Documentation/git-checkout.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 095128906..064394385 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -8,7 +8,7 @@ git-checkout - Checkout and switch to a branch SYNOPSIS -------- [verse] -'git-checkout' [-f] [-b ] [-m] [] +'git-checkout' [-f] [-b [-l]] [-m] [] 'git-checkout' [-m] [] ... DESCRIPTION @@ -37,6 +37,11 @@ OPTIONS -b:: Create a new branch and start it at . +-l:: + Create the new branch's ref log. This activates recording of + all changes to made the branch ref, enabling use of date + based sha1 expressions such as "@{yesterday}". + -m:: If you have local modifications to one or more files that are different between the current branch and the branch to -- cgit v1.2.1