Re: 'git commit .' in a subdirectory also commits staged files in other subdirectories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/21/22 14:48, Taylor Blau wrote:
That isn't right, though I can't reproduce what you describe from your
report. Try this script out:


I don't know how to reproduce this on purpose. But I just got another instance of the problem.

I am in the FreeBSD ports Git repository, in the math/cimod subfolder. Another subfolder, audio/sonic-visualiser, also has changes.

Here is the command:

[yuri@yv /disk-samsung/freebsd-ports/math/cimod]$ git commit .
hint: Waiting for your editor to close the file...
# Uncomment and add a short description of why things changed.
math/cimod: Update 1.4.43 -> 1.4.45

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# category/port: Subject goes here, max 50 cols -|
# <then a blank line>
#                                                         72 columns --|
#
# Do not add a Submitted by line.  If someone besides the committer sent in the
# change, the commit author should be set using `git commit --author`.
#
# Uncomment and complete these metadata fields, as appropriate:
#
# PR:           <If and which Problem Report is related.>
Reported by:    portscout
# Reviewed by:  <If someone else reviewed your modification.>
# Tested by:    <If someone else tested the change.>
# Approved by:  <If you needed approval for this commit.>
# Obtained from:        <If the change is from a third party.>
# Fixes:        <Short hash and title line of commit fixed by this change>
# MFH:          <Ports tree branch name you plan to merge to.>
# Relnotes:     <Set to 'yes' for mention in release notes.>
# Security:     <Vulnerability reference (one per line) or description.>
# Sponsored by: <If the change was sponsored by an organization.>
# Pull Request: <https://github.com/freebsd/freebsd-ports/pull/###>
# Differential Revision: <https://reviews.freebsd.org/D###>
#
# "Pull Request" and "Differential Revision" require the *full* GitHub or
# Phabricator URL.
#
# On branch main
# Your branch is up to date with 'origin/main'.
#
# Changes to be committed:
#       modified:   Makefile
#       modified:   distinfo
#
# Changes not staged for commit:
#       modified:   ../../audio/sonic-visualiser/Makefile
#       modified:   ../../audio/sonic-visualiser/distinfo
#       deleted: ../../audio/sonic-visualiser/files/patch-acinclude.m4
#       deleted: ../../audio/sonic-visualiser/files/patch-base.pro
#       deleted: ../../audio/sonic-visualiser/files/patch-config.pri.in
#       deleted: ../../audio/sonic-visualiser/files/patch-configure.ac
#       deleted: ../../audio/sonic-visualiser/files/patch-convert.pro
#       deleted: ../../audio/sonic-visualiser/files/patch-server.pro
#       deleted: ../../audio/sonic-visualiser/files/patch-sonic-visualiser.pro


Git said that 2 files are to be committed, Makefile and distnfo. This is correct.


However, the resulting commit also has audio/sonic-visualiser:

 git diff 99f39b9798ff81b8fb529bea7c16d96e27aecfca~1 99f39b9798ff81b8fb529bea7c16d96e27aecfca | grep diff diff --git a/audio/sonic-visualiser/files/patch-acinclude.m4 b/audio/sonic-visualiser/files/patch-acinclude.m4 diff --git a/audio/sonic-visualiser/files/patch-base.pro b/audio/sonic-visualiser/files/patch-base.pro diff --git a/audio/sonic-visualiser/files/patch-config.pri.in b/audio/sonic-visualiser/files/patch-config.pri.in diff --git a/audio/sonic-visualiser/files/patch-configure.ac b/audio/sonic-visualiser/files/patch-configure.ac diff --git a/audio/sonic-visualiser/files/patch-convert.pro b/audio/sonic-visualiser/files/patch-convert.pro diff --git a/audio/sonic-visualiser/files/patch-server.pro b/audio/sonic-visualiser/files/patch-server.pro diff --git a/audio/sonic-visualiser/files/patch-sonic-visualiser.pro b/audio/sonic-visualiser/files/patch-sonic-visualiser.pro
- # (because of the difficulty of getting them running nicely in the
diff --git a/audio/sonic-visualiser/files/patch-sv.pro b/audio/sonic-visualiser/files/patch-sv.pro diff --git a/audio/sonic-visualiser/files/patch-svapp_acinclude.m4 b/audio/sonic-visualiser/files/patch-svapp_acinclude.m4 diff --git a/audio/sonic-visualiser/files/patch-svcore_acinclude.m4 b/audio/sonic-visualiser/files/patch-svcore_acinclude.m4 diff --git a/audio/sonic-visualiser/files/patch-svcore_config.pri.in b/audio/sonic-visualiser/files/patch-svcore_config.pri.in diff --git a/audio/sonic-visualiser/files/patch-svgui_acinclude.m4 b/audio/sonic-visualiser/files/patch-svgui_acinclude.m4 diff --git a/audio/sonic-visualiser/files/patch-svgui_layer_WaveformLayer.cpp b/audio/sonic-visualiser/files/patch-svgui_layer_WaveformLayer.cpp diff --git a/audio/sonic-visualiser/files/patch-svgui_view_Overview.cpp b/audio/sonic-visualiser/files/patch-svgui_view_Overview.cpp
diff --git a/math/cimod/Makefile b/math/cimod/Makefile
diff --git a/math/cimod/distinfo b/math/cimod/distinfo


This is WRONG!


There *is* a bug in Git.


Each commit needs to be individually checked to see if the right files were committed. The Git's commit description can't be trusted.

When it says "Changes not staged for commit" - these files should *not* be committed,

This has already hurt me several times.


This should be the highest priority bug.


Yuri





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux