File: branch-rev-list.t

package info (click to toggle)
git-subrepo 0.4.9-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,552 kB
  • sloc: sh: 7,074; makefile: 273; perl: 226
file content (46 lines) | stat: -rw-r--r-- 1,007 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env bash

set -e

source test/setup

use Test::More

clone-foo-and-bar

subrepo-clone-bar-into-foo

(
  cd "$OWNER/foo"
  branchpoint=$(git rev-parse HEAD)
  add-new-files bar/file1
  # We push here to force subrepo to handle
  # histories where it's not first parent
  git subrepo push bar
  add-new-files bar/file2
  git checkout -b other "$branchpoint"
  add-new-files bar/file3
  add-new-files bar/file4
  add-new-files bar/file5
  git merge --ff master
) >& /dev/null || die

test-exists "$OWNER/foo/bar/file1" "$OWNER/foo/bar/file2" "$OWNER/foo/bar/file3" "$OWNER/foo/bar/file4" "$OWNER/foo/bar/file5"

# -F is needed for branch to fetch new information
is "$(
  cd "$OWNER/foo"
  git subrepo -F branch bar
)" \
  "Created branch 'subrepo/bar' and worktree '.git/tmp/subrepo/bar'." \
  "subrepo branch command output is correct"

got="$(
  cd "$OWNER/foo"
  git rev-list subrepo/bar | wc -l
)"
is "${got// /}" "5" "We have only created commits for one of the paths"

done_testing

teardown