sapling/eden/scm/tests/test-hggit-git-clone.t
Jan Mazur 1ca5f6bfae quiet git init command not to print out hint
Summary:
Git client was updated and it started outputting a hint that breaks our tests. It has no meaning in tests so just quiet it.

```
➜  fbcode git init
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint:   git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint:   git branch -m <name>
Initialized empty Git repository in /data/users/mzr/fbsource/fbcode/.git/
```

Reviewed By: StanislavGlebik

Differential Revision: D27232853

fbshipit-source-id: 683ebebb36049adb758e7c26f843f12159a45301
2021-03-23 02:28:52 -07:00

60 lines
1.9 KiB
Perl

Load commonly used test logic
$ . "$TESTDIR/hggit/testutil"
$ git init -q gitrepo
$ cd gitrepo
$ echo alpha > alpha
$ git add alpha
$ fn_git_commit -m 'add alpha'
$ echo beta > beta
$ git add beta
$ fn_git_commit -m 'add beta'
$ cd ..
$ hg clone gitrepo hgrepo | grep -v '^updating'
importing git objects into hg
2 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ hg -R hgrepo log --graph
@ commit: 3bb02b6794dd
bookmark: master
user: test <test@example.org>
date: Mon Jan 01 00:00:11 2007 +0000
summary: add beta
o commit: 69982ec78c6d
user: test <test@example.org>
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha
we should have some bookmarks
$ hg -R hgrepo book
* master 3bb02b6794dd
$ hg -R hgrepo gverify
verifying rev 3bb02b6794dd against git commit 9497a4ee62e16ee641860d7677cdb2589ea15554
test for ssh vulnerability
$ cat >> $HGRCPATH << EOF
> [ui]
> ssh = ssh -o ConnectTimeout=1
> EOF
$ hg clone 'git+ssh://-oProxyCommand=rm${IFS}nonexistent/path' 2>&1 >/dev/null
abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent'
[255]
$ hg clone 'git+ssh://%2DoProxyCommand=rm${IFS}nonexistent/path' 2>&1 >/dev/null
abort: potentially unsafe hostname: '-oProxyCommand=rm${IFS}nonexistent'
[255]
$ hg clone 'git+ssh://fakehost|rm${IFS}nonexistent/path'
destination directory: path
ssh: .* fakehost%7[Cc]rm%24%7[Bb][Ii][Ff][Ss]%7[Dd]nonexistent.* (re)
abort: git remote error: The remote server unexpectedly closed the connection.
[255]
$ hg clone 'git+ssh://fakehost%7Crm${IFS}nonexistent/path'
destination directory: path
ssh: .* fakehost%7[cC]rm%24%7[Bb][Ii][Ff][Ss]%7[Dd]nonexistent.* (re)
abort: git remote error: The remote server unexpectedly closed the connection.
[255]