Coder Social home page Coder Social logo

`match init` assumes a default branch of `master` when using git storage, which is no longer the Github default about fastlane HOT 1 OPEN

gemmakbarlow avatar gemmakbarlow commented on April 27, 2024
`match init` assumes a default branch of `master` when using git storage, which is no longer the Github default

from fastlane.

Comments (1)

lacostej avatar lacostej commented on April 27, 2024

It sounds like a good idea. Here are 2 complementing ideas to your proposal:

  1. we try detect the default branch name.
def default_git_branch
  default_branch  = Fastlane::Actions.git_remote_branch_name(nil)
  default_branch = default_branch.split("\n")[0] if default_branch
  default_branch ||= "main"
end

or

def default_git_branch
  begin
    first_remote = Fastlane::Actions.sh("git remote | head -1", log: false).chomp
    default_branch = Fastlane::Actions.git_remote_branch_name(first_remote)
  rescue => e
  end
  default_branch ||= "main"
end

Also I am using here "main" as default branch. Any reason we should stick to master? We will eventually have to change, right?

Side note: I wish the git_remote_branch_name method was fixed to only return the head of the first remote. We could maybe add a fix for that first. It doesn't really make sense to return a "master\nmaster" if you have 2 remotes with master as default branch. It would also make this code simpler, something like

def default_git_branch
  default_branch  = Fastlane::Actions.git_remote_branch_name(nil)
  default_branch ||= "main"
end
  1. if we really want to ask the user, we could combine asking the user and identifying the default_branch using the above code as first default choice.

Feel free to start your PR, consider using one of the 2 options above.

from fastlane.

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.