Skip to content

Conversation

@imme-emosol
Copy link

@imme-emosol imme-emosol commented Dec 30, 2020

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.
As mentioned in contrib/diff-highlight/README#Use: git log -p --color | diff-highlight.

( export DESTDIR="${HOME?}/.local/bin/" ; make linked-in-destdir )
echo '# In another already open shell, try suggestion from readme.'
( export DESTDIR="${HOME?}/.local/bin/" ; make clean )

Thanks to all of you for the introduction into how contributions to git/git are handled.
Though it has been quite an informative introduction, and i can understand the suggestion of making it a install-target like other contrib-parts, i am currently not spending more time on this. Thanks again, and have a good day.

cc: Taylor Blau [email protected]
cc: "Kristoffer Haugsbakk" [email protected]
cc: immeëmosol [email protected]
cc: Jeff King [email protected]
cc: Đoàn Trần Công Danh [email protected]

@gitgitgadget-git
Copy link

Welcome to GitGitGadget

Hi @imme-emosol, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests.

Please make sure that your Pull Request has a good description, as it will be used as cover letter.

Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:

  • the lines should not exceed 76 columns,
  • the first line should be like a header and typically start with a prefix like "tests:" or "commit:", and
  • the commit messages' body should be describing the "why?" of the change.
  • Finally, the commit messages should end in a Signed-off-by: line matching the commits' author.

It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code.

Contributing the patches

Before you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form /allow. A good way to find other contributors is to locate recent pull requests where someone has been /allowed:

Both the person who commented /allow and the PR author are able to /allow you.

An alternative is the channel #git-devel on the FreeNode IRC network:

<newcontributor> I've just created my first PR, could someone please /allow me? https://github.com/gitgitgadget/git/pull/12345
<veteran> newcontributor: it is done
<newcontributor> thanks!

Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment /submit.

If you want to see what email(s) would be sent for a /submit request, add a PR comment /preview to have the email(s) sent to you. You must have a public GitHub email address for this.

After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail).

If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the (raw) link), then import it into your mail program. If you use GMail, you can do this via:

curl -g --user "<EMailAddress>:<Password>" \
    --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt

To iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description):

Changes since v1:
- Fixed a typo in the commit message (found by ...)
- Added a code comment to ... as suggested by ...
...

To send a new iteration, just add another PR comment with the contents: /submit.

Need help?

New contributors who want advice are encouraged to join [email protected], where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join.

You may also be able to find help in real time in the developer IRC channel, #git-devel on Freenode. Remember that IRC does not support offline messaging, so if you send someone a private message and log out, they cannot respond to you. The scrollback of #git-devel is archived, though.

@gitgitgadget-git
Copy link

There is an issue in commit 597e3b9:
Commit checks stopped - the message is too short

@dscho
Copy link
Member

dscho commented Dec 30, 2020

/allow

@gitgitgadget-git
Copy link

User imme-emosol is now allowed to use GitGitGadget.

WARNING: imme-emosol has no public email address set on GitHub

@gitgitgadget-git
Copy link

There are issues in commit 8a9f22f:
add symlinking diff-highlight into DESTDIR
Commit checks stopped - the message is too short
Commit not signed off

@gitgitgadget-git
Copy link

There are issues in commit f910598:
diff-highlight: Link to diff-highlight in DESTDIR #Makefile #diff-highlight
Prefixed commit message must be in lower case

@imme-emosol
Copy link
Author

/preview

@gitgitgadget-git
Copy link

Preview email sent as [email protected]

@imme-emosol
Copy link
Author

/submit

@gitgitgadget-git
Copy link

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-938/imme-emosol/patch-1-v1

To fetch this version to local tag pr-git-938/imme-emosol/patch-1-v1:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-938/imme-emosol/patch-1-v1

@gitgitgadget-git
Copy link

On the Git mailing list, Taylor Blau wrote (reply to this):

On Sat, Oct 12, 2024 at 03:03:19PM +0000, immeëmosol via GitGitGadget wrote:
> diff --git a/contrib/diff-highlight/Makefile b/contrib/diff-highlight/Makefile
> index f2be7cc9243..10c588a7929 100644
> --- a/contrib/diff-highlight/Makefile
> +++ b/contrib/diff-highlight/Makefile
> @@ -9,6 +9,7 @@ diff-highlight: shebang.perl DiffHighlight.pm diff-highlight.perl
>  	cat $^ >$@+
>  	chmod +x $@+
>  	mv $@+ $@
> +	ln --symbolic --target-directory=$(DESTDIR) $(abspath $@)

Hmm. I am not opposed to having diff-highlight's Makefile be responsible
for installing a symbolic link to the generated script, but I do not
think that this Makefile recipe is the right place to do it.

This recipe is about building the executable, not installing it. If you
want to introduce a separate .PHONY recipe for installing the script, I
think that would be a better place to introduce this change.

Thanks,
Taylor

@gitgitgadget-git
Copy link

User Taylor Blau <[email protected]> has been added to the cc: list.

@gitgitgadget-git
Copy link

