require_work_tree broken with NONGIT_OK
Sourcing git-sh-setup: After having set NONGIT_OK, when calling the function require_work_tree while outside of a git repository shows a syntax error.
This is caused by the call to git rev-parse --is-inside-work-tree printing nothing when it is called outside of a git repository.
Quoting the call removes the syntax error and sending stderr to /dev/null removes duplicate error messages.
---
This is a fixup rollout after discussion on the patch:
- Commit message better identifies the cause of the problem
- the test was not working in v1. fixed this up
git-sh-setup.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
git-sh-setup.sh +1 -1
@@ -128,7 +128,7 @@ cd_to_toplevel () { } require_work_tree () { - test $(git rev-parse --is-inside-work-tree) = true || + test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true || die "fatal: $0 cannot be used without a working tree." } -- 1.6.6
Quoted 9 lines · Gabriel Filion
Sourcing git-sh-setup: After having set
NONGIT_OK, when calling the functionrequire_work_treewhile outside of a git repository shows a syntax error.
This is caused by the call to git rev-parse --is-inside-work-tree printing nothing when it is called outside of a git repository.Quoting the call removes the syntax error and sending stderr to
/dev/nullremoves duplicate error messages.
---
Sign-off?
Quoted 20 lines
This is a fixup rollout after discussion on the patch:
- Commit message better identifies the cause of the problem
- the test was not working in v1. fixed this upgit-sh-setup.sh | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)git-sh-setup.sh +1
-1@@ -128,7 +128,7 @@ cd_to_toplevel () { } require_work_tree () { - test $(git rev-parse --is-inside-work-tree) = true || + test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true || die "fatal: $0 cannot be used without a working tree." } -- 1.6.6