我在Git中对以下文本文件dummy.txt
进行了版本化:
The quick brown fox jumps over the lazy dog.
Mary had a little lamb whose fleece was white as snow.
(no content, just a newline here at the end)
进行以下API调用时:
https://stash.domain.com:8443/rest/api/1.0/projects/some_project/dummy.txt
我收到以下内容:
{
"lines" : [
{"text":"The quick brown fox jumps over the lazy dog."},
{"text":"Mary had a little lamb whose fleece was white as snow."}
],
"start":0,
"size":2,
"isLastPage":true
}
换句话说,原始文本文件末尾的换行符已消失。我无法解释这一点。也许我的本地Git正在剥离换行符,或者Bitbucket可能已配置为执行此操作。然而,执行git fetch
并没有引入文本文件的版本,最后一行被删除。我应该注意,总是删除一个尾随换行符。例如,如果源文件末尾有5个换行符,则API将返回4。
事实证明,对于我们打算用Bitbucket做的事情,这可能不是问题,但我希望有人可以了解这里发生的事情。