Skip to content

Commit

Permalink
define default git branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
korli committed Jan 19, 2021
1 parent eee899a commit 226a85d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion HaikuPorter/Source.py
Expand Up @@ -500,7 +500,7 @@ def _initImplicitGitRepo(self):
"""Import sources into git repository"""

ensureCommandIsAvailable('git')
info(check_output(['git', 'init'], cwd=self.sourceDir).decode('utf-8'))
info(check_output(['git', 'init', '-b', 'main'], cwd=self.sourceDir).decode('utf-8'))
info(check_output(['git', 'config', 'gc.auto', '0'], cwd=self.sourceDir).decode('utf-8'))
# Disable automatic garbage collection. This works around an issue
# with git failing to do that with the haikuwebkit repository.
Expand Down

9 comments on commit 226a85d

@tqh
Copy link

@tqh tqh commented on 226a85d Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only works on the very new versions of git. Debian's git don't work.

@kallisti5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@korli If we're going to do this, we need to check git versions as part of it.

  • git 2.30 has -b on init
  • git 2.20 does not have -b as an opion on init.

a) find the git version in haikuporter, and track what version of git we're using. Then check it before init.
b) revert until newer versions of git are more widely used.

@waddlesplash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO we should just revert this commit for now, then.

@korli
Copy link
Contributor Author

@korli korli commented on 226a85d Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@korli If we're going to do this, we need to check git versions as part of it.

We can retry without -b in case of failure.

@alaviss
Copy link
Contributor

@alaviss alaviss commented on 226a85d Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The branch rename command git branch -M should be available in older versions, which can be used instead.

@kallisti5
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can retry without -b in case of failure.

The problem then is a git version upgrade of the machine could result in two different branch names.

@korli
Copy link
Contributor Author

@korli korli commented on 226a85d Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can retry without -b in case of failure.

The problem then is a git version upgrade of the machine could result in two different branch names.

How is it a problem?

@waddlesplash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to change the default branch name here? I think master means "master copy", I do not think it needs to be changed. If Git changes the default branch name in a future release, then that's fine, but I'm not sure we need to care about this so much, especially when nobody will even see the default branch name of these repos for the most part.

@korli
Copy link
Contributor Author

@korli korli commented on 226a85d Feb 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Git 2.30 writes 10 lines of hints when we don't name the default branch explicitly (we don't care the branch name).

Please sign in to comment.