Gerrit,

 

It looks like –no-pager is not a git option for the version I’m using under macOS but I would expect it to know it’s not in a terminal and therefore not do any paging or coloring, which appears to be the case.

 

I do have it working now, so I can keep my database in sync with a git repo fairly efficiently.

 

Cheers,

 

E.

 

_____________________________________________

Eliot Kimber

Sr Staff Content Engineer

O: 512 554 9368

M: 512 554 9368

servicenow.com

LinkedIn | Twitter | YouTube | Facebook

 

From: BaseX-Talk <basex-talk-bounces@mailman.uni-konstanz.de> on behalf of Imsieke, Gerrit, le-tex <gerrit.imsieke@le-tex.de>
Date: Saturday, January 22, 2022 at 1:36 AM
To: basex-talk@mailman.uni-konstanz.de <basex-talk@mailman.uni-konstanz.de>
Subject: Re: [basex-talk] Response from proc:execute() for git Command Not Coming Through as Expected

[External Email]


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                  -&gt; origin/master
>
> = [up to date]          dita-now                -&gt; origin/dita-now
>
> = [up to date]          rtprn                   -&gt; origin/rtprn
>
> = [up to date]          sanfransokyo            -&gt; origin/sanfransokyo
>
> = [up to date]          scodefreeze             -&gt; origin/scodefreeze
>
> = [up to date]          scratc/table_issues_fix -&gt;
> origin/scratc/table_issues_fix
>
> = [up to date]          scratch/fix_canvas_issue -&gt;
> origin/scratch/fix_canvas_issue
>
> = [up to date]          scratch/newDitavals2022 -&gt;
> origin/scratch/newDitavals2022
>
> = [up to date]          scratch/simplifyDitavals -&gt;
> origin/scratch/simplifyDitavals
>
> = [up to date]          scratch/table_name_issue -&gt;
> 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
>