git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3] diff-highlight: make install link into DESTDIR

From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Date
Oct 14, 2024, 03:29 UTC
Message-ID
<ZwyQE-BMTn3Fj-BO@danh.dev>
In-Reply-To
<CABOUa4bqPiUM+=6dxW5TTHOdMzXiFD02vWoVJcgAQDhZs8DoXg@mail.gmail.com>
On 2024-10-13 01:41:06+0200, immeëmosol <will+developer@willfris.nl> wrote:
Show 16 quoted lines
> As mentioned, `contrib/diff-highlight` is less like other perl contribs
> like `contrib/contacts` and `contrib/credential/netrc`, those two seem to
> be git subcommands (`git-*`) where diff-highlight is more of a "standalone"
> command.
> 
> My usecase was to peek at what the command does by making it available in a
> `$PATH` writable by a non-root user. (Much like what is mentioned in
> `contrib/diff-highlight/README#Use`: `git log -p --color | diff-highlight`.=
> )
> 
> ```sh
> echo '# Given ~/.local/bin is in $PATH,'
> ( export DESTDIR=3D"${HOME?}/.local/bin/" ; make linked-in-destdir )
> echo '# In another already open shell, try suggestion from readme.'
> ( export DESTDIR=3D"${HOME?}/.local/bin/" ; make clean )
> ```
Nah, it isn't DESTDIR's usage, it's prefix job!
	make prefix=${HOME}/.local install
Show 25 quoted lines
> ---
> Make git's diff-highlight program immediately available to the command-line=
> .
> Create a link in DESTDIR that
> refers to the generated/concatenated diff-highlight perl script
> 
> Signed-off-by: imme=C3=ABmosol <will+developer@willfris.nl>
> ---
>  contrib/diff-highlight/Makefile | 13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/contrib/diff-highlight/Makefile
> b/contrib/diff-highlight/Makefile
> index f2be7cc9243719..84f6e65c730380 100644
> --- a/contrib/diff-highlight/Makefile
> +++ b/contrib/diff-highlight/Makefile
> @@ -10,6 +10,11 @@ diff-highlight: shebang.perl DiffHighlight.pm
> diff-highlight.perl
>      chmod +x $@+
>      mv $@+ $@
> 
> +linked-in-destdir: diff-highlight
> +    test -n "$(DESTDIR)" && \
> +        test -w $(DESTDIR) && \
> +        ln -s $(abspath $<) $(DESTDIR)
So it would be something like this:
	install: diff-highlight
		$(INSTALL) diff-highlight '$(DESTDIR)$(bindir_SQ)'
Show 20 quoted lines
> +
>  shebang.perl: FORCE
>      @echo '#!$(PERL_PATH_SQ)' >$@+
>      @cmp $@+ $@ >/dev/null 2>/dev/null || mv $@+ $@
> @@ -17,7 +22,13 @@ shebang.perl: FORCE
>  test: all
>      $(MAKE) -C t
> 
> -clean:
> +unlink-from-destdir:
> +    test -z "$(DESTDIR)" || \
> +        test ! -L $(DESTDIR)/diff-highlight || \
> +        $(RM) $(DESTDIR)/diff-highlight
> +
> +clean: unlink-from-destdir
>      $(RM) diff-highlight
> 
>  .PHONY: FORCE
> +.PHONY: linked-in-destdir unlink-from-destdir
> 
-- 
Danh
Previous: immeëmosolNext: Taylor Blau
Message 10 of 11 in “diff-highlight: link to diff-highlight in DESTDIR #Makefile #diff-highlight”
  1. diff-highlight: link to diff-highlight in DESTDIR #Makefile #diff-highlightimmeëmosol via GitGitGadget, Oct 12, 2024
  2. Taylor BlauOct 12, 2024
  3. diff-highlight: make install link into DESTDIR #Makefileimmeëmosol via GitGitGadget, Oct 12, 2024
  4. Kristoffer HaugsbakkOct 12, 2024
  5. immeëmosolOct 12, 2024
  6. Junio C HamanoOct 12, 2024
  7. diff-highlight: make install link into DESTDIRimmeëmosol via GitGitGadget, Oct 12, 2024
  8. Jeff KingOct 12, 2024
  9. immeëmosolOct 12, 2024
  10. Đoàn Trần Công DanhOct 14, 2024
  11. Taylor BlauOct 14, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.