dlespiau / patchwork

The freedesktop.org edition of patchwork. Patchwork is a web patch tracking system for projects using a mailing list for contributions and reviews.
http://patchwork-freedesktop.readthedocs.org/en/latest/
GNU General Public License v2.0
22 stars 13 forks source link

git-pw: Search for git repo in parent directories during setup #179

Closed anderco closed 8 years ago

anderco commented 8 years ago

Running git-pw from a subdirectory of a repo would fail with

fatal: Not a git repository.

This is inconsistent with most git tools, so fix this by passing search_parent_directories=True to git.Repo().

Signed-off-by: Ander Conselvan de Oliveira ander.conselvan.de.oliveira@intel.com


I'm not sure this is worth the extra dependency though. I couldn't find any way to query GitPython's version and only set the parameter if the version is at least 0.3.5.

dlespiau commented 8 years ago

Hum, I have removed that parameter before (to work by with the versions of the packages in Ubuntu 14.04 LTS). I guess the justification invoked isn't actually true!

commit 74039877a755711bea370e200984acbb2334b07c Author: Damien Lespiau damien.lespiau@intel.com Date: Wed Nov 11 12:42:05 2015 +0000

git-pw: Make git-pw work with older versions of GitPython

The search_parent_directories parameter is relatively new and older
versions of GitPython don't have it. The default was, and still is, to
recurse in parent directories so we don't actually need to specify it at
all.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
dlespiau commented 8 years ago

So https://github.com/dlespiau/patchwork/commit/a6423f354d5d7a9eae28b4ed03cef43a262cc125 seems to work here and supports older versions of GitPython, would you mind me committing that version instead of yours?

dlespiau commented 8 years ago

Hum no, still does work for older versions of GitPython when calling git-pw from the directory (nor any of its parent) that isn't a git repo. Back to square one :)

dlespiau commented 8 years ago

Alright, another try checking git.__version__ to decide what to do:

https://github.com/dlespiau/patchwork/commit/e6224528fc48e5b44b41a298207b1456944067c7

dlespiau commented 8 years ago

Ok pushed the last attempt, seems to work. Do shout if I got something wrong and sorry to not have taken your patch, but I need git-pw to run on the previous Ubuntu LTS release for projects using that as base OS for their CI systems/wms/containers.

anderco commented 8 years ago

Thanks for fixing, the new solution works as expected here. I didn't know about __version__, and it doesn't show up in GitPython's API docs. I guess I should have googled harder.