There are issues in commit 859e487:
diff-highlight: provide install into destdir #Makefile
Commit checks stopped - the message is too short
Commit not signed off

@imme-emosol
Copy link
Author

/preview

@gitgitgadget-git
Copy link

Preview email sent as [email protected]

@imme-emosol
Copy link
Author

/submit

@gitgitgadget-git
Copy link

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-938/imme-emosol/patch-1-v2

To fetch this version to local tag pr-git-938/imme-emosol/patch-1-v2:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-938/imme-emosol/patch-1-v2

@gitgitgadget-git
Copy link

On the Git mailing list, "Kristoffer Haugsbakk" wrote (reply to this):

On Sat, Oct 12, 2024, at 19:30, immeëmosol via GitGitGadget wrote:
> [PATCH v2] diff-highlight: make install link into DESTDIR #Makefile

What does `#Makefile` mean?  Previous subject had two of these:

    diff-highlight: link to diff-highlight in DESTDIR #Makefile #diff-highlight

-- 
Kristoffer Haugsbakk

@gitgitgadget-git
Copy link

User "Kristoffer Haugsbakk" <[email protected]> has been added to the cc: list.

@gitgitgadget-git
Copy link

On the Git mailing list, immeëmosol wrote (reply to this):

On Sat, 12 Oct 2024, 20:35 Kristoffer Haugsbakk,
<[email protected]> wrote:
>
> On Sat, Oct 12, 2024, at 19:30, immeëmosol via GitGitGadget wrote:
> > [PATCH v2] diff-highlight: make install link into DESTDIR #Makefile
>
> What does `#Makefile` mean?  […]

not much.
It is an attempt to signify what the commit relates to.
In this case it might hint at the commit not impacting the sources of
what is built, but the build process itself.
Maybe #🏗️ would be more clear.

@gitgitgadget-git
Copy link

User immeëmosol <[email protected]> has been added to the cc: list.

@gitgitgadget-git
Copy link

On the Git mailing list, Junio C Hamano wrote (reply to this):

immeëmosol <[email protected]> writes:

> On Sat, 12 Oct 2024, 20:35 Kristoffer Haugsbakk,
> <[email protected]> wrote:
>>
>> On Sat, Oct 12, 2024, at 19:30, immeëmosol via GitGitGadget wrote:
>> > [PATCH v2] diff-highlight: make install link into DESTDIR #Makefile
>>
>> What does `#Makefile` mean?  […]
>
> not much.
> It is an attempt to signify what the commit relates to.
> In this case it might hint at the commit not impacting the sources of
> what is built, but the build process itself.
> Maybe #🏗️ would be more clear.

Drop all these.  Study "git shortlog --no-merges" from the recent
history and try to blend in.  Don't try to be original where the
originality does not matter.

Also, resist the temptation to go outside POSIX.1 needlessly.

  https://pubs.opengroup.org/onlinepubs/9799919799/utilities/rm.html#tag_20_104

does not say "rm" takes "--force" and

  https://pubs.opengroup.org/onlinepubs/9799919799/utilities/ln.html#tag_20_67

does not say "ln" takes "--symbolic" nor "--target-directory".

Be inclusive and help those whose userland tools are not tainted by
GNUisms.

Thanks.

@imme-emosol
Copy link
Author

/submit

@gitgitgadget-git
Copy link

Submitted as [email protected]

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git/ pr-git-938/imme-emosol/patch-1-v3

To fetch this version to local tag pr-git-938/imme-emosol/patch-1-v3:

git fetch --no-tags https://github.com/gitgitgadget/git/ tag pr-git-938/imme-emosol/patch-1-v3

@gitgitgadget-git
Copy link

On the Git mailing list, Jeff King wrote (reply to this):

On Sat, Oct 12, 2024 at 08:23:33PM +0000, immeëmosol via GitGitGadget wrote:

> diff --git a/contrib/diff-highlight/Makefile b/contrib/diff-highlight/Makefile
> index f2be7cc9243..a53e09e0bdd 100644
> --- a/contrib/diff-highlight/Makefile
> +++ b/contrib/diff-highlight/Makefile
> @@ -10,6 +10,9 @@ diff-highlight: shebang.perl DiffHighlight.pm diff-highlight.perl
>  	chmod +x $@+
>  	mv $@+ $@
>  
> +install: diff-highlight
> +	test -w $(DESTDIR) && ln -s $(abspath $<) $(DESTDIR)
> +

I'm not opposed to having an install target here, like we do in the main
Makefile and in a few other contrib directories.

But in that case, I think it should behave more like those other
targets:

  1. Actually copy the program rather than making a symlink. Preferably
     using $(INSTALL).

  2. Respect $(prefix) in the usual way.

And also...

>  clean:
> +	test ! -L $(DESTDIR)/diff-highlight || \
> +		$(RM) -f $(DESTDIR)/diff-highlight
>  	$(RM) diff-highlight

  3. It's unusual for "clean" to reach outside of the build directory.
     What you're doing here is more like an "uninstall" target, but we
     don't usually provide one.

