Andr3as / Codiad-CodeGit

Git integration for Codiad
MIT License
26 stars 15 forks source link

Failed to push due to the need to merge files #11

Closed pedroponte closed 10 years ago

pedroponte commented 10 years ago

Hi, is it possible to merge the files with this plugin? Scenario: User A has edited file X, committed and pushed to server. User B, hasn't pulled yet, changed the file, committed and tried to push when he gets the error that the push failed.

The output from the command line is the following:

To git@myserver.com:gitrepo.git ! [rejected] dev -> dev (non-fast-forward) error: failed to push some refs to 'git@myserver.com:gitrepo.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') hint: before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

$ git pull U myproject/design/patterns links.txt Pull is not possible because you have unmerged files. Please, fix them up in the work tree, and then use 'git add/rm ' as appropriate to mark resolution, or use 'git commit -a'.

Is it possible to know/identify which files are causing the error and fix them using the plugin?

Many thanks

Andr3as commented 10 years ago

Try the latest version. I updated it to interpret unmerged files as modified. So they should be visible in the overview.

pedroponte commented 10 years ago

Hi Andreas,

the issue remains unfortunately, please see below:

user1 .git config:

[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = git@myserver.com:mygitrepo.git fetch = +refs/heads/:refs/remotes/origin/ [branch "master"] remote = origin merge = refs/heads/master [user] name = User 1 email = user1@myserver.com [branch "dev"] remote = origin merge = refs/heads/dev

user2 .git config:

[core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] url = git@myserver.com:mygitrepo.git fetch = +refs/heads/:refs/remotes/origin/ [branch "dev"] remote = origin merge = refs/heads/dev [user] name = User 2 email = user2@myserver.com

updated one file with string "test5456" with user 1, commited, pushed=>success updated same file with string "test5457" with user 2, commited, pushed=>error, tried to pull=>error.

Is there any dialog to merge the 2 files with the plugin?

On user 2, the file now displays:

<<<<<<< HEAD

test5457

test5456

6d6e276d962f8a2ca8f74729221f652069c33408

On user 1 it displays:

test5456

I'm using branch "dev" for both users.

Thanks

pedroponte commented 10 years ago

If I try to override it on user 2 and update with "test5457" I get the following error when trying to commit:

fatal: ambiguous argument 'countup/design/patterns': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]'

Andr3as commented 10 years ago

CodeGit doesn't have a dialog to merge 2 files.

I've done the following and it worked: screen Now you have to edit your file and decide what parts you want to keep. screen_2 Now you have to commit your merged files. screen_3 After this I was able to push my changes. Maybe you want to have a look on my tests: https://github.com/Andr3as/Test

pedroponte commented 10 years ago

thanks for the follow up. When I try to commit the file from user 2, I get the following error:

1

2

Would you be able to tell me please in which part of the code is this being run and what git commands will it run so I can compare it via my command line please?

Thanks

pedroponte commented 10 years ago

According to this link it could be something to do with quoting: http://superuser.com/questions/273570/git-log-alias-fatal-ambiguous-argument-ad-unknown-revision-or-path

On the command line, running this command works though, not sure it this is being run before the commit?

git log --pretty=format:\"myproject/design/patterns\" --graph --date=short

It would be good if it had to do with escaping the quotes, that would be simple to solve, I hope

pedroponte commented 10 years ago

The same error occurs with the File Get Diff menu. Could it have to do with the fact that the file has one space in the filename?

Diff fatal: ambiguous argument 'countup/design/patterns': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]'

pedroponte commented 10 years ago

Yeah, sounds like it is related with the filename having a space in it. Just tested with another file with no space in the filename and it works.

The file causing an error is named "patterns links.txt". However, the commits and diffs don't pick up the last part of the name.

Do you think you be able to look into it please?

Many thanks

Andr3as commented 10 years ago

I moved the second problem to its own issue (#14) and close this question since the merging of file is solved.

pedroponte commented 10 years ago

Thanks!