Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
git-mirror
/
git
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
0
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security
Insights
Files
11f68d9
Documentation
arm
compat
contrib
git-gui
gitweb
mozilla-sha1
perl
ppc
t
t3900
t4013
t4100
t4101
t5100
t5515
t9110
t9111
.gitignore
Makefile
README
annotate-tests.sh
diff-lib.sh
lib-git-svn.sh
lib-read-tree-m-3way.sh
t0000-basic.sh
t0010-racy-git.sh
t0020-crlf.sh
t0021-conversion.sh
t1000-read-tree-m-3way.sh
t1001-read-tree-m-2way.sh
t1002-read-tree-m-u-2way.sh
t1003-read-tree-prefix.sh
t1004-read-tree-m-u-wf.sh
t1020-subdirectory.sh
t1100-commit-tree-options.sh
t1200-tutorial.sh
t1300-repo-config.sh
t1400-update-ref.sh
t1410-reflog.sh
t2000-checkout-cache-clash.sh
t2001-checkout-cache-clash.sh
t2002-checkout-cache-u.sh
t2003-checkout-cache-mkdir.sh
t2004-checkout-cache-temp.sh
t2005-checkout-index-symlinks.sh
t2100-update-cache-badpath.sh
t2101-update-index-reupdate.sh
t2102-update-index-symlinks.sh
t2200-add-update.sh
t3000-ls-files-others.sh
t3001-ls-files-others-exclude.sh
t3002-ls-files-dashpath.sh
t3010-ls-files-killed-modified.sh
t3020-ls-files-error-unmatch.sh
t3030-merge-recursive.sh
t3040-subprojects-basic.sh
t3100-ls-tree-restrict.sh
t3101-ls-tree-dirname.sh
t3200-branch.sh
t3210-pack-refs.sh
t3300-funny-names.sh
t3400-rebase.sh
t3401-rebase-partial.sh
t3402-rebase-merge.sh
t3403-rebase-skip.sh
t3500-cherry.sh
t3501-revert-cherry-pick.sh
t3600-rm.sh
t3700-add.sh
t3800-mktag.sh
t3900-i18n-commit.sh
t3901-8859-1.txt
t3901-i18n-patch.sh
t3901-utf8.txt
t4000-diff-format.sh
t4001-diff-rename.sh
t4002-diff-basic.sh
t4003-diff-rename-1.sh
t4004-diff-rename-symlink.sh
t4005-diff-rename-2.sh
t4006-diff-mode.sh
t4007-rename-3.sh
t4008-diff-break-rewrite.sh
t4009-diff-rename-4.sh
t4010-diff-pathspec.sh
t4011-diff-symlink.sh
t4012-diff-binary.sh
t4013-diff-various.sh
t4014-format-patch.sh
t4015-diff-whitespace.sh
t4016-diff-quote.sh
t4017-diff-retval.sh
t4017-quiet.sh
t4020-diff-external.sh
t4100-apply-stat.sh
t4101-apply-nonl.sh
t4102-apply-rename.sh
t4103-apply-binary.sh
t4104-apply-boundary.sh
t4109-apply-multifrag.sh
t4110-apply-scan.sh
t4112-apply-renames.sh
t4113-apply-ending.sh
t4114-apply-typechange.sh
t4115-apply-symlink.sh
t4116-apply-reverse.sh
t4117-apply-reject.sh
t4118-apply-empty-context.sh
t4119-apply-config.sh
t4120-apply-popt.sh
t4121-apply-diffs.sh
t4122-apply-symlink-inside.sh
t4200-rerere.sh
t4201-shortlog.sh
t5000-tar-tree.sh
t5100-mailinfo.sh
t5300-pack-object.sh
t5301-sliding-window.sh
t5302-pack-index.sh
t5400-send-pack.sh
t5401-update-hooks.sh
t5500-fetch-pack.sh
t5502-quickfetch.sh
t5510-fetch.sh
t5515-fetch-merge-logic.sh
t5520-pull.sh
t5600-clone-fail-cleanup.sh
t5700-clone-reference.sh
t5710-info-alternate.sh
t6000lib.sh
t6001-rev-list-graft.sh
t6002-rev-list-bisect.sh
t6003-rev-list-topo-order.sh
t6004-rev-list-path-optim.sh
t6005-rev-list-count.sh
t6006-rev-list-format.sh
t6010-merge-base.sh
t6020-merge-df.sh
t6021-merge-criss-cross.sh
t6022-merge-rename.sh
t6023-merge-file.sh
t6023-merge-rename-nocruft.sh
t6024-recursive-merge.sh
t6025-merge-symlinks.sh
t6026-merge-attr.sh
t6030-bisect-porcelain.sh
t6101-rev-parse-parents.sh
t6120-describe.sh
t6200-fmt-merge-msg.sh
t7001-mv.sh
t7002-grep.sh
t7101-reset.sh
t7201-co.sh
t7300-clean.sh
t7400-submodule-basic.sh
t8001-annotate.sh
t8002-blame.sh
t8003-blame.sh
t9001-send-email.sh
t9100-git-svn-basic.sh
t9101-git-svn-props.sh
t9102-git-svn-deep-rmdir.sh
t9104-git-svn-follow-parent.sh
t9105-git-svn-commit-diff.sh
t9106-git-svn-commit-diff-clobber.sh
t9107-git-svn-migrate.sh
t9108-git-svn-glob.sh
t9110-git-svn-use-svm-props.sh
t9111-git-svn-use-svnsync-props.sh
t9112-git-svn-md5less-file.sh
t9200-git-cvsexportcommit.sh
t9300-fast-import.sh
t9400-git-cvsserver-server.sh
t9500-gitweb-standalone-no-errors.sh
test-lib.sh
test4012.png
test9200a.png
test9200b.png
templates
xdiff
.gitignore
.mailmap
COPYING
GIT-VERSION-GEN
INSTALL
Makefile
README
RelNotes
alloc.c
archive-tar.c
archive-zip.c
archive.h
attr.c
attr.h
base85.c
blob.c
blob.h
builtin-add.c
builtin-annotate.c
builtin-apply.c
builtin-archive.c
builtin-blame.c
builtin-branch.c
builtin-bundle.c
builtin-cat-file.c
builtin-check-attr.c
builtin-check-ref-format.c
builtin-checkout-index.c
builtin-commit-tree.c
builtin-config.c
builtin-count-objects.c
builtin-describe.c
builtin-diff-files.c
builtin-diff-index.c
builtin-diff-tree.c
builtin-diff.c
builtin-fetch--tool.c
builtin-fmt-merge-msg.c
builtin-for-each-ref.c
builtin-fsck.c
builtin-gc.c
builtin-grep.c
builtin-init-db.c
builtin-log.c
builtin-ls-files.c
builtin-ls-tree.c
builtin-mailinfo.c
builtin-mailsplit.c
builtin-merge-base.c
builtin-merge-file.c
builtin-mv.c
builtin-name-rev.c
builtin-pack-objects.c
builtin-pack-refs.c
builtin-prune-packed.c
builtin-prune.c
builtin-push.c
builtin-read-tree.c
builtin-reflog.c
builtin-rerere.c
builtin-rev-list.c
builtin-rev-parse.c
builtin-revert.c
builtin-rm.c
builtin-runstatus.c
builtin-shortlog.c
builtin-show-branch.c
builtin-show-ref.c
builtin-stripspace.c
builtin-symbolic-ref.c
builtin-tar-tree.c
builtin-unpack-objects.c
builtin-update-index.c
builtin-update-ref.c
builtin-upload-archive.c
builtin-verify-pack.c
builtin-write-tree.c
builtin.h
cache-tree.c
cache-tree.h
cache.h
check-builtins.sh
check-racy.c
color.c
color.h
combine-diff.c
commit.c
commit.h
config.c
config.mak.in
configure.ac
connect.c
convert-objects.c
convert.c
copy.c
csum-file.c
csum-file.h
ctype.c
daemon.c
date.c
decorate.c
decorate.h
delta.h
diff-delta.c
diff-lib.c
diff.c
diff.h
diffcore-break.c
diffcore-delta.c
diffcore-order.c
diffcore-pickaxe.c
diffcore-rename.c
diffcore.h
dir.c
dir.h
dump-cache-tree.c
entry.c
environment.c
exec_cmd.c
exec_cmd.h
fast-import.c
fetch-pack.c
fetch.c
fetch.h
generate-cmdlist.sh
git-add--interactive.perl
git-am.sh
git-archimport.perl
git-bisect.sh
git-checkout.sh
git-clean.sh
git-clone.sh
git-commit.sh
git-compat-util.h
git-cvsexportcommit.perl
git-cvsimport.perl
git-cvsserver.perl
git-fetch.sh
git-instaweb.sh
git-lost-found.sh
git-ls-remote.sh
git-merge-octopus.sh
git-merge-one-file.sh
git-merge-ours.sh
git-merge-resolve.sh
git-merge-stupid.sh
git-merge.sh
git-mergetool.sh
git-p4import.py
git-parse-remote.sh
git-pull.sh
git-quiltimport.sh
git-rebase.sh
git-relink.perl
git-remote.perl
git-repack.sh
git-request-pull.sh
git-reset.sh
git-send-email.perl
git-sh-setup.sh
git-submodule.sh
git-svn.perl
git-svnimport.perl
git-tag.sh
git-verify-tag.sh
git.c
git.spec.in
gitk
grep.c
grep.h
hash-object.c
help.c
http-fetch.c
http-push.c
http.c
http.h
ident.c
imap-send.c
index-pack.c
interpolate.c
interpolate.h
list-objects.c
list-objects.h
local-fetch.c
lockfile.c
log-tree.c
log-tree.h
mailmap.c
mailmap.h
match-trees.c
merge-file.c
merge-index.c
merge-recursive.c
merge-tree.c
mktag.c
mktree.c
object-refs.c
object.c
object.h
pack-check.c
pack-redundant.c
pack-write.c
pack.h
pager.c
patch-delta.c
patch-id.c
patch-ids.c
patch-ids.h
path-list.c
path-list.h
path.c
peek-remote.c
pkt-line.c
pkt-line.h
progress.c
progress.h
quote.c
quote.h
reachable.c
reachable.h
read-cache.c
receive-pack.c
reflog-walk.c
reflog-walk.h
refs.c
refs.h
remote.c
remote.h
revision.c
revision.h
rsh.c
rsh.h
run-command.c
run-command.h
send-pack.c
server-info.c
setup.c
sha1_file.c
sha1_name.c
shallow.c
shell.c
show-index.c
sideband.c
sideband.h
ssh-fetch.c
ssh-pull.c
ssh-push.c
ssh-upload.c
strbuf.c
strbuf.h
symlinks.c
tag.c
tag.h
tar.h
test-chmtime.c
test-date.c
test-delta.c
test-genrandom.c
test-match-trees.c
test-sha1.c
test-sha1.sh
trace.c
tree-diff.c
tree-walk.c
tree-walk.h
tree.c
tree.h
unpack-file.c
unpack-trees.c
unpack-trees.h
update-server-info.c
upload-pack.c
usage.c
utf8.c
utf8.h
var.c
write_or_die.c
wt-status.c
wt-status.h
xdiff-interface.c
xdiff-interface.h
Breadcrumbs
git
/
t
/
t3200-branch.sh
Blame
Blame
Latest commit
History
History
executable file
·
186 lines (156 loc) · 6.54 KB
Breadcrumbs
git
/
t
/
t3200-branch.sh
Top
File metadata and controls
Code
Blame
executable file
·
186 lines (156 loc) · 6.54 KB
Raw
#!/bin/sh # # Copyright (c) 2005 Amos Waterland # test_description='git branch --foo should not create bogus branch This test runs git branch --help and checks that the argument is properly handled. Specifically, that a bogus branch is not created. ' . ./test-lib.sh test_expect_success \ 'prepare a trivial repository' \ 'echo Hello > A && git-update-index --add A && git-commit -m "Initial 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 abc should create a branch' \ 'git-branch abc && test -f .git/refs/heads/abc' test_expect_success \ 'git branch a/b/c should create a branch' \ 'git-branch a/b/c && test -f .git/refs/heads/a/b/c' cat >expect <<EOF 0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master EOF test_expect_success \ 'git branch -l d/e/f should create a branch and a log' \ 'GIT_COMMITTER_DATE="2005-05-26 23:30" \ git-branch -l d/e/f && test -f .git/refs/heads/d/e/f && test -f .git/logs/refs/heads/d/e/f && diff expect .git/logs/refs/heads/d/e/f' test_expect_success \ 'git branch -d d/e/f should delete a branch and a log' \ 'git-branch -d d/e/f && test ! -f .git/refs/heads/d/e/f && test ! -f .git/logs/refs/heads/d/e/f' test_expect_success \ 'git branch j/k should work after branch j has been deleted' \ 'git-branch j && git-branch -d j && git-branch j/k' test_expect_success \ 'git branch l should work after branch l/m has been deleted' \ 'git-branch l/m && git-branch -d l/m && git-branch l' test_expect_success \ 'git branch -m m m/m should work' \ 'git-branch -l m && git-branch -m m m/m && test -f .git/logs/refs/heads/m/m' test_expect_success \ 'git branch -m n/n n should work' \ 'git-branch -l n/n && git-branch -m n/n n test -f .git/logs/refs/heads/n' test_expect_failure \ 'git branch -m o/o o should fail when o/p exists' \ 'git-branch o/o && git-branch o/p && git-branch -m o/o o' test_expect_failure \ 'git branch -m q r/q should fail when r exists' \ 'git-branch q && git-branch r && git-branch -m q r/q' mv .git/config .git/config-saved test_expect_success 'git branch -m q q2 without config should succeed' ' git-branch -m q q2 && git-branch -m q2 q ' mv .git/config-saved .git/config git-config branch.s/s.dummy Hello test_expect_success \ 'git branch -m s/s s should work when s/t is deleted' \ 'git-branch -l s/s && test -f .git/logs/refs/heads/s/s && git-branch -l s/t && test -f .git/logs/refs/heads/s/t && git-branch -d s/t && git-branch -m s/s s && test -f .git/logs/refs/heads/s' test_expect_success 'config information was renamed, too' \ "test $(git-config branch.s.dummy) = Hello && ! git-config branch.s/s/dummy" test_expect_failure \ 'git-branch -m u v should fail when the reflog for u is a symlink' \ 'git-branch -l u && mv .git/logs/refs/heads/u real-u && ln -s real-u .git/logs/refs/heads/u && git-branch -m u v' test_expect_success 'test tracking setup via --track' \ 'git-config remote.local.url . && git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch --track my1 local/master && test $(git-config branch.my1.remote) = local && test $(git-config branch.my1.merge) = refs/heads/master' test_expect_success 'test tracking setup (non-wildcard, matching)' \ 'git-config remote.local.url . && git-config remote.local.fetch refs/heads/master:refs/remotes/local/master && (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch --track my4 local/master && test $(git-config branch.my4.remote) = local && test $(git-config branch.my4.merge) = refs/heads/master' test_expect_success 'test tracking setup (non-wildcard, not matching)' \ 'git-config remote.local.url . && git-config remote.local.fetch refs/heads/s:refs/remotes/local/s && (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch --track my5 local/master && ! test "$(git-config branch.my5.remote)" = local && ! test "$(git-config branch.my5.merge)" = refs/heads/master' test_expect_success 'test tracking setup via config' \ 'git-config branch.autosetupmerge true && git-config remote.local.url . && git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch my3 local/master && test $(git-config branch.my3.remote) = local && test $(git-config branch.my3.merge) = refs/heads/master' test_expect_success 'test overriding tracking setup via --no-track' \ 'git-config branch.autosetupmerge true && git-config remote.local.url . && git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && (git-show-ref -q refs/remotes/local/master || git-fetch local) && git-branch --no-track my2 local/master && git-config branch.autosetupmerge false && ! test "$(git-config branch.my2.remote)" = local && ! test "$(git-config branch.my2.merge)" = refs/heads/master' test_expect_success 'test local tracking setup' \ 'git branch --track my6 s && test $(git-config branch.my6.remote) = . && test $(git-config branch.my6.merge) = refs/heads/s' test_expect_success 'test tracking setup via --track but deeper' \ 'git-config remote.local.url . && git-config remote.local.fetch refs/heads/*:refs/remotes/local/* && (git-show-ref -q refs/remotes/local/o/o || git-fetch local) && git-branch --track my7 local/o/o && test "$(git-config branch.my7.remote)" = local && test "$(git-config branch.my7.merge)" = refs/heads/o/o' # Keep this test last, as it changes the current branch cat >expect <<EOF 0000000000000000000000000000000000000000 $HEAD $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150200 +0000 branch: Created from master EOF test_expect_success \ 'git checkout -b g/h/i -l should create a branch and a log' \ 'GIT_COMMITTER_DATE="2005-05-26 23:30" \ git-checkout -b g/h/i -l master && test -f .git/refs/heads/g/h/i && test -f .git/logs/refs/heads/g/h/i && diff expect .git/logs/refs/heads/g/h/i' test_done
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
You can’t perform that action at this time.