Skip to content
Snippets Groups Projects
Commit 935c4fb1 authored by David M. Carr's avatar David M. Carr
Browse files

tests: let git init create directories when applicable

It's functionally equivalent to create a directory, cd into it, git init, and
cd out of the directory, or simply git init with the directory specified.

In several cases, we were doing the former without performing any other
operations in the git repo, which just made the test unneccesarily complex.
Even in the case where we still want to cd into the directory, calling git
init with the directory name eliminates the need for a separate mkdir command.

This changeset converts the former approach to the latter with the goal of
increasing the readability of the tests.

Thanks to Felipe Contreras for the patch which this was based on.
parent daf3e44a
No related branches found
No related tags found
No related merge requests found
Showing
with 43 additions and 96 deletions
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,6 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
......
......@@ -48,8 +48,6 @@
$ cd ..
$ mkdir gitrepo
$ cd gitrepo
$ git init --bare
$ git init --bare gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/
......@@ -54,7 +52,5 @@
Initialized empty Git repository in $TESTTMP/gitrepo/
$ cd ..
$ cd hgrepo1
$ hg bookmark -r tip master
$ hg push -r master ../gitrepo
......
......@@ -48,8 +48,6 @@
$ cd ..
$ mkdir gitrepo
$ cd gitrepo
$ git init --bare
$ git init --bare gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/
......@@ -54,7 +52,5 @@
Initialized empty Git repository in $TESTTMP/gitrepo/
$ cd ..
$ cd hgrepo1
$ hg bookmark -r tip master
$ hg push -r master ../gitrepo
......
......@@ -49,8 +49,6 @@
$ cd ..
$ mkdir gitrepo
$ cd gitrepo
$ git init --bare
$ git init --bare gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/
......@@ -55,7 +53,5 @@
Initialized empty Git repository in $TESTTMP/gitrepo/
$ cd ..
$ cd hgrepo1
$ hg bookmark -r4 master
$ hg push -r master ../gitrepo
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,7 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ git commit --allow-empty -m empty >/dev/null 2>/dev/null || echo "git commit error"
$ cd ..
......@@ -15,8 +13,6 @@
$ git commit --allow-empty -m empty >/dev/null 2>/dev/null || echo "git commit error"
$ cd ..
$ mkdir gitrepo2
$ cd gitrepo2
$ git init --bare
$ git init --bare gitrepo2
Initialized empty Git repository in $TESTTMP/gitrepo2/
......@@ -21,6 +17,5 @@
Initialized empty Git repository in $TESTTMP/gitrepo2/
$ cd ..
$ hg clone gitrepo hgrepo | grep -v '^updating'
importing git objects into hg
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
......
......@@ -25,5 +25,6 @@
> count=`expr $count + 1`
> }
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -29,6 +30,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
utf-8 encoded commit message
$ echo alpha > alpha
......@@ -44,8 +43,6 @@
variable i18n.commitencoding to the encoding your project uses.
$ cd ..
$ mkdir gitrepo2
$ cd gitrepo2
$ git init --bare
$ git init --bare gitrepo2
Initialized empty Git repository in $TESTTMP/gitrepo2/
......@@ -50,6 +47,5 @@
Initialized empty Git repository in $TESTTMP/gitrepo2/
$ cd ..
$ hg clone gitrepo hgrepo | grep -v '^updating'
importing git objects into hg
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,6 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
......@@ -33,8 +32,6 @@
beta
$ cd ..
$ mkdir gitrepo2
$ cd gitrepo2
$ git init --bare
$ git init --bare gitrepo2
Initialized empty Git repository in $TESTTMP/gitrepo2/
......@@ -39,6 +36,5 @@
Initialized empty Git repository in $TESTTMP/gitrepo2/
$ cd ..
$ hg clone gitrepo hgrepo | grep -v '^updating'
importing git objects into hg
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,6 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo1
$ git init gitrepo1
Initialized empty Git repository in $TESTTMP/gitrepo1/.git/
$ cd gitrepo1
......@@ -11,8 +12,6 @@
$ cd gitrepo1
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo1/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
$ cd ..
......@@ -14,7 +13,8 @@
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
$ cd ..
$ mkdir gitsubrepo
$ git init gitsubrepo
Initialized empty Git repository in $TESTTMP/gitsubrepo/.git/
$ cd gitsubrepo
......@@ -20,6 +20,4 @@
$ cd gitsubrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitsubrepo/.git/
$ echo beta > beta
$ git add beta
$ fn_git_commit -m 'add beta'
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,6 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ git config receive.denyCurrentBranch ignore
$ echo alpha > alpha
$ git add alpha
......
......@@ -7,5 +7,5 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir hgrepo
$ hg init hgrepo
$ cd hgrepo
......@@ -11,6 +11,4 @@
$ cd hgrepo
$ hg init
$ echo alpha > alpha
$ hg add alpha
$ fn_hg_commit -m "add alpha"
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,7 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m "add alpha"
......
......@@ -11,5 +11,6 @@
$ filterhash="sed s/71414c4e3c6f/a31e374801c9/;s/698615204564/d93a72262a83/"
$ filterhash="$filterhash;s/d93a72262a83/05aed681ccb3/"
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -15,7 +16,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m "add alpha"
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,7 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m "add alpha"
......
......@@ -11,5 +11,6 @@
$ python -c 'from mercurial import util ; assert \
> util.version() != "unknown" and util.version() > "1.7"' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -15,7 +16,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m "add alpha"
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,6 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,6 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
......@@ -35,8 +34,6 @@
create mode 100644 beta
$ cd ..
$ mkdir gitrepo2
$ cd gitrepo2
$ git init --bare
$ git init --bare gitrepo2
Initialized empty Git repository in $TESTTMP/gitrepo2/
......@@ -41,6 +38,5 @@
Initialized empty Git repository in $TESTTMP/gitrepo2/
$ cd ..
$ hg clone gitrepo hgrepo | grep -v '^updating'
importing git objects into hg
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,7 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
......@@ -45,8 +43,6 @@
create mode 100644 gamma
$ cd ..
$ mkdir gitrepo2
$ cd gitrepo2
$ git init --bare
$ git init --bare gitrepo2
Initialized empty Git repository in $TESTTMP/gitrepo2/
......@@ -51,6 +47,5 @@
Initialized empty Git repository in $TESTTMP/gitrepo2/
$ cd ..
$ hg clone gitrepo hgrepo | grep -v '^updating'
importing git objects into hg
4 files updated, 0 files merged, 0 files removed, 0 files unresolved
......
......@@ -7,5 +7,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -11,7 +12,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m "add alpha"
......
......@@ -18,5 +18,6 @@
bail if the user does not have dulwich
$ python -c 'import dulwich, dulwich.repo' || exit 80
$ mkdir gitrepo
$ git init gitrepo
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ cd gitrepo
......@@ -22,6 +23,4 @@
$ cd gitrepo
$ git init
Initialized empty Git repository in $TESTTMP/gitrepo/.git/
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment