HNHacker News
TopNewBestAskShowJobs

andrybak

145 karma · joined October 20, 2023

https://andrybak.dev
submissionscomments
andrybak··on Git Branches: Intuition and Reality
> which branch on a remote is considered the default

You probably mean this place in code: [1]. It uses function git_default_branch_name from refs.c [2], which uses config variable `init.defaultBranch` I've mentioned above. But if it and other look-ups fail, it does fall back to a hard-coded "refs/heads/master".

[1] https://github.com/git/git/blob/v2.43.0/remote.c#L2380-L2394

[2] https://github.com/git/git/blob/v2.43.0/refs.c#L671-L705

Edit: removed mention of a deprecated Git feature to avoid confusion.

andrybak··on Enums in Rust – and why they feel better
> You couldn't model Rust's `Option` or `Result` as a java enum.

For reference, they can be modeled as a "sealed" class since Java 17. https://openjdk.org/jeps/409

Prior to Java 17, sealed classes feature can be partially recreated via private constructors in the super classes. This approach forces you to put all classes in a single Java file, which can be awkward to navigate.

andrybak··on Git Branches: Intuition and Reality
> Git doesn't have the concept of "main is special"

Technically, there is special handling for both "master" and "main" in Git in fairly obvious, but I'd argue in a not very important way. When you merge two regular branches, the commit message is `Merge branch 'source' into destination`. But not if destination is `master` or `main` – the `into ...` part is omitted for those merge commits.

But this is just for backward compatibility. Git is very conservative in changing such user facing behavior as generated merge commit messages. To get Git to treat `master` and `main` truly without special handling, set empty value to config option `merge.suppressDest` [1]:

    $ git config merge.suppressDest ""
`master` is also used as the default name for the default branch in newly created repositories. See option `--initial-branch` of `git init` and config variable `init.defaultBranch` [2] to override. Git for Windows, for example, allows setting the config option in its installer.

Source code:

For merge commit formatting: https://github.com/git/git/blob/2108fe4a1976f95821e13503fd33...

For default branch naming: https://github.com/git/git/blob/91e2ab1587d8ee18e3d2978f2b7b...

Git for Windows installer suggesting setting `init.defaultBranch`:

- https://github.com/git-for-windows/build-extra/blob/586c46ec...

- https://github.com/git-for-windows/build-extra/blob/586c46ec...

Footnotes:

[1] https://git-scm.com/docs/git-merge#Documentation/git-merge.t...

[2] https://git-scm.com/docs/git-init#Documentation/git-init.txt...

andrybak··on A secret deal let Spotify bypass Android's app store fees
> PC ports, IDK. Probably

Yes. Source:

https://gta.fandom.com/wiki/Custom_Radio_Stations

andrybak··on What do we mean by "the foundations of mathematics"?
> For example, we have mathematics without the law of the excluded middle and with it, ones without the axiom of choice and with it, etc.

This is a bit off-topic. Elsewhere in comments [1] people talk about Terence Tao and his recent work in Lean. Lean is based on intuitionistic logic, a base which doesn't include axiom of choice and the excluded middle.

Since Tao and other classical mathematicians need excluded middle for proofs by contradiction.

The Classical library in Lean starts by declaring axiom of choice [2] and after some lemmas introduces excluded middle as a theorem, called "em" for brevity [3]. I like how Lean makes this particular choice for classical mathematics very obvious.

[1] https://news.ycombinator.com/item?id=38102096#38104412

[2] https://github.com/leanprover-community/lean/blob/cce7990ea8...

[3] https://github.com/leanprover-community/lean/blob/cce7990ea8...

andrybak··on A kernel update broke my stylus
> email to the maintainer and the appropriate mailing list

David Revoy has reached out to the linux-input mailing list:

https://lore.kernel.org/linux-input/877c9bed-181a-4fc0-a876-...

← PreviousPage 2 of 2