Earlier quoted context omitted.
Shells and their aversion to null characters was my first introduction to Perl way back when. Tcl, at the time, couldn't handle null characters either. Various Awk implementations had different issues with them. Python didn't yet exist, C was too tedious for many things. One option with shells is some set/get functions that encode/decode to base64, hex, etc. Feels pretty clunky though.
I am sure you know this, so I'm just being pedantic here, but it's not that really the shells that have an aversion to the null character so much as that the exec() system call and the main() convention require C strings for program names, program arguments and environment variables, and since shells are thin layers above exec() and the environment, shells kinda have to also use C strings. Sure, nothing stops a shell…
Committing Without Git
11–20 of 23 posts
Re: Committing Without Git
#12Earlier quoted context omitted.
I am sure you know this, so I'm just being pedantic here, but it's not that really the shells that have an aversion to the null character so much as that the exec() system call and the main() convention require C strings for program names, program arguments and environment variables, and since shells are thin layers above exec() and the environment, shells kinda have to also use C strings. Sure, nothing stops a shell…
That's the path TCL initially took, but they added counted byte strings later when it became a barrier. And zsh appears to support them relatively well.
Re: Committing Without Git
#13Re: Committing Without Git
#14"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.
Re: Committing Without Git
#15Re: Committing Without Git
#16Re: Committing Without Git
#17Blog posts are becoming my favourite form of knowledge transfer
I’ve been meaning to start one myself and posts like this are making me move it up my todo list
Re: Committing Without Git
#18Re: Committing Without Git
#19He'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.
Re: Committing Without Git
#20Somewhat in the same space, I saw an interesting stackoverflow post[1] about how to generically retrieve a single file from git. Apparently since git version 1.7.9.5, you can do this: git archive --remote=ssh://host/pathto/repo.git HEAD README.md | tar xO Though apparently support depends on how you're running git, and potentially some enabled server side options. [1] https://stackoverflow.com/questions/1125476/retri…
Interesting! I didn't know about the --remote flag and this usage. I would probably have done something like: git clone --filter=tree:0 --depth=1 --sparse --no-checkout && git checkout HEAD (But that would still end up fetching a few more objects than just the desired file.)
(I would assume git doesn't trust the server, and will verify that the chain of hashes works out.)