You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
so if previously something was running porcelain.add(repo=somerepo, paths=["somepath"]) (and since repo.paths are absolute), the file is now ignored incorrectly if cwd happens to be a directory ignored by gitignore.
The text was updated successfully, but these errors were encountered:
The new behaviour is intentional, since it matches the behaviour of the git command line tool. Relative paths are interpreted relative to PWD,but need to be relative to the root of the repository when passed into other Dulwich functions.
However, paths outside of the repository are currently silently ignored, but should probably trigger an exception.
Still have to play around here, but it seems a bit odd to me to be worrying about PWD -- that makes sense for a CLI, but for a library it's unnecessary global state to deal with.
Some other things besides add are giving us trouble in our unit tests now, so some other behavior seems to have changed as well (particularly in porcelain.status as well, where lots of things are being marked as "untracked" now even though they're tracked, so something's getting confused about a relative path).
Realize that's not enough to go on, will have to dig in further to decypher whether it's our fault or not here.
@jelmer - I think I may be hitting this as well, and porcelain is not acting like the git CLI.
I have a global ~/.gitignore file, with the following line:
tmp/
Now, if I run this python code:
# Initialize a git repo in /tmp dirrepo=porcelain.init("/tmp/my-repo")
# Add a file to the repof=open('/tmp/my-repo/file.txt', 'w')
f.write('some content')
f.close()
# get the repo statusstatus=porcelain.status(repo)
assertstatus.untracked== [] # true
So porcelain does not detect any files within my repo.
However, if I run a git status from repo, the untracked file does show up:
$ cd /tmp/my-repo
$ git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
file.txt
If I empty my .gitignore, porcelain works as expected.
porcelain.add appears to use
os.path.relpath
to try to calculate relative paths relative to a repo root, but that's not what os.path.relpath does. E.g.:so if previously something was running
porcelain.add(repo=somerepo, paths=["somepath"])
(and since repo.paths are absolute), the file is now ignored incorrectly if cwd happens to be a directory ignored by gitignore.The text was updated successfully, but these errors were encountered: