git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Commiting old version of file introduces other files to commit

From
RRRoger Rohrbach <roger@ecstaticsignal.com>
Date
Dec 15, 2022, 17:55 UTC
Message-ID
<2AA962BD-8AB4-4DEE-A56E-5C10DE7FDE3F@ecstaticsignal.com>
My commit changed one file, and deleted another:
 
    commit 5ad22bab408029fde463eae0354becfee702c89b
    Author: Roger Rohrbach <rrohrbach@bepress.com>
    Date:   Fri Dec 9 20:43:04 2022 -0800
 
        Automatically disallow robots for ringfenced site
 
        As a side effect of setting "Ringfence this site" to "Yes," install a
        Robots Exclusion Protocol file (overwriting any existing one) that
        disallows all robots.
 
        Also remove unused static robots.txt file with same rules, to avoid
        confusion.
 
    diff --git a/opt/bepress/share/robots.txt b/opt/bepress/share/robots.txt
    deleted file mode 100644
    index 6ffbc308f7..0000000000
    --- a/opt/bepress/share/robots.txt
    <diffs redacted>
    diff --git a/perllib/Site.pm b/perllib/Site.pm
    index b531e6dade..671d2f0a97 100644
    --- a/perllib/Site.pm
    +++ b/perllib/Site.pm
    <diffs redacted>
 
I needed to revert the change to the first file, but wished not to restore the deleted file.  So, instead of 'git revert 5ad22ba', I did this:
 
    # Check out the version of the file immediately preceding my commit:
    git checkout 68e2db7 perllib/Site.pm
    # Commit it:
    git commit -m "Back out Site.postsave installation of robots.txt"
 
Imagine my surprise when this introduced two additional files to the commit:
 
    [DCIR-188-3 1daac3bdf0] Back out Site.postsave installation of robots.txt
    3 files changed, 3 insertions(+), 20 deletions(-)
    create mode 100644 opt/bepress/share/robots.txt
    delete mode 100644 perllib/.htaccess
 
Not only did this restore the file I was taking pains not to restore; it arbitrarily deleted another file I'd never touched.
 
Is this some weird hash collision problem?
Message 1 of 1 in “Commiting old version of file introduces other files to commit”
  1. Roger RohrbachDec 15, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.