Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape Characters Required In git-windows Batch File #2

Open
NathanielJS1541 opened this issue Sep 7, 2024 · 0 comments
Open

Escape Characters Required In git-windows Batch File #2

NathanielJS1541 opened this issue Sep 7, 2024 · 0 comments

Comments

@NathanielJS1541
Copy link

NathanielJS1541 commented Sep 7, 2024

The --format argument for git log in the git-windows vc.bat file needs some extra escape characters for the % characters. As an example, the string %H%n is interpreted as the variable H followed by an n. Since the batch file does not set the variable H, %H% is replaced with nothing, leaving n.

Therefore, the following line of the batch file (before being piped to gawk)

git --no-pager log -1 HEAD --pretty=format:"Hash: %H%nAbr. Hash: %h%nParent Hashes: %P%nAbr. Parent Hashes: %p%nAuthor Name: %an%nAuthor Email: %ae%nAuthor Date: %ai%nCommitter Name: %cn%nCommitter Email: %ce%nCommitter Date: %ci%n"

outputs the following:

Hash: VariableHnAbr. Hash: VariableHnParent Hashes: nAbr. Parent Hashes: nAuthor Name: nAuthor Email: nAuthor Date: nCommitter Name: nCommitter Email: nCommitter Date: n

Escaping all of the % characters (resulting in them all being %%) will produce the following output for the line above (run on master of this repo):

Hash: 8c8e2eb5e1d924c2066a5dc3cbc31b452b40ab44
Abr. Hash: 8c8e2eb
Parent Hashes: c81b1aef231a51e761828cc4c87022b65014f3a4
Abr. Parent Hashes: c81b1ae
Author Name: Roland Hieber
Author Email: rohieb@rohieb.name
Author Date: 2020-01-23 18:21:28 +0100
Committer Name: Roland Hieber
Committer Email: rohieb@rohieb.name
Committer Date: 2020-01-23 18:21:29 +0100

There is still another issue with vc-git.awk, on Windows, but I'll address that in a separate issue (#3).

NathanielJS1541 added a commit to NathanielJS1541/ctan-support-vc that referenced this issue Sep 7, 2024
These extra escape characters are needed in the git pretty format so
they are not replaced by variables in the batch script.
NathanielJS1541 added a commit to NathanielJS1541/ctan-support-vc that referenced this issue Sep 7, 2024
These extra escape characters are needed in the git pretty format so
they are not replaced by variables in the batch script.

Signed-off-by: Nathaniel Struselis <Nathaniel.Struselis@hotmail.co.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant