Merge branch 'sp/reflog'
authorJunio C Hamano <junkio@cox.net>
Sun, 4 Jun 2006 06:59:03 +0000 (23:59 -0700)
committerJunio C Hamano <junkio@cox.net>
Sun, 4 Jun 2006 06:59:03 +0000 (23:59 -0700)
* sp/reflog:
  fetch.c: do not pass uninitialized lock to unlock_ref().
  Test that git-branch -l works.
  Verify git-commit provides a reflog message.
  Enable ref log creation in git checkout -b.
  Create/delete branch ref logs.
  Include ref log detail in commit, reset, etc.
  Change order of -m option to update-ref.
  Correct force_write bug in refs.c
  Change 'master@noon' syntax to 'master@{noon}'.
  Log ref updates made by fetch.
  Force writing ref if it doesn't exist.
  Added logs/ directory to repository layout.
  General ref log reading improvements.
  Fix ref log parsing so it works properly.
  Support 'master@2 hours ago' syntax
  Log ref updates to logs/refs/<ref>
  Convert update-ref to use ref_lock API.
  Improve abstraction of ref lock/write.

1  2 
Documentation/config.txt
Documentation/git-rev-parse.txt
cache.h
git-commit.sh
http-fetch.c

diff --combined Documentation/config.txt
@@@ -2,7 -2,7 +2,7 @@@ CONFIGURATION FIL
  ------------------
  
  The git configuration file contains a number of variables that affect
 -the git commands behaviour. They can be used by both the git plumbing
 +the git commands behavior. They can be used by both the git plumbing
  and the porcelains. The variables are divided to sections, where
  in the fully qualified variable name the variable itself is the last
  dot-separated segment and the section name is everything before the last
@@@ -53,7 -53,7 +53,7 @@@ core.gitProxy:
        may be set multiple times and is matched in the given order;
        the first match wins.
  
 -      Can be overriden by the 'GIT_PROXY_COMMAND' environment variable
 +      Can be overridden by the 'GIT_PROXY_COMMAND' environment variable
        (which always applies universally, without the special "for"
        handling).
  
@@@ -70,6 -70,14 +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/<ref>" 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.
@@@ -115,12 -123,12 +123,12 @@@ http.sslCert:
  
  http.sslKey::
        File containing the SSL private key when fetching or pushing
 -      over HTTPS. Can be overriden by the 'GIT_SSL_KEY' environment
 +      over HTTPS. Can be overridden by the 'GIT_SSL_KEY' environment
        variable.
  
  http.sslCAInfo::
        File containing the certificates to verify the peer with when
 -      fetching or pushing over HTTPS. Can be overriden by the
 +      fetching or pushing over HTTPS. Can be overridden by the
        'GIT_SSL_CAINFO' environment variable.
  
  http.sslCAPath::
        by the 'GIT_SSL_CAPATH' environment variable.
  
  http.maxRequests::
 -      How many HTTP requests to launch in parallel. Can be overriden
 +      How many HTTP requests to launch in parallel. Can be overridden
        by the 'GIT_HTTP_MAX_REQUESTS' environment variable. Default is 5.
  
  http.lowSpeedLimit, http.lowSpeedTime::
        If the HTTP transfer speed is less than 'http.lowSpeedLimit'
        for longer than 'http.lowSpeedTime' seconds, the transfer is aborted.
 -      Can be overriden by the 'GIT_HTTP_LOW_SPEED_LIMIT' and
 +      Can be overridden by the 'GIT_HTTP_LOW_SPEED_LIMIT' and
        'GIT_HTTP_LOW_SPEED_TIME' environment variables.
  
  i18n.commitEncoding::
@@@ -166,12 -174,12 +174,12 @@@ showbranch.default:
  
  user.email::
        Your email address to be recorded in any newly created commits.
 -      Can be overriden by the 'GIT_AUTHOR_EMAIL' and 'GIT_COMMITTER_EMAIL'
 +      Can be overridden by the 'GIT_AUTHOR_EMAIL' and 'GIT_COMMITTER_EMAIL'
        environment variables.  See gitlink:git-commit-tree[1].
  
  user.name::
        Your full name to be recorded in any newly created commits.
 -      Can be overriden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'
 +      Can be overridden by the 'GIT_AUTHOR_NAME' and 'GIT_COMMITTER_NAME'
        environment variables.  See gitlink:git-commit-tree[1].
  
  whatchanged.difftree::
@@@ -13,7 -13,7 +13,7 @@@ SYNOPSI
  DESCRIPTION
  -----------
  
 -Many git Porcelainish commands take mixture of flags
 +Many git porcelainish commands take mixture of flags
  (i.e. parameters that begin with a dash '-') and parameters
  meant for underlying `git-rev-list` command they use internally
  and flags and parameters for other commands they use as the
