author | Junio C Hamano <gitster@pobox.com> | |
Wed, 27 Feb 2008 21:02:57 +0000 (13:02 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 27 Feb 2008 21:02:57 +0000 (13:02 -0800) |
* js/branch-track:
doc: documentation update for the branch track changes
branch: optionally setup branch.*.merge from upstream local branches
Conflicts:
Documentation/config.txt
Documentation/git-branch.txt
Documentation/git-checkout.txt
builtin-branch.c
cache.h
t/t7201-co.sh
doc: documentation update for the branch track changes
branch: optionally setup branch.*.merge from upstream local branches
Conflicts:
Documentation/config.txt
Documentation/git-branch.txt
Documentation/git-checkout.txt
builtin-branch.c
cache.h
t/t7201-co.sh
1 | 2 | |||
---|---|---|---|---|
Documentation/config.txt | patch | | diff1 | | diff2 | | blob | history |
builtin-branch.c | patch | | diff1 | | diff2 | | blob | history |
builtin-checkout.c | patch | | diff1 | | diff2 | | blob | history |
cache.h | patch | | diff1 | | diff2 | | blob | history |
config.c | patch | | diff1 | | diff2 | | blob | history |
environment.c | patch | | diff1 | | diff2 | | blob | history |
t/t3200-branch.sh | patch | | diff1 | | diff2 | | blob | history |
t/t7201-co.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc Documentation/config.txt
Simple merge
diff --cc builtin-branch.c
index 7e991030ca4def9e2be2f595809529e13a898c24,32eaf0d1e4e9fd8e5ca720852e9ae5ca122bdd44..a7844454a291d4ea1c126302d1f499497f35929a
--- 1/builtin-branch.c
--- 2/builtin-branch.c
+++ b/builtin-branch.c
static const char *head;
static unsigned char head_sha1[20];
- static int branch_track = 1;
-
-static int branch_use_color;
+static int branch_use_color = -1;
static char branch_colors[][COLOR_MAXLEN] = {
"\033[m", /* reset */
"", /* PLAIN (normal) */
color_parse(value, var, branch_colors[slot]);
return 0;
}
- if (!strcmp(var, "branch.autosetupmerge")) {
- branch_track = git_config_bool(var, value);
- return 0;
- }
- return git_default_config(var, value);
+ return git_color_default_config(var, value);
}
static const char *branch_get_color(enum color_branch ix)
};
git_config(git_branch_config);
- track = branch_track;
+
+ if (branch_use_color == -1)
+ branch_use_color = git_use_color_default;
+
+ track = git_branch_track;
argc = parse_options(argc, argv, options, builtin_branch_usage, 0);
if (!!delete + !!rename + !!force_create > 1)
usage_with_options(builtin_branch_usage, options);
diff --cc builtin-checkout.c
Simple merge
diff --cc cache.h
index 9ebe7913b01aed7cbfa089ce811e57bbc64a6e15,0cd1368aef252b340f1855afd1090681772fdcd7..f16d341f5233b154c6fc1518ae0bd619c8f05c38
+++ b/cache.h
extern size_t delta_base_cache_limit;
extern int auto_crlf;
+enum safe_crlf {
+ SAFE_CRLF_FALSE = 0,
+ SAFE_CRLF_FAIL = 1,
+ SAFE_CRLF_WARN = 2,
+};
+
+extern enum safe_crlf safe_crlf;
+
+ enum branch_track {
+ BRANCH_TRACK_NEVER = 0,
+ BRANCH_TRACK_REMOTE,
+ BRANCH_TRACK_ALWAYS,
+ BRANCH_TRACK_EXPLICIT,
+ };
+
+ extern enum branch_track git_branch_track;
+
#define GIT_REPO_VERSION 0
extern int repository_format_version;
extern int check_repository_format(void);
diff --cc config.c
Simple merge
diff --cc environment.c
index 3527f1663f3f948085ab56a81609ed9764b4e6e9,1f74b4b55703922a050da9f6c87bcd552b55b1e3..6739a3f41745fe1c01dc767e09af8746d6f2815f
--- 1/environment.c
--- 2/environment.c
+++ b/environment.c
size_t packed_git_window_size = DEFAULT_PACKED_GIT_WINDOW_SIZE;
size_t packed_git_limit = DEFAULT_PACKED_GIT_LIMIT;
size_t delta_base_cache_limit = 16 * 1024 * 1024;
-char *pager_program;
+const char *pager_program;
int pager_use_color = 1;
-char *editor_program;
-char *excludes_file;
+const char *editor_program;
+const char *excludes_file;
int auto_crlf = 0; /* 1: both ways, -1: only when adding git objects */
+enum safe_crlf safe_crlf = SAFE_CRLF_WARN;
unsigned whitespace_rule_cfg = WS_DEFAULT_RULE;
+ enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
/* This is set by setup_git_dir_gently() and/or git_default_config() */
char *git_work_tree_cfg;
diff --cc t/t3200-branch.sh
index d21081d0f19bc52e1f1da54c220bc30a026f1093,900d814627ae8ad2147d27965026df30193bcf7a..38a90adad6874d0073059da542835df210172938
--- 1/t/t3200-branch.sh
--- 2/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
'echo Hello > A &&
git update-index --add A &&
git-commit -m "Initial commit." &&
+ echo World >> A &&
+ git update-index --add A &&
+ git-commit -m "Second commit." &&
HEAD=$(git rev-parse --verify HEAD)'
-test_expect_failure \
- 'git branch --help should not have created a bogus branch' \
- 'git branch --help </dev/null >/dev/null 2>/dev/null || :
- test -f .git/refs/heads/--help'
+test_expect_success \
+ 'git branch --help should not have created a bogus branch' '
+ git branch --help </dev/null >/dev/null 2>/dev/null;
+ ! test -f .git/refs/heads/--help
+'
test_expect_success \
'git branch abc should create a branch' \
diff --cc t/t7201-co.sh
index 724adef0bfdc1f9028f112451c76d9053b60223f,17cff8d515656605a61f8097ada897854e355116..63915cd87b74aaddb943f45057bda10d283b4351
--- 1/t/t7201-co.sh
--- 2/t/t7201-co.sh
+++ b/t/t7201-co.sh
'
+test_expect_success 'switch branches while in subdirectory' '
+
+ git reset --hard &&
+ git checkout master &&
+
+ mkdir subs &&
+ (
+ cd subs &&
+ git checkout side
+ ) &&
+ ! test -f subs/one &&
+ rm -fr subs
+
+'
+
+test_expect_success 'checkout specific path while in subdirectory' '
+
+ git reset --hard &&
+ git checkout side &&
+ mkdir subs &&
+ >subs/bero &&
+ git add subs/bero &&
+ git commit -m "add subs/bero" &&
+
+ git checkout master &&
+ mkdir -p subs &&
+ (
+ cd subs &&
+ git checkout side -- bero
+ ) &&
+ test -f subs/bero
+
+'
+
+ test_expect_success \
+ 'checkout w/--track sets up tracking' '
+ git config branch.autosetupmerge false &&
+ git checkout master &&
+ git checkout --track -b track1 &&
+ test "$(git config branch.track1.remote)" &&
+ test "$(git config branch.track1.merge)"'
+
+ test_expect_success \
+ 'checkout w/autosetupmerge=always sets up tracking' '
+ git config branch.autosetupmerge always &&
+ git checkout master &&
+ git checkout -b track2 &&
+ test "$(git config branch.track2.remote)" &&
+ test "$(git config branch.track2.merge)"
+ git config branch.autosetupmerge false'
+
+ test_expect_success \
+ 'checkout w/--track from non-branch HEAD fails' '
+ git checkout -b delete-me master &&
+ rm .git/refs/heads/delete-me &&
+ test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
+ !(git checkout --track -b track)'
+
test_done