Bug 23718 - "git-checkout -b NEW :/Text" does some wrong thing
Summary: "git-checkout -b NEW :/Text" does some wrong thing
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: git-core (show other bugs)
Version: unstable
Hardware: all Linux
: P3 normal
Assignee: placeholder@altlinux.org
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-03 06:01 MSD by Ivan Zakharyaschev
Modified: 2010-10-08 06:04 MSD (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Zakharyaschev 2010-07-03 06:01:18 MSD
git-core-1.7.0.6-alt1

It is expected that "git-checkout -b NEW :/Text" will checkout a new branch created off the commit with the message that matches "Text". But in effect, it does some wrong strange thing (whereby some files are deleted from the working dir). An example:


[imz@localhost bugreports]$ mkdir git-checkout-by-msg
[imz@localhost bugreports]$ cd git-checkout-by-msg/
[imz@localhost git-checkout-by-msg]$ git init
Initialized empty Git repository in /home/imz/SAVED-for-me-and-everyone/bugreports/git-checkout-by-msg/.git/
[imz@localhost git-checkout-by-msg]$ echo a > a
[imz@localhost git-checkout-by-msg]$ git add a
[imz@localhost git-checkout-by-msg]$ git commit -m First.
[master (root-commit) 82e31c0] First.
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 a
[imz@localhost git-checkout-by-msg]$ echo b > b
[imz@localhost git-checkout-by-msg]$ git add b
[imz@localhost git-checkout-by-msg]$ git commit -m Second.
[master ea50a2a] Second.
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 b
[imz@localhost git-checkout-by-msg]$ git checkout -b new :/First
fatal: Not a valid object name: ':/First'.
[imz@localhost git-checkout-by-msg]$ ls
a
[imz@localhost git-checkout-by-msg]$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#	deleted:    b
#
[imz@localhost git-checkout-by-msg]$ git rev-parse --verify :/First
82e31c0afdb5515336030c073844d1f7c1c9becf
[imz@localhost git-checkout-by-msg]$ git branch
* master
[imz@localhost git-checkout-by-msg]$ git branch new :/First
[imz@localhost git-checkout-by-msg]$ git branch
* master
  new
[imz@localhost git-checkout-by-msg]$
Comment 1 Dmitry V. Levin 2010-07-06 00:18:25 MSD
(In reply to comment #0)
> git-core-1.7.0.6-alt1
> 
> It is expected that "git-checkout -b NEW :/Text" will checkout a new branch
> created off the commit with the message that matches "Text".

Is it expected?

$ git checkout -b NEW :/Text
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout ':/Text' which can not be resolved as commit?
Comment 2 Dmitry V. Levin 2010-07-28 23:05:23 MSD
Well, it is really expected.
Comment 3 Repository Robot 2010-08-13 13:15:43 MSD
git-1.7.2.1-alt2 -> sisyphus:

* Fri Aug 13 2010 Dmitry V. Levin <ldv@altlinux> 1.7.2.1-alt2
- Updated to maint v1.7.2.1-45-gb5e233e.
- Backport upstream fix for parsing of ":/token" syntax (closes: #23718).
Comment 4 Ivan Zakharyaschev 2010-10-08 06:04:15 MSD
Thank you, it is OK (tested with git-core-1.7.2.3-alt1)!

Also, I noticed a similar problem with "git reset --hard :/First"
in older versions; now it is also fixed.