Odd Rename/Delete conflict
Asked by Robert Pollard:

Hi,

Having a strange problem with a merge attempt that makes no sense...

The story:

* One of our developers created a feature branch off master as we have instructed them to do.
* They deleted a file in this branch: EWXX348_M_CI_CROP_INSURANCE.ksh
* The error message returned in the build/merge attempt has nothing to do with the file that was deleted
* The message makes no sense as the conflicting file was not modified in the feature branch

This message is what is appearing in the build error output:

===============================================================

Checked out

release/Dev[fd406ef460e024918fb6e0b7db14bc31ba99cd80](https://alm.rgbk.com/source/projects/EDW/repos/edw/commits/fd406ef460e024918fb6e0b7db14bc31ba99cd80)

Merged with

EDSEDW-379_RETIRE_CI[b95340e4c7c913e1b5abc052091c1a911c26c21a](https://alm.rgbk.com/source/projects/EDW/repos/edw/commits/b95340e4c7c913e1b5abc052091c1a911c26c21a)

Failure reason

Merge command error: com.atlassian.bamboo.plugins.git.GitCommandException: command /opt/git/bin/git merge --no-commit b95340e4c7c913e1b5abc052091c1a911c26c21a failed with code 1. Working directory was \[/u02/atlassian/application-data/bamboo/xml-data/build-dir/serverSide/EDW-EDWD31-1/mergeWorkspace\]., stderr: CONFLICT (rename/delete): ops/bin/EWXX844_M_SBL_MKTG_DA_ACH_DEP.ksh deleted in b95340e4c7c913e1b5abc052091c1a911c26c21a and renamed in HEAD. Version HEAD of ops/bin/EWXX844_M_SBL_MKTG_DA_ACH_DEP.ksh left in tree. Automatic merge failed; fix conflicts and then commit the result.

===============================================================

This message comes up when I work on a cloned version of the repo and attempting to merge the same feature branch into the release branch:

===============================================================

git status

# On branch release/Dev

nothing to commit (working directory clean)

----------------------------------------------------------------------------------------

git merge EDSEDW-379_RETIRE_CI

CONFLICT (rename/delete): Rename ops/jobs/EWXX348_M_CI_CROP_INSURANCE.ksh-\>ops/jobs/ROXX101_M_RDF_OV_COMITMENT_CONTRACT_LOAD.ksh" in HEAD and deleted in EDSEDW-379_RETIRE_CI

Automatic merge failed; fix conflicts and then commit the result.

-bash-4.1$ git status

# On branch release/Dev

# Unmerged paths:

# (use "git add/rm \<file\>..." as appropriate to mark resolution)

#

# added by us: ops/jobs/ROXX101_M_RDF_OV_COMITMENT_CONTRACT_LOAD.ksh

#

no changes added to commit (use "git add" and/or "git commit -a")

===============================================================

So, I can fix the local version of the conflict by "git add ops/jobs/ROXX101_M_RDF_OV_COMITMENT_CONTRACT_LOAD.ksh" and committing. However, I cannot fix a merge on the Bamboo server since it's a different file that has the same conflict type.

I am not 100% sure of the shape of the repo as it was loaded, they waited a few months and then instead of wiping the release branch and pushing all the current changes to a new release branch, I believe they just kept what was originally pushed, created a feature branch and pushed and merged all the files again.

Now, the developers are starting to use it and we're coming up with very strange problems like this.

Any ideas about what is going on and how to fix it on the Bamboo build server since the build happens automatically and I can't manually fix the file during the auto-build process?

Thanks!


Answers:
author: Ellie Z _they_them_
body: Hi [@Robert Pollard](/t5/user/viewprofilepage/user-id/1162721),

Thanks for reaching out to the Atlassian Community!

Bamboo stores a cache of the Git repository on the server, and this is the source of the mergeWorkspace directory.

As a first step, to rule out the possibility of a "stale" cache, could you please try removing that cache through the Bamboo UI, as follows:

1. Navigate to:

   ```
   Administration >?Overview > Repository settings
   ```

2. Find the row for that repository -- you can search by the Repository URL
3. Click the "Delete" link
4. Try running the build again

Please let us know how this works, and if any other issues arise.

Thanks,

Elias \| Bamboo Support

comments: author: Robert Pollard
body: Hi,

Thanks for your response...

I tried to delete but not sure if it did. This is what I selected to delete:

/u02/atlassian/application-data/bamboo/xml-data/build-dir/_git-repositories-cache/8090cfcc58a80eeee7484838a0cc08d28a4e315c

After deletion attempt it still shows on the screen and says something at the top about scheduling the deletion:

Deleted Git cache '8090cfcc58a80eeee7484838a0cc08d28a4e315c'

Scheduling unused Git Caches deletion on agents: MBST Build Machine 01 (F5KTQ0FUF694), MBTB Build Machine (F5KRM0JWF9VN), MBTO Build Machine (F5KRM0JPF9VN), upatlapp05.unix.rgbk.com, upatlapp07.unix.rgbk.com, upatlapp08.unix.rgbk.com, WPATLAPP01.corp.rgbk.com, WPATLAPP02.corp.rgbk.com, WPATLAPP03.corp.rgbk.com, WPATLAPP04.corp.rgbk.com

Just in case, I tried to manually build the failed build attempt and it came up with the same error...


author: Ellie Z _they_them_
body: Hi [@Robert Pollard](/t5/user/viewprofilepage/user-id/1162721),

Thanks for your reply!

It looks like you deleted the right thing. Due to the complexity of the issue, and the fact that we may need to request server and/or build agent logs, I have created a ticket in our Support System on your behalf.

Please look out for an email with a ticket number like BSP-######. A member of the Support team will reach out there as soon as possible.

Thanks,

Elias


author: Robert Pollard
body: No worries. I did a lot of local testing yesterday. When I tried merging, as I previously mentioned, it shows a different file that is conflicting but with the same error. So, I executed a checkout with "--ours" to keep what we had in the current branch versus what we were merging in (I believe that's how ours/theirs works) and it resolved the conflict.

I noticed, in other branches, as with this conflict, the file we were trying to delete appeared to indicate it was being renamed from the file we were trying to delete to some unrelated file that had not been changed as in:

=============================================================

git merge Roberts_EDSEDW-379_RETIRE_CI

CONFLICT (rename/delete): Rename ops/jobs/EWXX348_M_CI_CROP_INSURANCE.ksh-\>ops/jobs/ROXX101_M_RDF_OV_COMITMENT_CONTRACT_LOAD.ksh in HEAD and deleted in Roberts_EDSEDW-379_RETIRE_CI

Automatic merge failed; fix conflicts and then commit the result.

-------------------------------------------------------------------------------------

git status

# On branch release/Dev

# Your branch is behind 'origin/release/Dev' by 2 commits, and can be fast-forwarded.

#

# Unmerged paths:

# (use "git add/rm \<file\>..." as appropriate to mark resolution)

#

# added by us: ops/jobs/ROXX101_M_RDF_OV_COMITMENT_CONTRACT_LOAD.ksh

#

no changes added to commit (use "git add" and/or "git commit -a")

=============================================================

Then, when I checked out with "--ours" the file it seemed to think our deleted file was renamed to, I did not get the conflict anymore:

-------------------------------------------------------------------------------------

git checkout --ours ops/jobs/ROXX101_M_RDF_OV_COMITMENT_CONTRACT_LOAD.ksh

git status

# On branch release/Dev

# Your branch is behind 'origin/release/Dev' by 2 commits, and can be fast-forwarded.

#

nothing to commit (working directory clean)

-------------------------------------------------------------------------------------

As I previously mentioned, this is the way I solved the problem in my local cloned repo. But, I can't do that, as far as I know, in Bamboo as it is automatic and builds it's working area on-the-fly.

The most important questions I have are, did I resolve this error correctly? Was it necessary to use "--ours"? And, is what is the error really trying to tell me being that it appears that Bamboo believes the deleted file was renamed when in fact it was deleted?

Instead of using the existing branch that had the original problem I recreated the branch and did the same thing the developer did by trying to delete the file.

One interesting thing to note, I tried to use "rm" and then "add" as I have done for years. After deleting the file, I tried the "git add" and it would not add it. I then executed "git rm" and it successfully added the change???