Re: [PATCH v2] checkout: implement "-" shortcut name for last branch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Schindelin wrote:
> On Thu, 15 Jan 2009, Johannes Sixt wrote:
> > You must make sure that commits referenced by LAST_HEAD are not
> > garbage-collected. (I don't know if this happens anyway for symrefs in .git.)
> 
> Note: if you used reflogs for that feature, the garbage collection could 
> not have killed the commit.  However, it is quite possible that the 
> branch was deleted.

Suddenly I'm not so sure about either behaviour any more.

Consider:

  $ git commit -m initial
  [master (root-commit)]: created 812c476: "initial"
   1 files changed, 1 insertions(+), 0 deletions(-)
   create mode 100644 foo
  $ git checkout $(git rev-parse HEAD)
  Note: moving to "812c476ca23e25efa7e4d7081153ba657a127d95" which isn't a local branch
  If you want to create a new branch from this checkout, you may do so
  (now or later) by using -b with the checkout command again. Example:
    git checkout -b <new_branch_name>
  HEAD is now at 812c476... initial
  $ git branch -D master
  Deleted branch master (812c476).
  $ git for-each-ref
  $ git reflog expire --expire=now --all
  $ git prune --expire now
  $ git show
  fatal: bad object HEAD
  $ git show 812c476
  fatal: ambiguous argument '812c476': unknown revision or path not in the working tree.
  Use '--' to separate paths from revisions

Oops.

Some quick RTFS shows that it indeed "only" cares about refs and
reflogs.

-- 
Thomas Rast
trast@{inf,student}.ethz.ch

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux