%%
%% This is file `texgit.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% texgit.dtx  (with options: `package')
%% This is a generated file.
%% 
%% Copyright (C) 2023--2025 by Thomas Weise <tweise@email.hfuu.edu.cn>
%% 
%% This file may be distributed and/or modified under the conditions of the
%% The LaTeX Project Public License (LPPL) Version 1.3c  2008-05-04.
%% The license can be found at
%% https://thomasweise.github.io/texgit_tex/LICENSE.html.
%% You can obtain the latest version of this package from
%% http://thomasweise.github.io/texgit_tex or
%% http://github.com/thomasWeise/texgit_tex.
%% This work is author-maintained, i.e., it can only be maintained by
%% Thomas Weise.
\NeedsTeXFormat{LaTeX2e}[1999/12/01]%
\ProvidesPackage{texgit}[2025/06/18 0.9.4 name change to texgit]%
%%
%%
%%
%%
%%
%%
\RequirePackage{filecontents}%  Allow us to create the dummy file.
\xdef\@texgit@dummyPath{\jobname.texgit.dummy}%  the dummy file
\expandafter\begin\expandafter{filecontents*}{\@texgit@dummyPath}

\end{filecontents*}
\xdef\@texgit@dummyUrl{https://example.com}%  the dummy URL
\protected\gdef\@texgit@gitFile#1#2#3#4{}%
\protected\gdef\@texgit@process#1#2#3#4{}%
\protected\gdef\@texgit@argFile#1#2#3{}%
%%
%% Define a query to load and post-process a file from a |git| repository.
%% #1 is the request ID
%% #2 is the repository URL
%% #3 is the path to the file inside the repository
%% #4 is a command through which the file contents should be piped
%%%   (leave #4 empty to use the file as-is)
\protected\gdef\gitLoad#1#2#3#4{%
\edef\@texgit@pA{#1}%  fully expand the request ID
\edef\@texgit@pB{#2}%  fully expand the repository URL
\edef\@texgit@pC{#3}%  fully expand the path into the repository
\edef\@texgit@pD{#4}%  fully expand the (optional) shell command
\immediate\write\@mainaux{%
\noexpand\@texgit@gitFile{\@texgit@pA}{\@texgit@pB}{%
\@texgit@pC}{\@texgit@pD}}%
}%
\newcount\@texgit@counter%  The counter for the dummy arguments of \gitExec
\@texgit@counter0\relax%    We start the counter at 0.
%%
%% Define a query to execute a command, optionally in a |git| repository.
%% #1 is the request ID, leave empty if you do not want to access the output
%% #2 is the repository URL, or empty if no repository is needed
%% #3 is the path to a directory inside the repository or empty
%% #4 is a command to be executed
\protected\gdef\gitExec#1#2#3#4{%
\edef\@texgit@pA{#1}%  the request ID
\ifx\@texgit@pA\empty\relax\edef\@texgit@pA{%
@texgit@dummy@\the\@texgit@counter}%
\global\advance\@texgit@counter by 1% step the counter for the next dummy
\fi%
\edef\@texgit@pB{#2}%  fully expand the repository URL, or empty
\edef\@texgit@pC{#3}%  fully expand the path into the repository, or empty
\edef\@texgit@pD{#4}%  fully expand the (optional) shell command
\immediate\write\@mainaux{%
\noexpand\@texgit@process{\@texgit@pA}{\@texgit@pB}{%
\@texgit@pC}{\@texgit@pD}}%
}%
%%
%% Define a query to allocate a file.
%% #1 is the request ID
%% #2 is the prefix
%% #3 is the suffix
\protected\gdef\gitArg#1#2#3{%
\edef\@texgit@pA{#1}%  the request ID
\edef\@texgit@pB{#2}%  fully expand the prefix
\edef\@texgit@pC{#3}%  fully expand the suffix
\immediate\write\@mainaux{%
\noexpand\@texgit@argFile{\@texgit@pA}{\@texgit@pB}{%
\@texgit@pC}}%
}%
%%
%% Conditionally execute code depending on whether the given request was
%% already executed.
%% #1 is the request ID
%% #2 the code to execute if the request of the given ID has been executed.
%% #3 the code to execute if the request of the given ID has NOT been
%%    executed.
\gdef\gitIf#1#2#3{%
\expandafter\ifx\csname @texgit@path@#1\endcsname\relax%
\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi{#3}{#2}%
}%
%%
%% Get the file path associated with the request ID.
%% #1 is the request ID
\gdef\gitFile#1{%
\expandafter\ifx\csname @texgit@path@#1\endcsname\relax%
\@texgit@dummyPath\else\csname @texgit@path@#1\endcsname\fi%
}%
%%
%% Get the URL associated with the request ID.
%% #1 is the request ID
\gdef\gitUrl#1{%
\expandafter\ifx\csname @texgit@url@#1\endcsname\relax%
\@texgit@dummyUrl\else\csname @texgit@url@#1\endcsname\fi%
}%
\endinput
%%
%% End of file `texgit.sty'.
