OSDN Git Service

Merge branch 'dt/refs-backend-preamble'
authorJunio C Hamano <gitster@pobox.com>
Mon, 3 Aug 2015 18:01:29 +0000 (11:01 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Aug 2015 18:01:29 +0000 (11:01 -0700)
In preparation for allowing different "backends" to store the refs
in a way different from the traditional "one ref per file in $GIT_DIR
or in a $GIT_DIR/packed-refs file" filesystem storage, reduce
direct filesystem access to ref-like things like CHERRY_PICK_HEAD
from scripts and programs.

* dt/refs-backend-preamble:
  git-stash: use update-ref --create-reflog instead of creating files
  update-ref and tag: add --create-reflog arg
  refs: add REF_FORCE_CREATE_REFLOG flag
  git-reflog: add exists command
  refs: new public ref function: safe_create_reflog
  refs: break out check for reflog autocreation
  refs.c: add err arguments to reflog functions

1  2 
Documentation/git-tag.txt
builtin/checkout.c
builtin/update-ref.c
refs.c
refs.h

@@@ -13,7 -13,8 +13,7 @@@ SYNOPSI
        <tagname> [<commit> | <object>]
  'git tag' -d <tagname>...
  'git tag' [-n[<num>]] -l [--contains <commit>] [--points-at <object>]
-       [--column[=<options>] | --no-column] [<pattern>...]
+       [--column[=<options>] | --no-column] [--create-reflog] [<pattern>...]
 -      [<pattern>...]
  'git tag' -v <tagname>...
  
  DESCRIPTION
Simple merge
@@@ -422,14 -422,9 +429,15 @@@ int cmd_update_ref(int argc, const cha
        if (no_deref)
                flags = REF_NODEREF;
        if (delete)
 -              return delete_ref(refname, oldval ? oldsha1 : NULL, flags);
 +              /*
 +               * For purposes of backwards compatibility, we treat
 +               * NULL_SHA1 as "don't care" here:
 +               */
 +              return delete_ref(refname,
 +                                (oldval && !is_null_sha1(oldsha1)) ? oldsha1 : NULL,
 +                                flags);
        else
                return update_ref(msg, refname, sha1, oldval ? oldsha1 : NULL,
-                                 flags, UPDATE_REFS_DIE_ON_ERR);
+                                 flags | create_reflog_flag,
+                                 UPDATE_REFS_DIE_ON_ERR);
  }
diff --cc refs.c
Simple merge
diff --cc refs.h
Simple merge