Bug 558629 - EGIT 5.6.1 Hook validation message is empty during EGIT pop-up warning
Summary: EGIT 5.6.1 Hook validation message is empty during EGIT pop-up warning
Status: NEW
Alias: None
Product: EGit
Classification: Technology
Component: Core (show other bugs)
Version: 5.6   Edit
Hardware: PC Windows All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-26 04:44 EST by lea ilagan CLA
Modified: 2019-12-26 09:23 EST (History)
1 user (show)

See Also:


Attachments
Pop-up warning message is empty(blank) (16.61 KB, image/png)
2019-12-26 04:44 EST, lea ilagan CLA
no flags Details
fixed - output message to stderr (11.81 KB, image/png)
2019-12-26 09:23 EST, lea ilagan CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description lea ilagan CLA 2019-12-26 04:44:16 EST
Created attachment 281336 [details]
Pop-up warning message is empty(blank)

We used "commit-msg" hook and placed in inside <path2repo>\.git\hooks.
During commit of invalid pattern of comment, EGit able to show pop-up window that the commit was rejected by 'commit-msg" hook. However, the warning displays an empty(blank) message.

Sample commit-msg script:
#!/bin/sh
# GIT Hook to test that the user entered a valid comment:
# TKT<#>:<TASK#> - Comment
# The file name must be "commit-msg" in order for GIT to use it
# Extract the part of the comment that includes the TKT# and Task ID

RESULT=`grep -r -o "^TKT[0-9]\+:[0-9]\+\s" $1`

if [ "$RESULT" = "" ]
then
	RESULT=`grep -r -o "^BUILDER\s" $1`
	if [ "$RESULT" = "" ]
	then
		echo "The comment is missing the prefix of 'TKT<#>:<TASK#>'"
		exit 1
	fi
fi

exit 0  # Success
Comment 1 Thomas Wolf CLA 2019-12-26 05:18:01 EST
Try writing the message to stderr. I think we do have existing bugs about stdout not being shown.[1]

[1] https://bugs.eclipse.org/bugs/buglist.cgi?list_id=19125682&longdesc=hook%20stdout&longdesc_type=allwordssubstr&product=EGit&product=JGit&query_format=advanced
Comment 2 lea ilagan CLA 2019-12-26 09:23:09 EST
Created attachment 281338 [details]
fixed - output message to stderr


Using stderr (>&2) fixed the empty message.

Thank you so much.

Script:

echo 'The comment is missing the prefix of TKT<PR#>:<TASK#>' >&2