Coder Social home page Coder Social logo

git-process's Issues

Show nicer error when syncing with non-ff

➜  git-process git:(GH-40) git sync
Pushing to 'GH-40' on 'origin'.
/Users/jmoore/.rvm/gems/ruby-1.8.7-p357/gems/git-process-0.9.1.pre3/bin/../lib/git-process/git-lib.rb:404:in `command': git push "origin" "GH-40:GH-40"  2>&1:To [email protected]:jdigger/git-process.git (Git::GitExecuteError)
 ! [rejected]        GH-40 -> GH-40 (non-fast-forward)
error: failed to push some refs to '[email protected]:jdigger/git-process.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.
    from /Users/jmoore/.rvm/gems/ruby-1.8.7-p357/gems/git-process-0.9.1.pre3/bin/../lib/git-process/git-lib.rb:203:in `push'
    from /Users/jmoore/.rvm/gems/ruby-1.8.7-p357/gems/git-process-0.9.1.pre3/bin/../lib/git-process/git-process.rb:78:in `sync_with_server'
    from /Users/jmoore/.rvm/gems/ruby-1.8.7-p357/gems/git-process-0.9.1.pre3/bin/git-sync:17
    from /Users/jmoore/.rvm/gems/ruby-1.8.7-p357/bin/git-sync:19:in `load'
    from /Users/jmoore/.rvm/gems/ruby-1.8.7-p357/bin/git-sync:19

rebase_to_master tries to delete a remote branch even if it doesn't exist

git push "origin" ":GH-38"  2>&1
/Library/Ruby/Gems/1.8/gems/git-1.2.5/lib/git/lib.rb:700:in `command': git push "origin" ":GH-38"  2>&1:error: unable to push to unqualified destination: GH-38 (Git::GitExecuteError)
The destination refspec neither matches an existing ref on the remote nor
begins with refs/, and we are unable to guess a prefix based on the source ref.
error: failed to push some refs to 'github:jdigger/git-process.git'
    from ./bin/../lib/git-process/git-lib.rb:299:in `send'
    from ./bin/../lib/git-process/git-lib.rb:299:in `command'
    from ./bin/../lib/git-process/git-process.rb:137:in `remove_feature_branch'
    from ./bin/../lib/git-process/git-process.rb:47:in `rebase_to_master'

Handle error condition if rerere while rebasing doesn't work

In git-process.rb

    def handle_rebase_error(rebase_error_message)
      logger.warn("Handling rebase error")

      git.status.each do |status|
        if remerged_file?(status, rebase_error_message)
          lib.add(status.path)
        end
      end

      if lib.clean_status?
        lib.rebase_continue
      else
###### it didn't work
      end
    end

Gem integration

  • Update version
  • See how to install gem from GitHub.
  • Verify how update process would work.

Handle error condition if rerere while merging doesn't work

In git-process.rb

   def handle_merge_error(merge_error_message, merge_message)
      logger.warn("Handling merge error")

      git.status.each do |status|
        if remerged_file?(status, merge_error_message)
          lib.add(status.path)
        end
      end

      if lib.clean_status?
        lib.commit(merge_message)
      else
###### it didn't work
      end
    end

Create "to-master" command

git fetch -p
git rebase origin/master
# resolve
git push origin HEAD:master
# remove remote and local branches

git-new-fb for local-only repo gives error


/Library/Ruby/Gems/1.8/gems/git-process-0.9.3/lib/git-process/git_lib.rb:403:in `command': git checkout "-b" "bob" "/master"  2>&1:fatal: git checkout: updating paths is incompatible with switching branches. (GitProc::GitExecuteError)
Did you intend to checkout 'master' which can not be resolved as commit?
    from /Library/Ruby/Gems/1.8/gems/git-process-0.9.3/lib/git-process/git_lib.rb:221:in `checkout'
    from /Library/Ruby/Gems/1.8/gems/git-process-0.9.3/lib/git-process/new_fb.rb:34:in `runner'
    from /Library/Ruby/Gems/1.8/gems/git-process-0.9.3/lib/git-process/git_process.rb:41:in `run'
    from /Library/Ruby/Gems/1.8/gems/git-process-0.9.3/bin/git-new-fb:50
    from /usr/bin/git-new-fb:19:in `load'
    from /usr/bin/git-new-fb:19

Create "sync" command

git fetch -p
git rebase origin/master
# resolve
git push origin _branchName_:_branchName_

bin/git-sync doesn't work if rebased before pushing

git rebase -i origin/master~1
[detached HEAD 108c9c1] Adds bin/git-new-fb
 8 files changed, 269 insertions(+), 131 deletions(-)
 create mode 100755 bin/git-new-fb
 create mode 100644 lib/git-process/git-branch.rb
 create mode 100644 lib/git-process/git-branches.rb
 create mode 100644 lib/git-process/git-new-fb-options.rb
Successfully rebased and updated refs/heads/new_fb.
➜  git-process git:(new_fb) bin/git-sync                 
Opening existing repository at /Users/jmoore/src/git-process
Starting Git
git status "--porcelain"  2>&1
git branch "-a" "--no-color"  2>&1
git branch "-a" "--no-color"  2>&1
git fetch "-p"  2>&1
git merge "origin/master"  2>&1
git fetch "-p"  2>&1
git push "origin" "new_fb:new_fb"  2>&1
/Library/Ruby/Gems/1.8/gems/git-1.2.5/lib/git/lib.rb:700:in `command': git push "origin" "new_fb:new_fb"  2>&1:To github:jdigger/git-process.git (Git::GitExecuteError)
 ! [rejected]        new_fb -> new_fb (non-fast-forward)
error: failed to push some refs to 'github:jdigger/git-process.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.
    from ./bin/../lib/git-process/git-lib.rb:277:in `send'
    from ./bin/../lib/git-process/git-lib.rb:277:in `command'
    from ./bin/../lib/git-process/git-lib.rb:115:in `push'
    from ./bin/../lib/git-process/git-process.rb:82:in `sync_with_server'
    from bin/git-sync:17

Handle error condition when creating a pull request when one already exists

The error condition is far from clear:

/Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/faraday/response/raise_octokit_error.rb:20:in on_complete': POST https://api.github.com/repos/jdigger/git-process/pulls?access_token=49016656fa8da017934c02a72631ad366b80451b: 422: Validation Failed (Octokit::UnprocessableEntity) from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:9:incall'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:63:in on_complete' from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:8:incall'
from /Library/Ruby/Gems/1.8/gems/faraday_middleware-0.8.7/lib/faraday_middleware/request/encode_json.rb:21:in call' from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/connection.rb:226:inrun_request'
from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/connection.rb:99:in post' from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/request.rb:40:insend'
from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/request.rb:40:in request' from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/request.rb:18:inpost'
from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/client/pulls.rb:11:in create_pull_request' from /Users/jmoore/src/git-process/lib/git-process/pull-request.rb:92:inpull_request'
from /Users/jmoore/src/git-process/lib/git-process/git-process.rb:120:in `pull_request'
from bin/git-pull-request:16

Add sign-off to git-to-master

Before doing git-to-master:

  • If the user is the (last) author
    • Check for the existence of comments on a pull-request: if none, complain
  • else
    • sign the last commit

No pulls gives a 404

/Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/faraday/response/raise_octokit_error.rb:16:in `on_complete': GET http://github.webapps.rr.com/api/v3repos/webcms/omega/pulls?state=open&access_token=8ae10ff5b85706aa609ae5cbd17af4cacc05d1d5: 404: Not Found (Octokit::NotFound)
    from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:9:in `call'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:63:in `on_complete'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/response.rb:8:in `call'
    from /Library/Ruby/Gems/1.8/gems/faraday_middleware-0.8.7/lib/faraday_middleware/request/encode_json.rb:21:in `call'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/connection.rb:226:in `run_request'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.8.1/lib/faraday/connection.rb:87:in `get'
    from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/request.rb:40:in `send'
    from /Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/octokit/request.rb:40:in `old_request'
    from /Library/Ruby/Gems/1.8/gems/git-process-0.9.1.pre3/lib/git-process/github_client.rb:70:in `request'

Show nicer error when GH credentials don't work

Authorizing this to work with your repos.
Your GitHub password: xxxxxxxxxxxxxxxxxxxx
/Library/Ruby/Gems/1.8/gems/octokit-1.4.0/lib/faraday/response/raise_octokit_error.rb:12:in `on_complete': POST http://github.webapps.rr.com/api/v3/authorizations: 401: Bad credentials (Octokit::Unauthorized)

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.