threads / discuss / 58959

Commiting old version of file introduces other files to commit

Subject: Commiting old version of file introduces other files to commit

## tl;dr

One message between Dec 15, 2022 and Dec 15, 2022.

replies: 0people: 1as markdown or json

Roger Rohrbach· Dec 15, 2022, 17:55 UTC · lore
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?

← back to recent threads