All of lore.kernel.org
 help / color / mirror / Atom feed
* Programmatic patches (transform commits)
@ 2022-08-18 15:21 Mark Fulton
  2022-08-18 15:48 ` Ævar Arnfjörð Bjarmason
  2022-08-19 10:15 ` Johannes Schindelin
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Fulton @ 2022-08-18 15:21 UTC (permalink / raw)
  To: git

Is there a way to commit a transform script that programmatically
applies file changes rather than committing the file changes directly?

e.g. Imagine in a large repository that a contributor wants to replace
certain instances of "abc" with "xyz". A transform script might be
like the following:

```sh
#!/bin/sh

sed -i 's/abc/xyz/g' $(find .)
```

Applying such a "programmatic patch" will potentially edit many files.
Doing a code review on such a change is error prone due to authors
resolving merge conflicts manually, etc. while reviewing the patch in
some circumstances is much easier (especially tools for specifically
this type of file transformations are used to make it easy to parse
code, traverse abstract syntax trees, make edits, etc.).

Does anything like this exist today? Depending on the implementation I
could see there being cross-platform support challenges but maybe
there is something that already exists to assist with this which I can
learn about.

As an alternative to making this part of Git I can see tools like
GitHub Actions being used to look for commits of "programmatic patch"
files, pick those up, run them, and commit and push the change but
having a solution for this as part of Git itself would make it
independent of GitHub and more reusable, etc.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-19 10:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-18 15:21 Programmatic patches (transform commits) Mark Fulton
2022-08-18 15:48 ` Ævar Arnfjörð Bjarmason
2022-08-19 10:15 ` Johannes Schindelin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.