git-commit bug (was Re: Editing the root commit)

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

 



Chris Webb <chris@xxxxxxxxxxxx> writes:

> PS Whilst experimenting, I also noticed a (presumably unintentional)
> behaviour:
> 
>   $ git init .
>   Initialized empty Git repository in /tmp/foo/.git/
>   $ git checkout --detach
>   $ touch bar
>   $ git add bar
>   $ git commit -m test
>   [(null) (root-commit) 17b5bf9] test
>    0 files changed
>    create mode 100644 bar
>   $ ls .git/refs/heads/
>   (null)
>   $
> 
> Here we've created a branch with the strange name '(null)' instead of
> actually detaching, or refusing to detach because we're on an unborn
> branch.

This was introduced by abe199808c, which is intended to allow

  git init . && git checkout --orphan newbranch

but presumably wasn't also meant to enable

  git checkout --orphan foo
  git checkout --detach

This leads to a printf("%s", NULL) and thus

  $ git symbolic-ref HEAD
  refs/heads/(null)

I've followed up to this message with a patch including a test to catch this
in future.

Best wishes,

Chris.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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]