{"thread":{"id":"36473","subject":"git p4: bug - branch detection broken on empty branches","startedAt":"2014-04-22T09:20:07Z","lastAt":"2014-04-26T12:40:00Z","messageCount":2,"participants":["Dan Porter","Pete Wyckoff"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"239318","messageId":"CADtnS+zAnnpaU59-rAwMHF7Z4SNjcYWASqpKdEq+GVs8mVSb3w@mail.gmail.com","threadId":"36473","inReplyTo":null,"subject":"git p4: bug - branch detection broken on empty branches","fromName":"Dan Porter","fromEmail":"dpreid@gmail.com","sentAt":"2014-04-22T09:20:07Z","receivedAt":"2014-04-22T09:20:07Z","isPatch":false,"sender":{"key":"dpreid@gmail.com","avatar":"https://gravatar.com/avatar/8f07f55d438cc7cb8eceff243f5d1f97afe1d52b5daa37d0016791b1aa921dd5?d=mp&s=160"},"body":"As part of my work to help get git-p4 close to bug-free before Git\n2.0, I'm posting all bugs and patches to this mailing list. Please\ndirect me elsewhere if this is incorrect.\n\nWhen trying to clone a particular directory from a depot, that\ncontains one or more branches that contain no commits for that\ndirectory, branch detection is broken and results in a failed clone.\n\nfatal: ambiguous argument\n'refs/remotes/p4/silly_project_branch/trunk': unknown revision or path\nnot in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\nTraceback (most recent call last):\n  File \"/home/dreid/bin/git-p4\", line 3295, in ?\n    main()\n  File \"/home/dreid/bin/git-p4\", line 3289, in main\n    if not cmd.run(args):\n  File \"/home/dreid/bin/git-p4\", line 3163, in run\n    if not P4Sync.run(self, depotPaths):\n  File \"/home/dreid/bin/git-p4\", line 3016, in run\n    self.importChanges(changes)\n  File \"/home/dreid/bin/git-p4\", line 2678, in importChanges\n    blob = self.searchParent(parent, branch, tempBranch)\n  File \"/home/dreid/bin/git-p4\", line 2600, in searchParent\n    for blob in read_pipe_lines([\"git\", \"rev-list\", \"--reverse\",\n  File \"/home/dreid/bin/git-p4\", line 155, in read_pipe_lines\n    die('Command failed: %s' % str(c))\n  File \"/home/dreid/bin/git-p4\", line 106, in die\n    raise Exception(msg)\nException: Command failed: ['git', 'rev-list', '--reverse',\n'--no-merges', 'refs/remotes/p4/silly_project_branch/trunk']\n\nOriginal command:\n$ git-p4 clone //insane_depot/projects/Exchange/CompanyName/silly_project_branch@all\nsilly-project --detect-branches -v\n"},{"id":"239753","messageId":"20140426124000.GA4767@padd.com","threadId":"36473","inReplyTo":"CADtnS+zAnnpaU59-rAwMHF7Z4SNjcYWASqpKdEq+GVs8mVSb3w@mail.gmail.com","subject":"Re: git p4: bug - branch detection broken on empty branches","fromName":"Pete Wyckoff","fromEmail":"pw@padd.com","sentAt":"2014-04-26T12:40:00Z","receivedAt":"2014-04-26T12:40:00Z","isPatch":false,"sender":{"key":"pw@padd.com","avatar":null},"body":"dpreid@gmail.com wrote on Tue, 22 Apr 2014 10:20 +0100:\n> As part of my work to help get git-p4 close to bug-free before Git\n> 2.0, I'm posting all bugs and patches to this mailing list. Please\n> direct me elsewhere if this is incorrect.\n> \n> When trying to clone a particular directory from a depot, that\n> contains one or more branches that contain no commits for that\n> directory, branch detection is broken and results in a failed clone.\n> \n> fatal: ambiguous argument\n> 'refs/remotes/p4/silly_project_branch/trunk': unknown revision or path\n> not in the working tree.\n[..]\n>   File \"/home/dreid/bin/git-p4\", line 2678, in importChanges\n>     blob = self.searchParent(parent, branch, tempBranch)\n>   File \"/home/dreid/bin/git-p4\", line 2600, in searchParent\n>     for blob in read_pipe_lines([\"git\", \"rev-list\", \"--reverse\",\n>   File \"/home/dreid/bin/git-p4\", line 155, in read_pipe_lines\n>     die('Command failed: %s' % str(c))\n>   File \"/home/dreid/bin/git-p4\", line 106, in die\n>     raise Exception(msg)\n> Exception: Command failed: ['git', 'rev-list', '--reverse',\n> '--no-merges', 'refs/remotes/p4/silly_project_branch/trunk']\n> \n> Original command:\n> $ git-p4 clone //insane_depot/projects/Exchange/CompanyName/silly_project_branch@all\n> silly-project --detect-branches -v\n\nYes, this is a good bug.  You could do \"git rev-parse -q --verify\"\non parent before trying to read the rev-list.\n\nBut then what should happen?  I suspect git-p4 will just create\nthat ref when it commits the change it is considering.\n\n\t\t-- Pete\n"}]}