Skip to content

Commit

Permalink
do not pass "git -c foo=bar" params to transport helpers
Browse files Browse the repository at this point in the history
Like $GIT_CONFIG, $GIT_CONFIG_PARAMETERS needs to be suppressed by
"git push" and its cousins when running local transport helpers to
imitate remote transport well.

Noticed-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jonathan Nieder authored and Junio C Hamano committed Aug 24, 2010
1 parent 2b64fc8 commit 655e8d9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ static inline enum object_type object_type(unsigned int mode)
* environment creation or simple walk of the list.
* The number of non-NULL entries is available as a macro.
*/
#define LOCAL_REPO_ENV_SIZE 8
#define LOCAL_REPO_ENV_SIZE 9
extern const char *const local_repo_env[LOCAL_REPO_ENV_SIZE + 1];

extern int is_bare_repository_cfg;
Expand Down
1 change: 1 addition & 0 deletions environment.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ static char *git_object_dir, *git_index_file, *git_refs_dir, *git_graft_file;
const char * const local_repo_env[LOCAL_REPO_ENV_SIZE + 1] = {
ALTERNATE_DB_ENVIRONMENT,
CONFIG_ENVIRONMENT,
CONFIG_DATA_ENVIRONMENT,
DB_ENVIRONMENT,
GIT_DIR_ENVIRONMENT,
GIT_WORK_TREE_ENVIRONMENT,
Expand Down
23 changes: 23 additions & 0 deletions t/t5400-send-pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,29 @@ test_expect_success 'refuse deleting push with denyDeletes' '
test_must_fail git send-pack ./victim :extra master
'

test_expect_success 'cannot override denyDeletes with git -c send-pack' '
(
cd victim &&
test_might_fail git branch -D extra &&
git config receive.denyDeletes true &&
git branch extra master
) &&
test_must_fail git -c receive.denyDeletes=false \
send-pack ./victim :extra master
'

test_expect_success 'override denyDeletes with git -c receive-pack' '
(
cd victim &&
test_might_fail git branch -D extra &&
git config receive.denyDeletes true &&
git branch extra master
) &&
git send-pack \
--receive-pack="git -c receive.denyDeletes=false receive-pack" \
./victim :extra master
'

test_expect_success 'denyNonFastforwards trumps --force' '
(
cd victim &&
Expand Down

0 comments on commit 655e8d9

Please sign in to comment.