Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your Scripts Assume git init Creates master and Git 3.0 Will Make It main

A new developer joined and ran the tests. Fourteen failed on her laptop and passed in CI. All of them in the same file. The tests built little repositories to try the release tool on. git init in a temporary folder, commit a file, then check out master and tag it. On her machine there was no master. Her Git was set up to call the first branch main. So the checkout failed, and every test after it.…

A new developer encountered issues with tests, failing on her laptop but passing in the Continuous Integration (CI) system. The tests involved creating small repositories to test the release tool. The process involved initializing a repository, committing a file, checking out the "master" branch, and tagging it. However, on her machine, there was no "master" branch.

Her Git configuration was set up to call the first branch "main," causing the checkout to fail and affecting subsequent tests. This discrepancy arose because Git itself did not change its default branch name, while GitHub switched to "main" in 2020. Some CI images had not been updated to use the new default branch name.

The script's behavior varied between machines, and it would continue to do so as Git prepares for version 3.0. The default branch becoming "main" is on the list of breaking changes planned for the new version. Once the build image upgrades to Git 3.0, all scripts that assumed the default branch would no longer work. Developers should stop depending on the default branch name in either direction.

When a script creates a repository, explicitly name the branch using "git init -b" followed by the desired name. This approach has been effective since Git 2.28.

To handle the current branch, scripts should ask for it using "git branch show current." For the main branch of a remote, scripts should query the remote's HEAD. By searching for the word "master" across scripts, CI files, hooks, and release tooling, developers can decide how each one should behave. It is essential to add a job to CI that sets init.defaultBranch to a name that no one uses, such as "trunk" or "banana."

This approach ensures that scripts that pass will not rely on the default branch name, and those that fail were guessing. Ultimately, a default branch name is a decision made by someone else, and they are allowed to change their mind.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

You Saved the Stuck Design Problem for Your Sharpest Hour and It Would Not Move

You know when you are sharpest. For you it is nine to eleven, coffee in, messages off. So that is where you put the hard thing. The design problem you had been stuck on for a week.

  • Individual struggled with design problem for a week during peak hours.
  • Solution emerged at 4:30 PM on Thursday, during off-peak hours.
  • Research suggests tackling insight problems during off-peak hours can be effective.

You Did Most of the Work on That Project and So Did Everyone Else

The retro was polite. Everybody said it had been a team effort. Afterwards, over coffee, three people told you, separately, the same thing. Honestly, I carried that one. Each of them meant it.

  • Each person independently estimated their contribution to household chores.
  • Combined total of contributions exceeded the entire task.
  • Recognizing others' contributions alleviates perceived burden.

Your Manager Rewrites Every Document Before It Goes Out

You spent most of the week on the proposal. You sent it to your manager on Thursday, and on Friday the version that went to the directors was almost unrecognisable.

  • Manager extensively rewrites documents before distribution
  • Frequent edits cause self-doubt and questioning of writing abilities
  • Recognize patterns in changes to communicate with manager

Ssangyong E&C Secures Potential KRW 3.6 Trillion Dubai Development Pipeline

Ssangyong Engineering & Construction has entered into a strategic partnership with Dubai-based Wasl Group, securing a potential development project pipeline worth approximately KRW 3.6 trillion over…

  • Ssangyong E&C partners with Dubai-based Wasl Group.
  • Potential KRW 3.6 trillion development pipeline over three years.
  • Collaboration includes residential, hotels, and mixed-use projects.

More from Thursday 5 November →