Hi Eliot,
Maybe the pager is getting in your way? Try the global git option
--no-pager.
Gerrit
On 21.01.2022 20:27, Eliot Kimber wrote:
[BaseX 9.6.4 on Mac through BaseX GUI]
I’m trying to automate syncing a database with content from a git repo
that is locally cloned.
My approach is to use proc:exec() to pull the repo and then use git
diff-tree to see what files changed:
let $pullResult := proc:execute($gitCmd,('pull', '-v'), map{'dir' :
$repoPath})
let $changeList := proc:execute($gitCmd, ('diff-tree', '--no-commit-id',
'--name-status', 'HEAD'), map{'dir' : $repoPath})
However, the result returned for “diff-tree” appears to get truncated.
Here’s a typical result, where I’m echoing out the $pullResult and
$changeList values created above:
Pull result:
<result>
<output>Already up to date.
</output>
<error>From code.devsnc.com:doc/dita-now
= [up to date] master -> origin/master
= [up to date] dita-now -> origin/dita-now
= [up to date] rtprn -> origin/rtprn
= [up to date] sanfransokyo -> origin/sanfransokyo
= [up to date] scodefreeze -> origin/scodefreeze
= [up to date] scratc/table_issues_fix ->
origin/scratc/table_issues_fix
= [up to date] scratch/fix_canvas_issue ->
origin/scratch/fix_canvas_issue
= [up to date] scratch/newDitavals2022 ->
origin/scratch/newDitavals2022
= [up to date] scratch/simplifyDitavals ->
origin/scratch/simplifyDitavals
= [up to date] scratch/table_name_issue ->
origin/scratch/table_name_issue
</error>
<code>0</code>
</result>
Change list:
<result>
<output>M doc
</output>
<code>0</code>
</result>
Note that the pull response looks as expected but the change list
response is just “M\tdoc” where “doc” is the first directory in what
should be a path to a file.
Here’s the same result from the command line:
dita-now % git diff-tree --no-commit-id --name-status -r HEAD
Mdoc/source/product/rpa-studio/task/use-datareader-queryexcel.dita
Mdoc/source/product/rpa-studio/task/use-datetime-add.dita
Mdoc/source/product/rpa-studio/task/use-datetime-compare.dita
…
I can’t see anything I’m doing wrong or options to the execute() or
system() functions that would affect the result.
Any idea what might be causing this or how I could work around it?
Thanks,
Eliot