GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Can't add to index twice in a row in 3.1.25 (PermissionError) · Issue #1395 · gitpython-developers/GitPython

Can't add to index twice in a row in 3.1.25 (PermissionError) #1395

New issue
Copy link
New issue
Copy link
Closed
Closed
Can't add to index twice in a row in 3.1.25 (PermissionError)#1395
Copy link
Labels
acknowledgedcritical
Milestone
v3.1.26 - Bugfixes

Description

@zhiltsov-max
zhiltsov-max
opened on Jan 10, 2022
Issue body actions

Hi, we've observed a regression in 3.1.25 (it doesn't happen in 3.1.24).

Running the following script (Python 3.8.6, Windows 10):

import git

repo = git.Repo.init('test_git')
with open('test_git/f.txt', 'w') as f:
    f.write('aa')
with open('test_git/g.txt', 'w') as f:
    f.write('bb')
repo.index.add('f.txt')
repo.index.add('g.txt') # < fails here
repo.index.commit('initial commit')
repo.close()

Produces:

(venv) PS C:\test> python .\test_git_close.py

Traceback (most recent call last):
  File ".\test_git_close.py", line 9, in <module>
    repo.index.add('g.txt')
  File "venv\lib\site-packages\git\index\base.py", line 823, in add
    self.write(ignore_extension_data=not write_extension_data)
  File "venv\lib\site-packages\git\index\base.py", line 221, in write
    lfd.commit()
  File "venv\lib\site-packages\gitdb\util.py", line 359, in commit
    self._end_writing(successful=True)
  File "venv\lib\site-packages\gitdb\util.py", line 384, in _end_writing
    remove(self._filepath)
  File "venv\lib\site-packages\gitdb\util.py", line 83, in remove
    return _retry(os.remove, *args, **kwargs)
  File "venv\lib\site-packages\gitdb\util.py", line 77, in _retry
    return func(*args, **kwargs)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'test_git\\.git\\index'

Can be related to #1333

Activity

  1. Byron
    added
    acknowledged
    critical
    on Jan 10, 2022
  2. Byron
    added a commit that references this issue on Jan 10, 2022

    Assure index file descriptor is closed after reader (#1394) (#1395)

    e16a004
  3. Byron
    added this to the v3.1.26 - Bugfixes milestone on Jan 10, 2022
  4. Byron commented on Jan 10, 2022

    @Byron
    Byron
    on Jan 10, 2022
    Member
    More actions

    Thanks for reporting, and apologies for letting that slip. e16a004 implements a fix which hopefully is the right way to do this.

    A new release was published and 3.1.26 should contain the fix.
    Please reopen the issue or create a new one if the issue isn't solved.

    Reacted by Per Tillisch
  5. Byron
    closed this as completedon Jan 10, 2022
  6. halstead
    added a commit that references this issue on Jan 17, 2022

    python3-git: upgrade 3.1.24 -> 3.1.26

    a47cef4
  7. offa
    added a commit that references this issue on Jan 17, 2022

    python3-git: upgrade 3.1.24 -> 3.1.26

    effab74
  8. halstead
    added 2 commits that reference this issue on Jan 17, 2022

    python3-git: upgrade 3.1.24 -> 3.1.26

    4bedee6

    python3-git: upgrade 3.1.24 -> 3.1.26

    d0f3d4b
  9. netbsd-srcmastr
    added a commit that references this issue on Aug 22, 2022

    py-gitpython: updated to 3.1.27

    5540e50
  10. msk
    added a commit that references this issue on May 11, 2026

    py-gitpython: updated to 3.1.27

    235936d
  11. jperkin
    added a commit that references this issue on May 14, 2026

    py-gitpython: updated to 3.1.27

    5f637a7
  12. tsutsui
    added a commit that references this issue on Oct 17, 2026

    py-gitpython: updated to 3.1.27

    e390870
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedcritical

    Type

    No type

    Projects

    No projects

      Milestone

      • v3.1.26 - Bugfixes

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.