# Bug Report: git-p4 unshelve failed

2 messages from 2020-09-15 to 2020-09-16. Participants: Liu, Xuhui (Jackson), Luke Diamand.
Thread: https://gitlist.dev/t/54240

## Liu, Xuhui (Jackson), 2020-09-15 01:09

Subject: Bug Report: git-p4 unshelve failed
Message-ID: <DM6PR12MB3194C9B3A462968FA5A05B4CFA200@DM6PR12MB3194.namprd12.prod.outlook.com>
URL: https://gitlist.dev/e/DM6PR12MB3194C9B3A462968FA5A05B4CFA200%40DM6PR12MB3194.namprd12.prod.outlook.com

```
Hi Git,
            When I use "git p4 unshelve 4495953", it failed.
	I have fixed this issue locally. You can check the attached for details.

What have I done to fix this:
            It's because the line#4240 in function "findLastP4Revision" of git-p4.py:
                        log = extractLogMessageFromGitCommit("{0}^{1}".format(starting_point, parent))
I think it should be:
            log = extractLogMessageFromGitCommit("{0}~{1}".format(starting_point, parent))

Best Regards,
Jackson(Xuhui) Liu

-------------------------------------------------------------------------------------
1-14F, Tower 1, Candor Plaza No.669 Huanke Rd., Pudong District, Shanghai 201210, China
Facebook |  Twitter |  amd.com  
 



Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue)
git p4 unshelve -v 4495953
What did you expect to happen? (Expected behavior)
I want to get shelved changelist 4495953.
What happened instead? (Actual behavior)
It failed.
Here is the output log:
Reading pipe: ['git', '--git-dir', '/mnt/c/workSpace/project/git4perforce/ispDevelop/stg_3_0/.git', 'rev-parse', '--git-dir']
Reading pipe: ['git', '--git-dir', '/mnt/c/workSpace/project/git4perforce/ispDevelop/stg_3_0/.git', 'rev-parse', '--git-dir']
Reading pipe: ['git', 'config', 'git-p4.largeFileSystem']
Reading pipe: ['git', 'config', 'git-p4.syncFromOrigin']
Reading pipe: ['git', 'cat-file', 'commit', 'HEAD^0']
Reading pipe: ['git', 'cat-file', 'commit', 'HEAD^1']
Reading pipe: ['git', 'cat-file', 'commit', 'HEAD^2']
fatal: Not a valid object name HEAD^2
Traceback (most recent call last):
  File "/home/xuhuiliu/gitp4/git-p4.py", line 4438, in <module>
    main()
  File "/home/xuhuiliu/gitp4/git-p4.py", line 4432, in main
    if not cmd.run(args):
  File "/home/xuhuiliu/gitp4/git-p4.py", line 4295, in run
    settings = self.findLastP4Revision(self.origin)
  File "/home/xuhuiliu/gitp4/git-p4.py", line 4240, in findLastP4Revision
    log = extractLogMessageFromGitCommit("{0}^{1}".format(starting_point, parent))
  File "/home/xuhuiliu/gitp4/git-p4.py", line 875, in extractLogMessageFromGitCommit
    for log in read_pipe_lines(["git", "cat-file", "commit", commit]):
  File "/home/xuhuiliu/gitp4/git-p4.py", line 349, in read_pipe_lines
    die('Command failed: %s' % str(c))
  File "/home/xuhuiliu/gitp4/git-p4.py", line 156, in die
    raise Exception(msg)
Exception: Command failed: ['git', 'cat-file', 'commit', 'HEAD^2']

What's different between what you expected and what actually happened?
I want it to sync 4495953, but it failed.
Anything else you want to add:
I have fixed it locally.
It's because the line#4240 in function "findLastP4Revision" of git-p4.py:
     log = extractLogMessageFromGitCommit("{0}^{1}".format(starting_point, parent))
I think it should be:
     log = extractLogMessageFromGitCommit("{0}~{1}".format(starting_point, parent))

Please review the rest of the bug report below.
You can delete any lines you don't wish to share.


[System Info]
git version:
git version 2.28.0
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 4.4.0-18362-Microsoft #836-Microsoft Mon May 05 16:04:00 PST 2020 x86_64
compiler info: gnuc: 9.3
libc info: glibc: 2.31
$SHELL (typically, interactive shell): /bin/bash


[Enabled Hooks]

```

## Luke Diamand, 2020-09-16 12:59

Subject: Re: Bug Report: git-p4 unshelve failed
Message-ID: <CAE5ih79z8z+rmg-ncT6=RLaySr8GjxS5B33+yDh6bNC4TkUQDA@mail.gmail.com>
URL: https://gitlist.dev/e/CAE5ih79z8z%2Brmg-ncT6%3DRLaySr8GjxS5B33%2ByDh6bNC4TkUQDA%40mail.gmail.com
In-Reply-To: <DM6PR12MB3194C9B3A462968FA5A05B4CFA200@DM6PR12MB3194.namprd12.prod.outlook.com>

```
On Tue, 15 Sep 2020 at 02:09, Liu, Xuhui (Jackson) <Xuhui.Liu@amd.com> wrote:
>
> Hi Git,
>             When I use "git p4 unshelve 4495953", it failed.
>         I have fixed this issue locally. You can check the attached for details.
>
> What have I done to fix this:
>             It's because the line#4240 in function "findLastP4Revision" of git-p4.py:
>                         log = extractLogMessageFromGitCommit("{0}^{1}".format(starting_point, parent))
> I think it should be:
>             log = extractLogMessageFromGitCommit("{0}~{1}".format(starting_point, parent))
>
> Best Regards,
> Jackson(Xuhui) Liu

This is indeed a bug. I will see if I can put together a patch.

Thanks
Luke

```
