diff --git a/git-am.sh b/git-am.sh index 7c0bb6084b..f50de61049 100755 --- a/git-am.sh +++ b/git-am.sh @@ -7,6 +7,7 @@ USAGE='[--signoff] [--dotest=] [--utf8] [--binary] [--3way] or, when resuming [--skip | --resolved]' . git-sh-setup set_reflog_action am +require_work_tree git var GIT_COMMITTER_IDENT >/dev/null || exit diff --git a/git-checkout.sh b/git-checkout.sh index 92ec069a3a..a5649a0504 100755 --- a/git-checkout.sh +++ b/git-checkout.sh @@ -3,6 +3,7 @@ USAGE='[-f] [-b ] [-m] [] [...]' SUBDIRECTORY_OK=Sometimes . git-sh-setup +require_work_tree old_name=HEAD old=$(git-rev-parse --verify $old_name 2>/dev/null) diff --git a/git-clean.sh b/git-clean.sh index 071b974f49..db177a7886 100755 --- a/git-clean.sh +++ b/git-clean.sh @@ -14,6 +14,7 @@ When optional ... arguments are given, the paths affected are further limited to those that match them.' SUBDIRECTORY_OK=Yes . git-sh-setup +require_work_tree ignored= ignoredonly= diff --git a/git-commit.sh b/git-commit.sh index 04aad5e5da..557b90355c 100755 --- a/git-commit.sh +++ b/git-commit.sh @@ -6,6 +6,7 @@ USAGE='[-a] [-s] [-v] [--no-verify] [-m | -F | (-C|-c) ] [-u] [--amend] [-e] [--author ] [[-i | -o] ...]' SUBDIRECTORY_OK=Yes . git-sh-setup +require_work_tree git-rev-parse --verify HEAD >/dev/null 2>&1 || initial_commit=t diff --git a/git-merge.sh b/git-merge.sh index 477002910e..3eef048efc 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -7,6 +7,7 @@ USAGE='[-n] [--no-commit] [--squash] [-s ] [-m=] option & USE_PAGER) setup_pager(); + if ((p->option & NOT_BARE) && is_bare_repository()) + die("%s cannot be used in a bare git directory", cmd); trace_argv_printf(argv, argc, "trace: built-in: git"); exit(p->fn(argc, argv, prefix));