Skip to content

Commit

Permalink
Prevent "not a git repository" error during initiating a repository
Browse files Browse the repository at this point in the history
Prior to the execution of any command, Elegant Git seeks the workflow
files. And in order to solve them from any position in a working tree,
it uses Git command for resolving a path to the root of the repository.
In the case, if `init-repository` or `clone-repository` is executed,
Git will raise an error: "not a git repository (or any of the parent
directories): .git." This happens as there is no `.git` directory at the
moment of the command execution.

Now, for both commands (`init-repository` and `clone-repository`), Git
command for the path evaluation won't be executed. This does not affect
the logic of the workflow execution but prevents the error.
  • Loading branch information
extsoft committed Dec 7, 2019
1 parent b619fbd commit 04ec914
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libexec/git-elegant
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ MESSAGE
--run-workflow(){
local type=${1}
local command=${2}
local prefix=$(git rev-parse --show-cdup)
if [[ ! "init-repository clone-repository" =~ ${command} ]]; then
local prefix=$(git rev-parse --show-cdup)
fi
--run-file "${prefix}.git/.workflows/${command}-${type}"
--run-file "${prefix}.workflows/${command}-${type}"
}
Expand Down

0 comments on commit 04ec914

Please sign in to comment.