Re: [COGITO PATCH] Fix cg-log and cg-status for non-GNU sed/sort
From: Mark Allen <hidden>
Date: 2016-06-15 22:41:58
--- Petr Baudis <pasky@ucw.cz> wrote:Dear diary, on Mon, May 30, 2005 at 01:00:10AM CEST, I got a letter where Mark Allen [off-list ref] told me that...quoted
- pdate="$(showdate $date)" + pdate="$(date -u -r $date)"Hmm, coudlnt' showdate be fixed instead then? And $date is not a file so -r $date makes no sense to me - what am I missing?
There is no showdate(1) command on Darwin. On Darwin, the date(1) command flags are -u (show UTC) -r seconds So `date -u -r $date` gives output like "Sun May 29 12:07:55 GMT 2005" instead of 1117336545
I'm lost on this one too. Why do you introduce the -n?
Since I used date(1) above, I get an extra newline now when the date string is printed out. Using echo -n on the second echo stops that behavior. (This is perhaps a matter of taste; some people like lots of whitespace in headers, and some don't.)
quoted
- echo; sed -re ' - /*Signed-off-by:.*/Is//'$colsignoff'&'$coldefault'/quoted
- /*Acked-by:.*/Is//'$colsignoff'&'$coldefault'/quoted
- s/./ &/ - ' + echo; sed -e "/ *Signed-off-by:.*/s/*Signed-off-by:.*/$colsignoff&$coldefault/" -e"/quoted
+*Acked-by:.*/s/ *Acked-by:.*/$colsignoff&$coldefault/" -e "s/./ &/" +Is it necessary to take away the newlines? What is the real problem, actually? Just the I flag?
Is it strictly necessary to take away the newlines? I don't know. To be honest, I didn't experiment too much with alternate implementations. But the I flag in the sed script, yes that is not understood by non-GNU sed. And the "-r" to sed itself is also problematic.
Could you please sign the patch off, and send it as text/plain or inline the message body?
Modify cg-log and cg-status to work with non-GNU sed, sort and date Signed-off-by: Mark Allen <redacted> --- commit 7e8fbf87acead0ee83afc4647228efdad0bbae2e tree 50acf8ce23fee4ca6c9493b5f5959093e7579c74 parent d36ed1fd011d349ea2adc00456750b5b3da3a9cd author Mark Allen [off-list ref] 1117409841 -0500 committer Mark Allen [off-list ref] 1117409841 -0500 cg-log | 15 +++++++-------- cg-status | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) Index: cg-log ===================================================================
--- 3a65f5fb53367c75f4f76aebed27a83d8679f068/cg-log (mode:100755)
+++ 50acf8ce23fee4ca6c9493b5f5959093e7579c74/cg-log (mode:100755)@@ -148,10 +148,10 @@ fi date=(${rest#*> }) - pdate="$(showdate $date)" + pdate="$(date -u -r $date)" if [ "$pdate" ]; then - echo -n $color$key $rest | sed "s/>.*/> $pdate/" - echo $coldefault + echo -n $color$key $rest | sed "s/>.*/> $pdate/" + echo -n $coldefault else echo $color$key $rest $coldefault fi
@@ -168,11 +168,10 @@ if [ -n "$list_files" ]; then list_commit_files "$tree1" "$tree2" fi - echo; sed -re ' - /
*Signed-off-by:.*/Is//'$colsignoff'&'$coldefault'/
- / *Acked-by:.*/Is//'$colsignoff'&'$coldefault'/
- s/./ &/
- '
+ echo; sed -e "/ *Signed-off-by:.*/s/
*Signed-off-by:.*/$colsignoff&$coldefault/"
+ -e"/ *Acked-by:.*/s/
*Acked-by:.*/$colsignoff&$coldefault/"
+ -e "s/./ &/"
+
;;
*)
echo $colheader$key $rest $coldefault
Index: cg-status
===================================================================--- 3a65f5fb53367c75f4f76aebed27a83d8679f068/cg-status (mode:100755)
+++ 50acf8ce23fee4ca6c9493b5f5959093e7579c74/cg-status (mode:100755)@@ -15,7 +15,7 @@ { git-ls-files -z -t --others --deleted --unmerged $EXCLUDE -} | sort -z -k 2 | xargs -0 sh -c ' +} | sort -t '\0' -k 2 | xargs -0 sh -c ' while [ "$1" ]; do tag=${1% *}; filename=${1#* };