most of the time I guess. At least for github. IFAIK, it’s the same for Codeberg repos, for instance.
Note that at the moment, you could also use a branch (main, master etc.) instead of a tag or commit, which might be good for experimentation on the bleeding edge, but a shot to the foot in terms of stability / reliability. See discussion below.
No please don’t use branches for the urls, the moment somebody pushes an update to that branch the content gets a new hash and now your build suddenly starts failing.
Use either tags or the commits directly, because with those the hash will continue to stay the same.
Right, branches better be reserved for experiments I think this can actually be useful, for example if you want to compare two branches of the same library.
I guess when you do things that stay on your machine, then it doesn’t matter what url you pick, or maybe even if you are just working on some application that not many care about.
But getting in the habit of using unreliable urls should be avoided, because the moment some library that uses other libraries uses some branch urls, you get a bad situation where in some unknown point in time all your previously well defined packages and all packages that depend on those get broken and can’t be built anymore, just because somebody somewhere pushed a new commit to an old branch.
Personally I think it would be a good idea, if future tooling would reject branch urls, or have some way to add the info which commit that branch referred to at the time the hash was calculated.
An additional problem is that there is nothing in your project history telling you which commit that branch pointed to, so when it breaks, you now are in the bad situation having to search for a commit that works.
I think those are bad situations to be confronted with, which is why I am against using branches as urls.
Until there is extra tooling to make branches usable, I think they should be avoided generally for urls, I also think you should avoid dependencies that use branch urls in their build.zig.zon.