Bug#872523: RE:Bug#872523: fatal: refusing to merge unrelated histories

2017-08-18 Thread Sean Whitton
On Fri, Aug 18 2017, PICCA Frederic-Emmanuel wrote:

> ] ++ if v >= [2,9]
> then [ "--allow-unrelated-histories" ]
> else []
> [...]
> Yes here

Okay.  I think that this is a bug, but I don't know how to reproduce it
yet.

Do you have an upstream remote pointing to Joey's repository?

Please run propellor with PROPELLOR_DEBUG=1 so we can see the commands
it runs to set up the upstream/master branch.

-- 
Sean Whitton


signature.asc
Description: PGP signature


Bug#872523: RE:Bug#872523: fatal: refusing to merge unrelated histories

2017-08-18 Thread PICCA Frederic-Emmanuel
setupUpstreamMaster :: String -> IO ()
setupUpstreamMaster newref = do
changeWorkingDirectory =<< dotPropellor
go =<< catchMaybeIO getoldrev
  where
go Nothing = warnoutofdate False
go (Just oldref) = do
let tmprepo = ".git/propellordisttmp"
let cleantmprepo = void $ catchMaybeIO $ 
removeDirectoryRecursive tmprepo
cleantmprepo
git ["clone", "--quiet", ".", tmprepo]

changeWorkingDirectory tmprepo
git ["fetch", distrepo, "--quiet"]
git ["reset", "--hard", oldref, "--quiet"]
v <- gitVersion
let mergeparams =
[ "merge", newref
, "-s", "recursive"
, "-Xtheirs"
, "--quiet"
, "-m", "merging upstream version"
] ++ if v >= [2,9]
then [ "--allow-unrelated-histories" ]
else []
git mergeparams

void $ fetchUpstreamBranch tmprepo
cleantmprepo
warnoutofdate True

getoldrev = takeWhile (/= '\n')
<$> readProcess "git" ["show-ref", upstreambranch, "--hash"]

git = run "git"
run cmd ps = unlessM (boolSystem cmd (map Param ps)) $
error $ "Failed to run " ++ cmd ++ " " ++ show ps

Yes here