There are a few different approaches other contrib/ items take to
work like the rest of the Git:

  - in contrib/contacts, we source config.mak from the top-level, and
    then define a default $(prefix). This gives some repeated
    boilerplate, but is pretty independent from the top-level Makefile.

  - in contrib/credential/netrc, we piggy-back on the top-level
    Makefile's "install-perl-script", which knows where the user has
    asked us to install things. That might not be appropriate here,
    though, as I think it only puts things in libexec/, so
    "diff-highlight" wouldn't be generally available in the user's $PATH
    (though it would be enough to use as a pager within git).

-Peff

@gitgitgadget-git
Copy link

User Jeff King <[email protected]> has been added to the cc: list.

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ëmosol <[email protected]>
@imme-emosol
Copy link
Author

/submit

@gitgitgadget-git
Copy link

Error: git fetch https://github.com/git/git +refs/pull/938/head:refs/pull/938/head +refs/pull/938/merge:refs/pull/938/merge failed: 128,
fatal: couldn't find remote ref refs/pull/938/merge

@imme-emosol imme-emosol reopened this Oct 12, 2024
@imme-emosol
Copy link
Author

/submit

@gitgitgadget-git
Copy link

Error: git fetch https://github.com/git/git +refs/pull/938/head:refs/pull/938/head +refs/pull/938/merge:refs/pull/938/merge failed: 128,
fatal: couldn't find remote ref refs/pull/938/merge

@imme-emosol imme-emosol deleted the patch-1 branch October 12, 2024 23:00
@gitgitgadget-git
Copy link

On the Git mailing list, immeëmosol wrote (reply to this):

Resending this mail to the list 'cause mail-client added html to previous mail.

On Sat, 12 Oct 2024 at 22:55, Jeff King <[email protected]> wrote:
>
> On Sat, Oct 12, 2024 at 08:23:33PM +0000, immeëmosol via GitGitGadget wrote:
>
> > diff --git a/contrib/diff-highlight/Makefile b/contrib/diff-highlight/Makefile
> > index f2be7cc9243..a53e09e0bdd 100644
> > --- a/contrib/diff-highlight/Makefile
> > +++ b/contrib/diff-highlight/Makefile
> > @@ -10,6 +10,9 @@ diff-highlight: shebang.perl DiffHighlight.pm diff-highlight.perl
> >       chmod +x $@+
> >       mv $@+ $@
> >
> > +install: diff-highlight
> > +     test -w $(DESTDIR) && ln -s $(abspath $<) $(DESTDIR)
> > +
>
> I'm not opposed to having an install target here, like we do in the main
> Makefile and in a few other contrib directories.
>
> But in that case, I think it should behave more like those other
> targets:
>
>   1. Actually copy the program rather than making a symlink. Preferably
>      using $(INSTALL).
>
>   2. Respect $(prefix) in the usual way.
>
> And also...
>
> >  clean:
> > +     test ! -L $(DESTDIR)/diff-highlight || \
> > +             $(RM) -f $(DESTDIR)/diff-highlight
> >       $(RM) diff-highlight
>
>   3. It's unusual for "clean" to reach outside of the build directory.
>      What you're doing here is more like an "uninstall" target, but we
>      don't usually provide one.
>
> There are a few different approaches other contrib/ items take to
> work like the rest of the Git:
>
>   - in contrib/contacts, we source config.mak from the top-level, and
>     then define a default $(prefix). This gives some repeated
>     boilerplate, but is pretty independent from the top-level Makefile.
>
>   - in contrib/credential/netrc, we piggy-back on the top-level
>     Makefile's "install-perl-script", which knows where the user has
>     asked us to install things. That might not be appropriate here,
>     though, as I think it only puts things in libexec/, so
>     "diff-highlight" wouldn't be generally available in the user's $PATH
>     (though it would be enough to use as a pager within git).
>
> -Peff

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 )
```

Thanks to all of you for the introduction into how contributions to git/git
are handled.
Though it has been quite an informative introduction, and i can understand
the suggestion of making it a install-target like other contrib-parts, i am
currently not spending more time on this. Thanks again, and have a good day=
.

---
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 <[email protected]>
---
 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)
+
 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

@gitgitgadget-git
Copy link

On the Git mailing list, Đoàn Trần Công Danh wrote (reply to this):

On 2024-10-13 01:41:06+0200, immeëmosol <[email protected]> wrote:
> 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

> ---
> 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 <[email protected]>
> ---
>  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)'

> +
>  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

@gitgitgadget-git
Copy link

User Đoàn Trần Công Danh <[email protected]> has been added to the cc: list.

@gitgitgadget-git
Copy link

On the Git mailing list, Taylor Blau wrote (reply to this):

On Sun, Oct 13, 2024 at 01:41:06AM +0200, immeëmosol wrote:
> Thanks to all of you for the introduction into how contributions to
> git/git are handled.

> Though it has been quite an informative introduction, and i can
> understand the suggestion of making it a install-target like other
> contrib-parts, i am currently not spending more time on this. Thanks
> again, and have a good day=

It is a bit sad to hear that you do not have time to bring this patch
over the finish line, having received some useful pointers from others
on the list.

Any takers who might want to pick this up instead?

Thanks,
Taylor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants