redhataccess / pantheon-cmd

Pantheon CMD is an open source and freely distributed program for validating and building local previews of modular documentation.
GNU General Public License v3.0
2 stars 5 forks source link

error handling for pr validator #39

Closed Levi-Leah closed 3 years ago

Levi-Leah commented 3 years ago

should resolve https://github.com/redhataccess/pantheon-cmd/issues/38

Levi-Leah commented 3 years ago

@adahms this should resolve the issue but it's a pretty ugly solution. if you got a better idea please let me know

Levi-Leah commented 3 years ago

@adahms I redid the logic behind what's classified as a git repo (compared to last commit) and also updated the git diff command to supply relative paths; this enables the user to run PR validation from any directory within the git repo (unlike pv2.yml validation that requires the user to be at the root of the repo).

If you can test it outside of git repos that'll be great. Because I still get weird errors inside my personal home dir, but not within home dirs of newly created users. There's a good chance my home dir is just weird though, as I've initiated git there a few times by mistake which leads to me having a .git dir but with empty .git/refs/heads/ subdir that's getting checked by pygit2. Shouldn't be an issue for other users but want to be on the safe side.

adahms commented 3 years ago

Merging.

adahms commented 3 years ago

@Levi-Leah - in terms of a longer-term improvement, my feeling is that on runtime, PCMD should be able to tell upfront if it's being run from a Git repository, and from a PV2-compliant Git repository. Today, we do that by running through the parts of the PWD to see if there's a pantheon2.yml file - can we do something similar for a '.git' directory? This way, we can understand these details upfront and pass them along to other functions as needed.