Thus said Stephan Beal on Tue, 02 Jan 2018 04:33:56 +0100:

> That's not what i'm seeing:
> 
> [stephan@host:~]$ echo -e "1\n2\n3"
> 1
> 2
> 3
> [stephan@host:~]$ echo $(echo -e "1\n2\n3")
> 1 2 3

Hmm, that's interesting.  Have a look at this... Here's  a file that has
newlines in it,  and which I will  commit as a comment to  a ticket from
command  line arguments.  Then  I  will inspect  the  artifact that  was
generated from the ticket:

$ cat first.txt 
First from file.

With multiple lines.

$ fossil ticket add title "Test" comment "$(cat first.txt)"
ticket add succeeded for 0e9c37eab5c7123d530097be4b298ba507a443af
$ fossil artifact 07760c2485   
D 2018-01-02T05:54:32.670
J comment First\sfrom\sfile.\n\nWith\smultiple\slines.
J title Test
K 0e9c37eab5c7123d530097be4b298ba507a443af
U amb
Z 360677764c30fd6bb5049d637b0c1c28

Notice that the J-card shows all the newlines except the last two (which
were stripped I presume by the shell).

Now let's append:

$ cat second.txt 

Second from file.

With multiple lines.

$ fossil ticket change 0e9c37eab +comment "$(cat second.txt)"                  
ticket set succeeded for 0e9c37eab5c7123d530097be4b298ba507a443af
$ fossil artifact 34db266dcb0f117b
D 2018-01-02T06:03:46.839
J +comment \nSecond\sfrom\sfile.\n\nWith\smultiple\slines.
K 0e9c37eab5c7123d530097be4b298ba507a443af
U amb
Z da0a4b7d872315fd7c46c42cfa1259aa

In  this  case, the  newline  at  the beginning  of  the  file was  also
preserved in the J-card. When it gets rendered, however, there is no <p>
tag in front of the second chunk of comment (I'm not sure why). But if I
add a newline this way:

$ cat third.txt 
Third comment from file.

With multiple lines.
$ fossil ticket change 0e9c37eab +comment "                  
> $(cat third.txt)"
ticket set succeeded for 0e9c37eab5c7123d530097be4b298ba507a443af
$ fossil artifact db16ba984f4d543d
D 2018-01-02T06:07:43.120
J +comment \nThird\scomment\sfrom\sfile.\n\nWith\smultiple\slines.
K 0e9c37eab5c7123d530097be4b298ba507a443af
U amb
Z c6de4dba1e840597206da2c761f94053

But this seems to work differently, even with similar input:

$ cat fourth.txt 
Fourth from file.

With multiple lines.
$ fossil artifact 902a2ec529584f13
D 2018-01-02T06:09:02.317
J +comment \nFourth\sfrom\sfile.\n\nWith\smultiple\slines.\n
K 0e9c37eab5c7123d530097be4b298ba507a443af
U amb
Z f6470d3a73f9ee9e94020219a70c0195


The output in the UI now looks like the following:

First from file.

With multiple lines. Second from file.

With multiple lines. Third comment from file.

With multiple lines. Fourth from file.

With multiple lines. 

So, if  the shell is  stripping all the  newlines, how does  Fossil know
that there  are newlines as  evidenced by  the J-card entries  that show
multiple embedded newlines?

And even the shell seems to work as I would expect:

$ echo "$(cat first.txt)" > /tmp/output.txt
$ cat /tmp/output.txt 
First from file.

With multiple lines.

So I'm not sure why this wouldn't also work for the OP with Fossil.

Thanks,

Andy
-- 
TAI64 timestamp: 400000005a4b241f


_______________________________________________
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

Reply via email to