git-cmake-format icon indicating copy to clipboard operation
git-cmake-format copied to clipboard

git commit --amend fails

Open gegles opened this issue 7 years ago • 1 comments

When trying to amend a commit, I see the following error:

Traceback (most recent call last):
  File "/Users/gegles/Workspaces/fasp.io/cmake/git-cmake-format/git-cmake-format.py", line 114, in <module>
    if not isFormattable(FileName):
  File "/Users/gegles/Workspaces/fasp.io/cmake/git-cmake-format/git-cmake-format.py", line 43, in isFormattable
    if '' != Dir and '' != os.path.commonprefix([os.path.relpath(File), os.path.relpath(Dir)]):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 428, in relpath
    raise ValueError("no path specified")
ValueError: no path specified

Probably need to support the script running with no actual files changed..

gegles avatar Jan 24 '18 19:01 gegles

I tried reproducing this in a simple test repo with the following steps on macOS but was unsuccessful:

  • git init
  • Create CMakeLists.txt
    cmake_minimum_required(VERSION 3.4.3 FATAL_ERROR)
    project(check)
    add_subdirectory(git-cmake-format)
    add_executable(check check.cpp)
    
  • Create check.cpp
    int main() { return 0; }
    
  • git commit -m 'Add check executable'
  • git commit --amend <- worked as expected

Since this does not reproduce the circumstances which caused your error, is there anything you can see which I have missed in order to be able to reproduce your failure?

kbenzie avatar Jan 27 '18 16:01 kbenzie