git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Feature Proposal: Adding Command for Configuration Diff Between Commits
@ 2024-10-15 10:59 Prince Roshan
  2024-10-15 16:25 ` Taylor Blau
  0 siblings, 1 reply; 3+ messages in thread
From: Prince Roshan @ 2024-10-15 10:59 UTC (permalink / raw)
  To: git

Hi Git Community,

I wanted to propose a new feature for Git that I believe would be
beneficial for repository maintainers and developers alike. What do
you think of adding a command like git config diff commit1 commit2 to
show the configuration differences between two commits?

This command could display differences in repository configurations
(such as .git/config or submodule configuration) across two specific
commits. I see this being particularly useful in scenarios like:

When a submodule is added or updated between two commits, helping to
easily track and compare the submodule's configuration changes.
Identifying configuration changes (e.g., repository settings) made
between different commits without having to manually examine each
commit’s changes.
Comparing various configuration-related changes in large repositories.

For example, when managing repositories with submodules, this feature
could quickly highlight differences in submodule references, paths, or
URLs, saving time and providing better traceability.

I believe adding such functionality would enhance Git's usability in
managing complex repository structures and configurations.

Looking forward to hearing your feedback and thoughts on this proposal.

Best regards,
Prince Roshan
princekrroshan01@gmail.com

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

* Re: Feature Proposal: Adding Command for Configuration Diff Between Commits
       [not found] <B3A4B5B2-0EDC-4D1A-BC91-0ABFCD1DFE2B@gmail.com>
@ 2024-10-15 12:45 ` Prince Roshan
  0 siblings, 0 replies; 3+ messages in thread
From: Prince Roshan @ 2024-10-15 12:45 UTC (permalink / raw)
  To: Philippe Blain; +Cc: git

Thanks for the suggestion, but I realized I gave the wrong example.
The issue I was referring to is something that's part of .git/config,
not .gitmodules, and it can’t be tracked using git diff
commit1:.gitmodules commit2:.gitmodules. Apologies for the confusion!
I’ll reply to this thread again once I remember the specific problem.

Thanks,
Prince Roshan

On Tue, 15 Oct 2024 at 17:02, Philippe Blain
<levraiphilippeblain@gmail.com> wrote:
>
> Hi Git Community,
>
> Hi !
>
>
>
> I wanted to propose a new feature for Git that I believe would be
> beneficial for repository maintainers and developers alike. What do
> you think of adding a command like git config diff commit1 commit2 to
> show the configuration differences between two commits?
>
> Git configuration is not tracked in general, so it is not clear what this command would do.
>
>
> This command could display differences in repository configurations
> (such as .git/config or submodule configuration) across two specific
> commits. I see this being particularly useful in scenarios like:
>
> When a submodule is added or updated between two commits, helping to
> easily track and compare the submodule's configuration changes.
> Identifying configuration changes (e.g., repository settings) made
> between different commits without having to manually examine each
> commit’s changes.
> Comparing various configuration-related changes in large repositories.
>
> For example, when managing repositories with submodules, this feature
> could quickly highlight differences in submodule references, paths, or
> URLs, saving time and providing better traceability.
>
> The .gitmodules file is tracked though, so you can simply diff two versions of it (technically, you are diffing two blobs):
>
> git diff commit1:.gitmodules commit2:.gitmodules
>
> Hope this helps,
>
> Philippe.

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

* Re: Feature Proposal: Adding Command for Configuration Diff Between Commits
  2024-10-15 10:59 Feature Proposal: Adding Command for Configuration Diff Between Commits Prince Roshan
@ 2024-10-15 16:25 ` Taylor Blau
  0 siblings, 0 replies; 3+ messages in thread
From: Taylor Blau @ 2024-10-15 16:25 UTC (permalink / raw)
  To: Prince Roshan; +Cc: git

On Tue, Oct 15, 2024 at 04:29:44PM +0530, Prince Roshan wrote:
> Hi Git Community,
>
> I wanted to propose a new feature for Git that I believe would be
> beneficial for repository maintainers and developers alike. What do
> you think of adding a command like git config diff commit1 commit2 to
> show the configuration differences between two commits?
>
> This command could display differences in repository configurations
> (such as .git/config or submodule configuration) across two specific
> commits. I see this being particularly useful in scenarios like:

Submodule configuration is already diff-able since the state of
submodules is stored in .gitmodules (as you note in your reply to this
email further down in this thread).

But just computing the diff between two commits and focusing on the
.gitmodules file alone doesn't necessarily have all of the information
you're looking for, either. For example, Git's own .gitmodules file has
the following contents:

    $ cat .gitmodules
    [submodule "sha1collisiondetection"]
      path = sha1collisiondetection
      url = https://github.com/cr-marcstevens/sha1collisiondetection.git
      branch = master

Here we're using submodule.<url>.branch to specify the branch that we
want to check out. So it's impossible to reconstruct the exact SHA-1 we
checked out, since it depends on the state of the remote repository as
well as our own .gitmodules file.

On the configuration front, there isn't really a perfect answer either,
because Git configuration is not tracked within the repository. You
could consider a workflow where you store the configuration within the
repository and then automatically "install" that configuration when
updating the working copy.

But that is not without risk, since Git executes arbitrary code based on
certain configuration options (e.g., more esoteric options like
core.sshCommand and core.alternateRefsCommand, as well as more common
ones like core.editor). So you would have to be careful about when you
install arbitrary configuration, who it is coming from, whether you
trust that person, etc.

Thanks,
Taylor

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

end of thread, other threads:[~2024-10-15 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-15 10:59 Feature Proposal: Adding Command for Configuration Diff Between Commits Prince Roshan
2024-10-15 16:25 ` Taylor Blau
     [not found] <B3A4B5B2-0EDC-4D1A-BC91-0ABFCD1DFE2B@gmail.com>
2024-10-15 12:45 ` Prince Roshan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).