Live data from Hacker News

Committing Without Git

matheustavares.gitlab.io

21–23 of 23 posts

Re: Committing Without Git

#21

He's effectively writing a minimal git client in Python. "Fun" is a good reason for this sort or exploration, but it also has its practical uses. For instance, I use `isomorphic-git` (a git client written in JavaScript) to include a comment with the relevant commit hash in my bundled JavaScript. I can run it on any machine with Node, without opening a shell or trying to find where/if git is installed locally.

Alright I'm really curious on the use case of this. Is it for debugging assistance or anything else?

They get deployed into a Colab cell or Google Drive. It's nice to be able to see what version is there without running anything.

Re: Committing Without Git

#22

Earlier quoted context omitted.

Alright I'm really curious on the use case of this. Is it for debugging assistance or anything else?

They get deployed into a Colab cell or Google Drive. It's nice to be able to see what version is there without running anything.

There's an api to update a Colab cell publicly available? That's wild. I thought for sure it would be locked down.

Re: Committing Without Git

#23

Earlier quoted context omitted.

They get deployed into a Colab cell or Google Drive. It's nice to be able to see what version is there without running anything.

There's an api to update a Colab cell publicly available? That's wild. I thought for sure it would be locked down.

Best solution I've found is to paste the whole thing into a cell with this header

    #@title Give your cell a headline
    %%js_module
where js_module is defined here:

    # Copyright 2023 Google LLC.
    # SPDX-License-Identifier: Apache-2.0
    from IPython.core.display import display, HTML
    from IPython.core.magic import register_cell_magic
    import time

    @register_cell_magic
    def js_module(line, cell):
      if cell.startswith('http'):
        src, hash = cell.split('#') if '#' in cell else [cell, '']
        timestamp = time.time() if 'cachebust' in line else ''

        display(HTML(
          "".format(src = src, hash = hash, timestamp = timestamp)
        ))
      else:
        display(HTML(
          "{cell}".format(cell = cell)
        ))
The #@title lets you collapse the cell, so the JavaScript isn't showing. Colab has a strong philosophy of ensuring the user can see everything they're running, so I don't think there's a better way to encapsulate the bundled JS.
Post reply on HN