Conversation
| fi; \ | ||
| if [ "$$should_install" = 'yes' ]; then \ | ||
| echo "... installing $(COMMAND)"; \ | ||
| head -1 bin/$(COMMAND) > $(TEMPFILE); \ |
There was a problem hiding this comment.
What about building the script content in a subshell and redirecting it directly to the destination? This avoids mktemp, chmod on temp files from the beginning.
There was a problem hiding this comment.
Maybe something like this?
- source the
helper/scripts rather than embedding them- add the source command to each script in
bin/
- add the source command to each script in
- install the
helper/scripts in/usr/share/git-extras/helperor similar - separate out a
buildtarget from theinstalltarget - build each of the to-be-installed scripts in a pattern rule that would just add the install path for the
helper/scripts.
There was a problem hiding this comment.
Is this plan a little complicated? We can just use the subshell's stdout as a temp file, so no need to use a real file.
There was a problem hiding this comment.
@spacewander Could we keep using the temporary file? Things kind of look complicated enough with this being embedded in a Makefile and all,.
There was a problem hiding this comment.
@hyperupcall
I am OK to keep the temporary file here, since you think removing it would require complicated code.
There was a problem hiding this comment.
Is this plan a little complicated?
The plan I proposed is the normal way most projects get built from source, the current setup for git-extras seemed more complicated to me. I don't mind if you want to keep the current setup though.
hyperupcall
left a comment
There was a problem hiding this comment.
Looks great so far! Was a little bothersome to learn that git-extras didn't cleanup properly after execution.
Just had a few minor comments; once addressed, I'll approve!
| fi; \ | ||
| if [ "$$should_install" = 'yes' ]; then \ | ||
| echo "... installing $(COMMAND)"; \ | ||
| head -1 bin/$(COMMAND) > $(TEMPFILE); \ |
There was a problem hiding this comment.
@spacewander Could we keep using the temporary file? Things kind of look complicated enough with this being embedded in a Makefile and all,.
|
|
||
| set -euo pipefail | ||
|
|
||
| proceed=false |
There was a problem hiding this comment.
Could this be moved out to a separate PR? For matching the argument, would prefer using $1 == @(--proceed|-p) (enabling extglob) or keeping the existing structure and using group commands ({ true && true; }) instead of subshells.
There was a problem hiding this comment.
This commit used to be on the old master branch before it got renamed to main. I based my branch on master because I didn't notice the new main branch, oops! The commit was already merged into main as commit 52897f7, albeit slightly modified. If I can get permission to rebase onto main then I can remove this commit and resolve this problem.
There was a problem hiding this comment.
Definitely, go ahead
Otherwise it wouldn't get deleted when $(COMMANDS) is empty. Fixes: tj#1227 (comment)
|
I wonder if git-extras needs something more comprehensive to prevent future instances of this issue? Maybe |
Personally, I think temporary files are OK because most git-* commands generate small text files. I am worried that adding a temporary files list may make the code complicated. |
No description provided.