@@@ -91,7 -91,7 +91,7 @@@ OPTION
  
  --short, --short=number::
        Instead of outputting the full SHA1 values of object names try to
 -      abbriviate them to a shorter unique name. When no length is specified
 +      abbreviate them to a shorter unique name. When no length is specified
        7 is used. The minimum length is 4.
  
  --since=datestring, --after=datestring::
@@@ -124,6 -124,13 +124,13 @@@ 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 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/<ref>).
  * A suffix '{caret}' to a revision parameter means the first parent of
    that commit object.  '{caret}<n>' means the <n>th parent (i.e.
    'rev{caret}'
diff --combined cache.h
+++ b/cache.h
@@@ -114,7 -114,6 +114,7 @@@ static inline unsigned int create_ce_mo
  
  extern struct cache_entry **active_cache;
  extern unsigned int active_nr, active_alloc, active_cache_changed;
 +extern struct cache_tree *active_cache_tree;
  
  #define GIT_DIR_ENVIRONMENT "GIT_DIR"
  #define DEFAULT_GIT_DIR_ENVIRONMENT ".git"
@@@ -179,6 -178,7 +179,7 @@@ extern void rollback_index_file(struct 
  extern int trust_executable_bit;
  extern int assume_unchanged;
  extern int prefer_symlink_refs;
+ extern int log_all_ref_updates;
  extern int warn_ambiguous_refs;
  extern int diff_rename_limit_default;
  extern int shared_repository;
diff --combined git-commit.sh
    -m|--m|--me|--mes|--mess|--messa|--messag|--message)
        case "$#" in 1) usage ;; esac
        shift
 -      log_given=t$log_given
 -      log_message="$1"
 +      log_given=m$log_given
 +      if test "$log_message" = ''
 +      then
 +          log_message="$1"
 +      else
 +          log_message="$log_message
 +
 +$1"
 +      fi
        no_edit=t
        shift
        ;;
    -m*)
 -      log_given=t$log_given
 -      log_message=`expr "$1" : '-m\(.*\)'`
 +      log_given=m$log_given
 +      if test "$log_message" = ''
 +      then
 +          log_message=`expr "$1" : '-m\(.*\)'`
 +      else
 +          log_message="$log_message
 +
 +`expr "$1" : '-m\(.*\)'`"
 +      fi
        no_edit=t
        shift
        ;;
    --m=*|--me=*|--mes=*|--mess=*|--messa=*|--messag=*|--message=*)
 -      log_given=t$log_given
 -      log_message=`expr "$1" : '-[^=]*=\(.*\)'`
 +      log_given=m$log_given
 +      if test "$log_message" = ''
 +      then
 +          log_message=`expr "$1" : '-[^=]*=\(.*\)'`
 +      else
 +          log_message="$log_message
 +
 +`expr "$1" : '-[^=]*=\(.*\)'`"
 +      fi
        no_edit=t
        shift
        ;;
@@@ -399,9 -378,7 +399,9 @@@ esa
  
  case "$log_given" in
  tt*)
 -  die "Only one of -c/-C/-F/-m can be used." ;;
 +  die "Only one of -c/-C/-F can be used." ;;
 +*tm*|*mt*)
 +  die "Option -m cannot be combined with -c/-C/-F." ;;
  esac
  
  case "$#,$also,$only,$amend" in
@@@ -649,9 -626,6 +649,9 @@@ f
  if test -z "$no_edit"
  then
        {
 +              echo ""
 +              echo "# Please enter the commit message for your changes."
 +              echo "# (Comment lines starting with '#' will not be included)"
                test -z "$only_include_assumed" || echo "$only_include_assumed"
                run_status
        } >>"$GIT_DIR"/COMMIT_EDITMSG
@@@ -713,7 -687,8 +713,8 @@@ the
                rm -f "$TMP_INDEX"
        fi &&
        commit=$(cat "$GIT_DIR"/COMMIT_MSG | git-commit-tree $tree $PARENTS) &&
-       git-update-ref HEAD $commit $current &&
+       rlogm=$(sed -e 1q "$GIT_DIR"/COMMIT_MSG) &&
+       git-update-ref -m "commit: $rlogm" HEAD $commit $current &&
        rm -f -- "$GIT_DIR/MERGE_HEAD" &&
        if test -f "$NEXT_INDEX"
        then
diff --combined http-fetch.c
@@@ -1223,6 -1223,7 +1223,7 @@@ int main(int argc, char **argv
        int rc = 0;
  
        setup_git_directory();
+       git_config(git_default_config);
  
        while (arg < argc && argv[arg][0] == '-') {
                if (argv[arg][1] == 't') {
        }
        commit_id = argv[arg];
        url = argv[arg + 1];
+       write_ref_log_details = url;
  
        http_init();
  
        if (pull(commit_id))
                rc = 1;
  
 -      curl_slist_free_all(no_pragma_header);
 -
        http_cleanup();
  
 +      curl_slist_free_all(no_pragma_header);
 +
        if (corrupt_object_found) {
                fprintf(stderr,
  "Some loose object were found to be corrupt, but they might be just\n"