sapling/eden/scm/tests/test-fb-hgext-scm-prompt-git.t
Jun Wu 75a8173a10 tests: enable chg for 572 tests
Summary:
Add `#chg-compatible` to 572 tests that seem to pass with chg enabled.
This should make them run faster.

Reviewed By: xavierd

Differential Revision: D18870507

fbshipit-source-id: fe895e733efffc9286cd3d17c7a156c803124395
2019-12-09 15:26:29 -08:00

97 lines
1.9 KiB
Perl

#chg-compatible
Initialize scm prompt
$ . $TESTDIR/../contrib/scm-prompt.sh
$ cmd() {
> "$@"
> _scm_prompt "(%s)\n"
> }
$ quietcmd() {
> "$@" &> /dev/null
> _scm_prompt "(%s)\n"
> }
Set env to make commands repeatable
$ GIT_AUTHOR_NAME="Test User"
$ export GIT_AUTHOR_NAME
$ GIT_AUTHOR_EMAIL="test@user.org"
$ export GIT_AUTHOR_EMAIL
$ GIT_AUTHOR_DATE="2006-07-03 17:18:43 +0200"
$ export GIT_AUTHOR_DATE
$ GIT_COMMITTER_NAME="Test User"
$ export GIT_COMMITTER_NAME
$ GIT_COMMITTER_EMAIL="test@user.org"
$ export GIT_COMMITTER_EMAIL
$ GIT_COMMITTER_DATE="2006-07-03 17:18:43 +0200"
$ export GIT_COMMITTER_DATE
Outside of a repo, should have no output
$ _scm_prompt
Set up repo
$ git init repo
Initialized empty Git repository in $TESTTMP/repo/.git/
$ cd repo
$ _scm_prompt "%s\n"
master
$ cmd git commit -q --allow-empty -m "Initial empty commit"
(master)
Test basics
$ echo a > a
$ git add a
$ cmd git commit -qm "aa"
(master)
$ cmd git checkout -q "HEAD^"
(1fed3389)
Test rebase
$ cmd git checkout -q -b work "master^"
(work)
$ echo b > a
$ git add a
$ cmd git commit -qm "ba"
(work)
$ quietcmd git rebase master
(eef45076|REBASE|work)
$ cmd git rebase --abort
(work)
$ quietcmd git rebase --merge master
(eef45076|REBASE-m|work)
$ cmd git rebase --abort
(work)
Test more advanced workflows
$ git format-patch "HEAD^" --stdout > .git/patch-ba
$ quietcmd git am < .git/patch-ba
(work|AM)
$ cmd git am --abort
(work)
$ echo c > a
$ cmd git commit -qam "ca"
(work)
$ quietcmd git revert eef4507
(work|REVERTING)
$ cmd git revert --abort
(work)
$ quietcmd git cherry-pick eef4507
(work|CHERRY-PICKING)
$ cmd git cherry-pick --abort
(work)
$ quietcmd git merge eef4507
(work|MERGE)
$ cmd git merge --abort
(work)
$ cmd git bisect start
(work|BISECT)
$ cmd git bisect reset
Already on 'work'
(work)