We're moving to Git from PVCS. One thing we can't quite figure out: auto-merging. It seems this can get you into trouble. For instance, if we start with:
public function getStuff()
{
$var1 = 'cool cats';
$result = null;
foreach ($this->allStuff as $curStuff)
{
if ($curStuff == $var1)
{
$result = 'indigo';
break;
}
}
if ($result === null)
{
$result = $this->allStuff;
}
return $result;
}
Then coder 1 changes it this way in their branch:
public function getStuff()
{
$var1 = 'cool cats';
$result = null;
foreach ($this->allStuff as $curStuff)
{
if ($curStuff == $var1)
{
$result = 'indigo';
break;
}
}
if ($result === null)
{
$result = 'chicken nuggets';
}
return $result;
}
And, coder 2 changes it this way:
public function getStuff()
{
$var1 = 'cool cats';
$result = 'berries';
foreach ($this->allStuff as $curStuff)
{
if ($curStuff == $var1)
{
$result = 'indigo';
break;
}
}
return $result;
}
The result would be this (making coder 1's changes bascially dead code):
public function getStuff()
{
$var1 = 'cool cats';
$result = 'berries';
foreach ($this->allStuff as $curStuff)
{
if ($curStuff == $var1)
{
$result = 'indigo';
break;
}
}
if ($result === null)
{
$result = 'chicken nuggets';
}
return $result;
}
Of course, this is a simplified explanation in order to help explain my question. Has anyone had any trouble with this? Does anyone see this as an issue?