Committing Without Git
matheustavares.gitlab.io
Committing Without Git
1–10 of 23 posts
Re: Committing Without Git
#2Re: Committing Without Git
#3Re: Committing Without Git
#4 $ TEST_VAR="$(printf 'first\0second')"
bash: warning: command substitution: ignored null byte in input
I'm not familiar with working with null characters in Bash in this way, but I think there might be a way to do it.Re: Committing Without Git
#5One could use `printf 'first\0second'` in the Bash shell as an example of making a "string" with null embedded into it, but you can't store that in a Bash variable. $ TEST_VAR="$(printf 'first\0second')" bash: warning: command substitution: ignored null byte in input I'm not familiar with working with null characters in Bash in this way, but I think there might be a way to do it.
Re: Committing Without Git
#6A few months ago I figured out how to modify remote refs in a similar fashion although I wrote it in go. https://stackoverflow.com/a/77210784/308851
Re: Committing Without Git
#7One could use `printf 'first\0second'` in the Bash shell as an example of making a "string" with null embedded into it, but you can't store that in a Bash variable. $ TEST_VAR="$(printf 'first\0second')" bash: warning: command substitution: ignored null byte in input I'm not familiar with working with null characters in Bash in this way, but I think there might be a way to do it.
One option with shells is some set/get functions that encode/decode to base64, hex, etc. Feels pretty clunky though.
Re: Committing Without Git
#8 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/retrieve-a-singl...
Re: Committing Without Git
#9Somewhat 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…
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.)
Re: Committing Without Git
#10One could use `printf 'first\0second'` in the Bash shell as an example of making a "string" with null embedded into it, but you can't store that in a Bash variable. $ TEST_VAR="$(printf 'first\0second')" bash: warning: command substitution: ignored null byte in input I'm not familiar with working with null characters in Bash in this way, but I think there might be a way to do it.
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.