This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-10-11
Channels
- # announcements (5)
- # babashka (43)
- # beginners (78)
- # calva (1)
- # cider (35)
- # clj-kondo (15)
- # clj-otel (3)
- # cljs-dev (2)
- # clojure (24)
- # clojure-denmark (1)
- # clojure-dev (9)
- # clojure-europe (43)
- # clojure-israel (1)
- # clojure-italy (1)
- # clojure-losangeles (3)
- # clojure-nl (1)
- # clojure-norway (54)
- # clojure-romania (1)
- # clojure-uk (2)
- # clojurescript (1)
- # core-async (25)
- # cursive (7)
- # datascript (6)
- # datomic (7)
- # docker (2)
- # emacs (2)
- # events (8)
- # exercism (2)
- # fulcro (2)
- # hyperfiddle (16)
- # lsp (46)
- # malli (10)
- # membrane (2)
- # music (6)
- # nbb (30)
- # off-topic (49)
- # polylith (4)
- # reagent (3)
- # releases (4)
- # shadow-cljs (5)
- # slack-help (1)
- # sql (2)
- # testing (2)
- # timbre (6)
- # tools-deps (29)
- # xtdb (36)
Time to revisit Clojure on Scheme? https://spritely.institute/news/scheme-wireworld-in-browser.html
;; emacs
(setq clojure-indent-style always-indent)
;; clojure -- universal, eternal solution to any indentation problem. sorry.
(some-function
10
1
2)
(some-function 10
1
2)
is stack overflow when inspecting a long string a known issue in CIDER?
thanks
https://www.youtube.com/watch?v=vyjHRlQrVSA this talk about a combination schema library and static analyzer for javascript is really neat. makes me wonder if such a thing would be possible in clojure. (Schema or Malli, perhaps?)
the tl;dr is that you have a normal library for defining types, and use library-specific versions of the built-in functionality to define type-aware objects and functions:
const Point2D = struct({ x: Num, y: Num, });
const point = Point2D.from({ x: 10, y: 20, });
to validate and create the object.and then you have a linter/static analyzer/type checker treat those library-specific functions as classic type definitions and assertions, and raise warnings or errors if there are mistakes or mismatches:
point.x = "10";
fails in the static analyzer/type checker because point
is known to be a Point2D
and Point2D.x
is known to be a Num
.Malli + clj-kondo may work like that currently? I haven't dived into it but I'd assume that kondo checks for the basic types, perhaps a touch more, and then more domain-specific properties can be verified at runtime? https://github.com/metosin/malli#clj-kondo
Can git diff between two branches miss any changes? My experience and a quick 10 minutes google search tells me the answer is no. But i'm about to force push and i don't want to learn otherwise after đ
thereâs an option force-with-lease
or something similar that is what you want
itâs basically âforce push, but only if the state of the remote is what i currently think it is.â
> --force-with-lease
alone, without specifying the details, will protect all remote refs that are going to be updated by requiring their current value to be the same as the remote-tracking branch we have for them.
It also kinda means what you mean by "miss". There are ways to get the git diff
display to ignore whitespace (or other stuff arbitrarily). Also, it might not show much interesting for changes in "binary" files.
do the hashes match? if so, the theory is that the data that generated the hashes is identical.
a force push is like calling reset! on an atom, which is inherently a race, force-with-lease has a few different forms to protect against races
--force-with-lease=<refname>:<expect> is the strongest turns it into a compare-and-set!
By "miss" i mean if the output of git diff origin/x
is nothing. Then when if i force push the local branch to origin/x the files themselves won't change. I understand I'll be overwriting the history of origin/x with what's on the local branch.
@U11BV7MTK in the force-with-lease docs, what is 'the current value' the files? (i'm sure there is a more accurate description than "files").
So force-with-lease would fail if the two remotes had different code, but would pass if they had the same code but different commits?
thanks to everyone chiming in btw đ
âi know whatâs there and i want to overwrite itâ - force-with-lease âi want to overwrite itâ - force
but i donât know what you want to do if the diff is empty (just commit rewording or squashes?)
--force-with-lease without args will only overwrite if the remote's branch commit is an ancestor of the local branches commit
which is not as strong as "only overwrite if the remote branches commit is X" which is what --force-with-lease=<refname>:<expect> does
there are ways to get git diff
to ignore stuff (like whitespace) so I don't think an empty git diff
indicates an identical tree, but usually
when you have a remote repo, and locally do something like git diff whatever remote-repo/foo
git is actually operating on basically a cache, what it thinks remote-repo/foo is pointing to based on the last time that data was fetch from remote-repo
if you're trying to clean up history (which may or may not actually be a good idea), you would probably be better off using something like git rebase -i
and squashing commits.
it's also trivial to make a backup branch of origin/x
and push just to prevent any errors until you "fix" origin/x
In this case the remote branch should be an ancestor. The reason this came up is because i was using github PR's to merge from one branch into another and realized I could skip that step and just push the branch to the other. eg. git push origin <branch-a> <branch-b>. But currently, that fails because branch-b has the merge commits from the github pullrequets and branch-a doesn't.
that is sort of the definition of what a merge does, takes missing commits from A and merges them into the history of B
what you likely want to do is either merge branch-b into branch-a before pushing branch-a to branch-b or rebase branch-a on to branch-b before pushing
with what you do being dictated by how important having a neat graph is when you look at github history
the merge isn't failing, unless i'm missing something. It's the push that fails:
git push origin A:B
To github.com:company/foo.git
! [rejected] A -> B (non-fast-forward)
error: failed to push some refs to 'github.com:company/foo.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and integrate the remote changes
hint: (e.g. 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
I agree merging branch-b into branch-a before pushing branch-a to b would also solve this.
I might end up doing that, that's what i would usually do.Obviously, this is beyond the scope of your problem, but I highly recommend reading through https://git-scm.com/book/en/v2. It will not only help you with using git
, but I think some of the principles are more generally interesting and applicable.
> and if B has commits that A doesn't, then by definition B is not an ancestor of A so if A: 0 <- 1 And B: 0 <- 1 <- 2 Then B isn't an ancestor of A? I'm hopefully repeating what you said back to make sure i'm reading this right.
Yeah, i guess that makes sense because B(2) isn't before A(1).
I guess i thought it was that they had a common ancestor, in my example 1 or 0.