dejan2609 commented on PR #23905:
URL: https://github.com/apache/kafka/pull/23905#issuecomment-7201738136

   ### Update: the solution is narrowed down
   
   The PR now only replaces JGit with the git CLI, without extra behaviour: a 
new commit "_**(note: solution is simplified) …**_" removes two things:
   - **The fallback when git cannot read `HEAD`** (for example when git is not 
installed). A git checkout now simply requires the `git` command; if it is 
missing, the build fails with `A problem occurred starting process 'command 
'git''`.
   - **The git worktree change** (`exists()` instead of `isDirectory()` for 
`.git`). Worktrees keep using commit id `unknown` and skip RAT, as on trunk. 
This is unrelated to replacing JGit and can be a separate change if needed.
   
   Why the fallback is not needed:
   - Git is only used by `build.gradle` at build time, for the commit id and 
the RAT excludes. Running Kafka does not need it: the commit id is read from 
`kafka-version.properties` inside the jars.
   - Source tarballs have no `.git`, so git is never called. Kafka's Docker 
images are built from binary tarballs, without Gradle.
   - So the only affected case is building a git checkout on a machine without 
git, which is unusual and easy to fix.
   
   A side benefit: with `-PcommitId` (as used by CI), `git rev-parse HEAD` is 
no longer run, so with the configuration cache, a new commit no longer 
invalidates the cache entry.
   
   #### Testing
   The checks from the comments above were rerun with this `build.gradle`, 
compared with trunk (JGit):
   - **RAT:** same reports and excludes as with JGit (7,616 files); an 
untracked nested git repository is still excluded.
   - **Commit id and RAT in different `.git` setups:** same as trunk in every 
case, except git not installed, which now fails the build (also with 
`-PcommitId`). An empty `.git` directory or a repository without commits fails 
the build, as it does with JGit.
   - **Configuration cache:** same result as before, 18 problems on trunk and 
16 with this PR (the two JGit `git` processes are gone). With `-PcommitId`, a 
new commit now reuses the cache entry.
   
   The rows of the earlier testing comments that describe the fallback 
(`unknown` with a warning) and git worktrees no longer apply.
   
   ___
   
   _**Drafted in a Claude session (then reviewed and edited).**_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to