hraban / tomono

Multi- To Mono-repository merge
https://tomono.0brg.net
GNU Affero General Public License v3.0
842 stars 138 forks source link

Error: .gitignore overlaps with .gitignore. Cannot bind. #26

Closed eholley closed 6 years ago

eholley commented 6 years ago

Attempting to merge two repositories, "sdk" and "ios", into a common repo, "shared".

I've tried twice now, but receive this error:

Fetching sdk.. Automatic merge went well; stopped before committing as requested Automatic merge went well; stopped before committing as requested Automatic merge went well; stopped before committing as requested Automatic merge went well; stopped before committing as requested e718385aae9109caf79b60678769846ec427f7b3 error: Entry 'sdk/.gitignore' overlaps with 'sdk/.gitignore'. Cannot bind.

Both sdk and ios have gitignore files, so I removed git from the master branches and pushed. Tried to merge again and received the same error. Both repos have many branches.

  1. Does gitignore have to be manually removed from every branch?
  2. Should I modify tomono.sh to use diff-tree instead of read-tree?
hraban commented 6 years ago

Hi eholley. Sorry to hear this. The script is definitely supposed to work with .gitignore files; almost every repo has them. What it should be doing, is creating two separate dirs: ios and sdk, and merging into those directories. I don't know why it would try to bleed across dirs.

This is a complete stab in the dark, but are you sure that you didn't accidentally format the file like this?

git@github.com:eholley/sdk.git  sdk
git@github.com:eholley/ios.git  sdk

Notice the same dirname for the ios project; that should have been ios.

Could that be it?

hraban commented 6 years ago

(to clarify: I was talking about the "repos.txt config file" which you pipe to the script when running it)

eholley commented 6 years ago

repos.txt (redacted): ssh://git...sdk.git sdk ssh://git...ios.git ios

eholley commented 6 years ago

Because my network here (on vacation) is not the best, I decided to try narrowing it down to script vs. network. I was able to clone both repos using "git clone --bare ..." and changed my repos.txt file to point to these local directories. The script then worked when fetching from these locals. So, my guess is that networks hickup sometime during the script execution causes an unknown error condition. It now looks like every is setup properly.

I'm missing a few branches, though. Still researching...

hraban commented 6 years ago

that might be a false positive; a local clone doesn't clone all the branches, only the current one.

Could you run the script again after setting DEBUGSH to a non-empty variable?

export DEBUGSH=asdf
.... tomono.sh

and tell me where exactly it's failing?

eholley commented 6 years ago

Correct on the false positive. Tomono correctly processed the branches it was given. I’m no longer on vacation with that internet connection, but I’ll try again with the debug option and see what we get. Thank you for your kind support on this.

eholley commented 6 years ago

Still receiving this error. Here's the debug dump.

eholley commented 6 years ago

Found the problem. I reduced the repos.txt to the ios repo and it worked. I started over with only the sdk repo. It failed, so we're dealing with just the sdk repo for some reason. Examining the refs in the sdk repo revealed a hidden branch named HEAD.

$ git show-ref --head 0f4472e0fc4f400dd107b7ed90525ed0c7a2fbdf HEAD 19faad94a513937c19737c48ea5f398e0233b72f refs/heads/HEAD 0f4472e0fc4f400dd107b7ed90525ed0c7a2fbdf refs/heads/develop ...

Where did that thing (19faad94) come from? Must have happened a long time ago when someone botched a merge. The ref has been flying under the radar because it was named HEAD.

Fix and show refs again:

$ git update-ref -d refs/heads/HEAD $ git show-ref --head 0f4472e0fc4f400dd107b7ed90525ed0c7a2fbdf HEAD 0f4472e0fc4f400dd107b7ed90525ed0c7a2fbdf refs/heads/develop ...

I added both repos back into my repos.txt and tomono successfully processed everything. Whew.

Takeaway: Petition congress to issue law against naming a branch HEAD.

hraban commented 6 years ago

🙏 Nice work!

Takeaway: Petition congress to issue law against naming a branch HEAD.

Amen! You have my vote. What district? I’ll just put you down as a write in.

A change we can believe in.