Git Product home page Git Product logo

Comments (6)

charleso avatar charleso commented on August 22, 2024

Hi Leonidas,

Hmm. So that warning is part of the 'safety' protocol of git-cc that makes sure that the last revision of a file in Git matches the current version of the file in Clearcase. This is to make sure that as git-cc replays your commits in Clearcase that it doesn't accidentally override something.

I would look at the Clearcase history of package/className.java and see if the last commit matches what is in Git. If it does, or in any case, what you can do is check out the git_cc branch, which is where the last sync was from, copy the latest version of that file, commit and then rebase master. That will ensure that you've resolved any merge conflicts and don't lose any changes.

I'm also curious why the rebase isn't picking up changes from Clearcase. git-cc works purely off the timestamp. If you get the timestamp of the git_cc branch commit, and then run cleartool -since $TIME package/className.java. Does it return what you expect?

Finally, as a work around you can do --force, but I really wouldn't recommend that.

Good luck, and let me know how all that goes.

Charles

from git-cc.

spyropoulosl avatar spyropoulosl commented on August 22, 2024

I didn't understand the fix you propose if the ClearCase history matches the Git history.

What I noticed though is that the command:

$ git log -n 1 --pretty=format:%ai master_cc
2013-10-29 18:24:13 +0000

and when I do a gitcc rebase --stash the timestamp is 1 second different:

$ gitcc rebase
> git ls-files --modified
> git log -n 1 --pretty=format:%ai master_cc
> cleartool lsh -fmt %o%m|%Nd|%u|%En|%Vn|%Nc\n -recurse -since 29-Oct-2013.18:24:14 .

As it stands at the moment I can't commit my changes to package/className.java file. I haven't tried the gitcc checkin --force action yet but I would like to eliminate any other possible solution first (and maybe help resolve a bug)

from git-cc.

charleso avatar charleso commented on August 22, 2024

Hi Leonidas,

That extra second is intentional. You don't want to re-add the changes that already exist in Git.

What is the output from running cleartool lsh from above? Or looking at the history tree for that matter?

To work around the issue (and not use --force-) you can take the contents of the className.java file and override the contents in Git you can trick git-cc into thinking it rebased the correct contents. Something like (maybe back up your Git repository before running any of these commands):

git checkout git-cc
cleartool update /view                                                                 # make sure we have the latest
cp /view/package/className.java /git/package/className.java
git add .
git commit -C HEAD                                                                   # Use an old timestamp so we don't miss anything else
git rebase git-cc master
git branch -f git-ci git-cc                                                              # git-cc is the place where we last pushed from, which I'm assuming is equal to git-cc

This is essentially what git-cc does anyway, but without keeping the history. It would be nice to know why lsh isn't picking up the changes. The problem will most likely be that the last commit on master_cc will be after the change to className.java, and thus are no longer picked up.

You could also 'go back in time' and rebase again to see if it managed to pick up the changes.

git branch -f git-cc COMMIT_BEFORE_CHANGE                        # find out when the history diverged, and go back to a commit before that happened
git rebase --onto git-cc git-ci master                                            # you need to be on master for this stunt to work
git branch -f git-ci git-cc
git-cc rebase                                                                             # fetch from an older point in time

I hope this is somewhat helpful.

Charles

from git-cc.

spyropoulosl avatar spyropoulosl commented on August 22, 2024

Hi Charles,

That is useful as general knowledge. I eventually rebase the whole repository again and applied my changes. I think it could be related to line endings. I know that by default the gitcc use autocrlf=false but my IDE (Intellij Idea) keeps on asking to "fix" this to autocrlf=true. I stopped IDEA of making line-endings for GIT and keep them as is (from ClearCase).

Is it possible to leave this ticket open for some time (~1 week) to confirm it's working?

Leonidas

from git-cc.

charleso avatar charleso commented on August 22, 2024

Hi Leonidas,

Doh! Of course - line endings is the other possibility. I never got around to fixing this problem. It was always easier/safer to not mess with line endings. If you could stick with autocrlf=false that will certainly make your life easier.

You're welcome to keep this ticket open. Let me know how you go.

Cheers,
Charles

from git-cc.

spyropoulosl avatar spyropoulosl commented on August 22, 2024

Seems like the line endings was the problem so I can close this. Thanks!

from git-cc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.