Re: [PATCH] contrib/git-resurrect.sh: do not write \t for HT in sed scripts

2017-04-02 Thread Junio C Hamano
Jakub Narębski  writes:

> W dniu 01.04.2017 o 06:14, Junio C Hamano pisze:
>
>> Just like we did in 0d1d6e50 ("t/t7003: replace \t with literal tab
>> in sed expression", 2010-08-12), avoid writing "\t" for HT in sed
>> scripts, which is not portable.
>
> I guess it is not possible to use HT variable (similar to LF that we
> have in t/test-lib.sh, and which is defined by some scripts) set to
> literal tab
>
>   HT=""
>
> wouldn't work there, is it?
>
> Using this variable would make literal tab character more visible.

Patches welcome.


Re: [PATCH] contrib/git-resurrect.sh: do not write \t for HT in sed scripts

2017-04-02 Thread Jakub Narębski
W dniu 01.04.2017 o 06:14, Junio C Hamano pisze:

> Just like we did in 0d1d6e50 ("t/t7003: replace \t with literal tab
> in sed expression", 2010-08-12), avoid writing "\t" for HT in sed
> scripts, which is not portable.

I guess it is not possible to use HT variable (similar to LF that we
have in t/test-lib.sh, and which is defined by some scripts) set to
literal tab

  HT="  "

wouldn't work there, is it?

Using this variable would make literal tab character more visible.
-- 
Jakub Narębski



[PATCH] contrib/git-resurrect.sh: do not write \t for HT in sed scripts

2017-03-31 Thread Junio C Hamano
Just like we did in 0d1d6e50 ("t/t7003: replace \t with literal tab
in sed expression", 2010-08-12), avoid writing "\t" for HT in sed
scripts, which is not portable.

Signed-off-by: Junio C Hamano 
---
 * This should hopefully kill the last instances of the same issue
   to make sure people do not copy-and-paste this unportable
   construct.

 contrib/git-resurrect.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/git-resurrect.sh b/contrib/git-resurrect.sh
index c364dda696..3b78ffd079 100755
--- a/contrib/git-resurrect.sh
+++ b/contrib/git-resurrect.sh
@@ -24,13 +24,13 @@ n,dry-rundon't recreate the branch"
 . git-sh-setup
 
 search_reflog () {
-sed -ne 's~^\([^ ]*\) .*\tcheckout: moving from '"$1"' .*~\1~p' \
+   sed -ne 's~^\([^ ]*\) .*checkout: moving from '"$1"' .*~\1~p' \
 < "$GIT_DIR"/logs/HEAD
 }
 
 search_reflog_merges () {
git rev-parse $(
-   sed -ne 's~^[^ ]* \([^ ]*\) .*\tmerge '"$1"':.*~\1^2~p' \
+   sed -ne 's~^[^ ]* \([^ ]*\) .*  merge '"$1"':.*~\1^2~p' \
< "$GIT_DIR"/logs/HEAD
)
 }
-- 
2.12.2-752-g2215051a9e