[PATCH 09/10] mceliece6688128f: update generation script to apply changes as patch set

Jussi Kivilinna jussi.kivilinna at iki.fi
Sun Oct 5 11:57:12 CEST 2025


Hello,

On 02/10/2025 02:31, Jacob Bachmeyer via Gcrypt-devel wrote:
> 
> Now I see what is happening:  the commit itself contains a diff, and I misread it embedded in `git diff`.
> 
>> Either hook would need to be changed to support patch/diff files or diff files be hidden somehow from hook (for example in gz). Latter seems worst of these as that hides changes from trivial git code review.
> 
> Would it be feasible to carry the mceliece code on a tracking branch in the repository, rebase the patchset when pulling updates to an intermediate branch, and merge from that intermediate branch instead of carrying the code directly?
> 
> You would have one branch carrying only pristine upstream sources (perhaps itself pulled using Git if the code is managed in Git upstream), one branch carrying patched sources that is rebased as upstream updates are imported and merged to the mainline branch. Then you would manage the changes in Git instead of using a script to apply them.
> 

That seems a bit more complicated than this in my opinion should be. We already have changes in git history and duplicating that history in shadow branch seems extra work. How about if generator script extracts changes to 'mceliece6688128f.c' from active branch and then apply those patches. So we'd have something like this:

   # First commit with "cipher/mceliece6688128f.c" generated using script:
   START_COMMIT="47ed744465ae7461771a3ca08799264a3d32a7fd"

   GIT_BASE_DIR="$1/.."
   GIT_TARGET_FILE="cipher/mceliece6688128f.c"

   ###
  
   set -e

   ( cd "$1"; mkdir -p "mceliece6688128f-tmp" )

   # Generate patches from git commit history of target file
   COMMIT_LIST=$( \
     cd "$GIT_BASE_DIR"; \
     git log --reverse --pretty=format:%H ${START_COMMIT}..HEAD -- \
       "${GIT_TARGET_FILE}" )
   i=0
   PATCHES=""
   for commit in $COMMIT_LIST
   do
     i=$(expr $i + 1)
     (
       cd "$GIT_BASE_DIR"
       git format-patch -1 "${commit}" --stdout -- "${GIT_TARGET_FILE}"
     ) > "$1/mceliece6688128f-tmp/${i}.patch"
     PATCHES="$PATCHES mceliece6688128f-tmp/${i}.patch"
   done

   cd "$1"

   # ...
   # generate initial mcelice6688128f.c as in $START_COMMIT to "$1/mceliece6688128f-tmp/mceliece6688128f.c"
   # ...
   # apply $PATCHES to "$1/mceliece6688128f-tmp/mceliece6688128f.c"
   # ...
   # print "$1/mceliece6688128f-tmp/mceliece6688128f.c"
   # ...
   # clean-up of "$1/mceliece6688128f-tmp"

-Jussi



More information about the Gcrypt-devel mailing list