summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e36e6c0)
raw | patch | inline | side by side (parent: e36e6c0)
author | Christian Couder <chriscool@tuxfamily.org> | |
Wed, 18 Nov 2009 06:50:58 +0000 (07:50 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sat, 21 Nov 2009 06:08:10 +0000 (22:08 -0800) |
This has the same effect as --no-replace-objects option; git ignores the
replace refs. When --no-replace-objects option is passed to git, this
environment variable is set to "1" and exported to subprocesses in order
to propagate the same setting.
It is useful for example for scripts, as the git commands used in them can
now be aware that they must not read replace refs.
Tested-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
replace refs. When --no-replace-objects option is passed to git, this
environment variable is set to "1" and exported to subprocesses in order
to propagate the same setting.
It is useful for example for scripts, as the git commands used in them can
now be aware that they must not read replace refs.
Tested-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache.h | patch | blob | history | |
connect.c | patch | blob | history | |
environment.c | patch | blob | history | |
git.c | patch | blob | history | |
t/t6050-replace.sh | patch | blob | history |
index 71a731dbc988a8a22d0a2e1f8f3a5223f4c5d67a..bc7790924f6378a59e5f470f8288551674145960 100644 (file)
--- a/cache.h
+++ b/cache.h
#define CONFIG_ENVIRONMENT "GIT_CONFIG"
#define EXEC_PATH_ENVIRONMENT "GIT_EXEC_PATH"
#define CEILING_DIRECTORIES_ENVIRONMENT "GIT_CEILING_DIRECTORIES"
+#define NO_REPLACE_OBJECTS_ENVIRONMENT "GIT_NO_REPLACE_OBJECTS"
#define GITATTRIBUTES_FILE ".gitattributes"
#define INFOATTRIBUTES_FILE "info/attributes"
#define ATTRIBUTE_MACRO_PREFIX "[attr]"
diff --git a/connect.c b/connect.c
index 7945e38ac1c99c09f7975ae99767bc9747ac3740..c4f134f07aa44d6b2133c805f668b2e4e89bb6a8 100644 (file)
--- a/connect.c
+++ b/connect.c
GIT_WORK_TREE_ENVIRONMENT,
GRAFT_ENVIRONMENT,
INDEX_ENVIRONMENT,
+ NO_REPLACE_OBJECTS_ENVIRONMENT,
NULL
};
conn->env = env;
diff --git a/environment.c b/environment.c
index 5de683784039f20b55f58ef36cb04a11f6a10610..5946f385f57d4be47c2ab02585a90ba8da723f1f 100644 (file)
--- a/environment.c
+++ b/environment.c
git_graft_file = getenv(GRAFT_ENVIRONMENT);
if (!git_graft_file)
git_graft_file = git_pathdup("info/grafts");
+ if (getenv(NO_REPLACE_OBJECTS_ENVIRONMENT))
+ read_replace_refs = 0;
}
int is_bare_repository(void)
index bd2c5fe77b41f314af21df703364361b1601f3d1..d50bbc3e43694eb9d55db666ba5ca2ecb778e25c 100644 (file)
--- a/git.c
+++ b/git.c
*envchanged = 1;
} else if (!strcmp(cmd, "--no-replace-objects")) {
read_replace_refs = 0;
+ setenv(NO_REPLACE_OBJECTS_ENVIRONMENT, "1", 1);
+ if (envchanged)
+ *envchanged = 1;
} else if (!strcmp(cmd, "--git-dir")) {
if (*argc < 2) {
fprintf(stderr, "No directory given for --git-dir.\n" );
diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh
index d4818b430aad556cec959d8be221eb7548a55707..203ffdb17a914654d35416575b6797a2825ce4e6 100755 (executable)
--- a/t/t6050-replace.sh
+++ b/t/t6050-replace.sh
git --no-replace-objects show $HASH2 | grep "A U Thor"
'
+test_expect_success 'test GIT_NO_REPLACE_OBJECTS env variable' '
+ GIT_NO_REPLACE_OBJECTS=1 git cat-file commit $HASH2 | grep "author A U Thor" &&
+ GIT_NO_REPLACE_OBJECTS=1 git show $HASH2 | grep "A U Thor"
+'
+
cat >tag.sig <<EOF
object $HASH2
type commit
cd ..
'
+test_expect_success 'bisect and replacements' '
+ git bisect start $HASH7 $HASH1 &&
+ test "$S" = "$(git rev-parse --verify HEAD)" &&
+ git bisect reset &&
+ GIT_NO_REPLACE_OBJECTS=1 git bisect start $HASH7 $HASH1 &&
+ test "$HASH4" = "$(git rev-parse --verify HEAD)" &&
+ git bisect reset &&
+ git --no-replace-objects bisect start $HASH7 $HASH1 &&
+ test "$HASH4" = "$(git rev-parse --verify HEAD)" &&
+ git bisect reset
+'
+
#
#
test_done