User:Kim/Prototyping 2nd year/GitPub: Difference between revisions

From XPUB & Lens-Based wiki
Line 66: Line 66:
* expand file formats
* expand file formats
** make it terminal interactive: let user choose file formats (not only .md)
** make it terminal interactive: let user choose file formats (not only .md)
** in bash this could work to get the file contents into .md cat style.css > out.md (does it preserve formatting?)
** in bash this could work to get the file contents into <code>.md cat style.css > out.md</code> (does it preserve formatting?)
*** and the [https://stackoverflow.com/questions/11532980/reproduce-the-unix-cat-command-in-python python equivalent]
*** and the [https://stackoverflow.com/questions/11532980/reproduce-the-unix-cat-command-in-python python equivalent]
* expand styling: how do the commits interfere with/ relate to the main printed text?
* expand styling: how do the commits interfere with/ relate to the main printed text?

Revision as of 13:40, 26 October 2025

log
prototype status v2 basic .py script running
next steps sort files + add print output to .py script
pmomm #1. gitpub


v 1

utilizing the Git API.

I manged to print a proof of concept version of my personal reader repository but ran into a lot of issues:

  • API needs personal token authentication (which limits it to personal use)
  • using curl (to json) is limiting in formatting options (v1 is very 'crafty')
  • sorting the files and directories is tricky and you prob. need to do it manually by passing numbers to the titles

v 2

I dont need the Gitlab APi, since most meta info is already stored in my local repository. try python script >> better to turn into a program (pip install gitpub) using uv

find the python script here here

wip ref

where is the local information stored?

in the repository, commit messages can be found in .git/logs/refs/heads/main
they are structured like this:

0e55d65009ff9617a72b0eafc908e356a8344bb4 5567bfffaad5ab96941b2cd7ed8aa077c2df1e94 Kim Kleinert 
<mail@kimkleinert.com> 1759126065 +0200 commit: r w o t synopsis

while when typing git log the output is formatted as the following: (git log documentation)

commit 5567bfffaad5ab96941b2cd7ed8aa077c2df1e94 (HEAD -> main, origin/main)
Author: Kim Kleinert <mail@kimkleinert.com>
Date:   Mon Sep 29 08:07:45 2025 +0200
   r w o t synopsis

viewing the same commit in the gitlab interface reveals that 5567bfffaad5ab96941b2cd7ed8aa077c2df1e94 is the SHA while 0e55d65009ff9617a72b0eafc908e356a8344bb4 is indicated as the parent (which usually indicates the previous commit). that still leaves this string 1759126065 inside the git log file view unknown.


how can I get it?

>> use the git log cmd
to get log from specific file: $ git log file/path/name.md
options:

  • view diff by adding -p
  • --oneline displays only hash and message in one line
  • --pretty=format:"..." flag to have more control over formatting output git log --pretty=format:"%s" queue.md (this would only print commit message, different options and combinations possible)
  • --stat to get only the amount of changes not the full diffs


>> use python library$ pip install GitPython? this "provides a higher-level API for interacting with Git repositories" and is recommended for more complex interactions with git
or start with subprocess (more general for bash) or os >> why am i using python again?

further questions and steps

  • file sorting before or with pandoc
  • expand file formats
    • make it terminal interactive: let user choose file formats (not only .md)
    • in bash this could work to get the file contents into .md cat style.css > out.md (does it preserve formatting?)
  • expand styling: how do the commits interfere with/ relate to the main printed text?