mcrapet / plowshare

Command-line tool and engine for managing sharing websites
GNU General Public License v3.0
850 stars 88 forks source link

plowmod: git commands could use both explicit git-dir and work-tree #5

Closed voyageur closed 9 years ago

voyageur commented 9 years ago

As detailed in a few stack overflow questions (and other places around google), git pull and other commands do not seem to work fine in some cases with explicit git-dir:

% plowmod -i
plowmod: adding legacy (default) repository: 
https://github.com/mcrapet/plowshare-modules-legacy.git
- installing new directory: 
/home/bernard/.config/plowshare/modules.d/legacy.git
% plowmod -u
- updating directory: 
/home/bernard/.config/plowshare/modules.d/legacy.git
fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not 
set).
ERROR: directory exists but it does not appear to be a git repository, 
abort!
% git --work-tree /home/bernard/.config/plowshare/modules.d/legacy.git 
rev-parse --git-dir
fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not 
set).
% git --work-tree /home/bernard/.config/plowshare/modules.d/legacy.git 
--git-dir /home/bernard/.config/plowshare/modules.d/legacy.git/.git 
rev-parse --git-dir
/home/bernard/.config/plowshare/modules.d/legacy.git/.git
% git --version
git version 2.3.5

I am not sure what is the proper solution here, to be on the safe side, git commands could be changed with both explicit GIT_WORK_TREE=$L and GIT_DIR=$L/.git (and drop the git rev-parse commands)

mcrapet commented 9 years ago

Thanks for reporting.

$ git rev-parse --git-dir

Returned path is absolute if we are not located in topdir, relative (.git) otherwise. I'll use something else.

voyageur commented 9 years ago

Thanks, "git -C" works fine indeed here. Added the patch to Gentoo plowshare-2.1.0-r1

mcrapet commented 9 years ago

Thanks! This will be included in v2.1.1