Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ class GitClientTest extends Specification {

def "test is shallow"() {
given:
givenGitRepo("ci/git/shallow/git")
givenGitRepos(["ci/git/shallow_with_origin/origin", "ci/git/shallow_with_origin/repo"])

when:
def gitClient = givenGitClient()
def gitClient = givenGitClient("repo")
def shallow = gitClient.isShallow()

then:
Expand All @@ -111,22 +111,22 @@ class GitClientTest extends Specification {

def "test get upstream branch SHA"() {
given:
givenGitRepo("ci/git/shallow/git")
givenGitRepos(["ci/git/shallow_with_origin/origin", "ci/git/shallow_with_origin/repo"])

when:
def gitClient = givenGitClient()
def gitClient = givenGitClient("repo")
def upstreamBranch = gitClient.getUpstreamBranchSha()

then:
upstreamBranch == "98b944cc44f18bfb78e3021de2999cdcda8efdf6"
upstreamBranch == "c76ef954d23f8fdb42dcf2fe956d6af5a31fe7bd"
}

def "test unshallow: sha-#remoteSha"() {
given:
givenGitRepo("ci/git/shallow/git")
givenGitRepos(["ci/git/shallow_with_origin/origin", "ci/git/shallow_with_origin/repo"])

when:
def gitClient = givenGitClient()
def gitClient = givenGitClient("repo")
def shallow = gitClient.isShallow()
def commits = gitClient.getLatestCommits()

Expand Down Expand Up @@ -209,11 +209,11 @@ class GitClientTest extends Specification {

def "test get commit info with fetching"() {
given:
givenGitRepo("ci/git/shallow/git")
givenGitRepos(["ci/git/shallow_with_origin/origin", "ci/git/shallow_with_origin/repo"])

when:
def commit = "f4377e97f10c2d58696192b170b2fef2a8464b04"
def gitClient = givenGitClient()
def commit = "6e55a15a35ad46f74e4203dd42f7797173a6edcb"
def gitClient = givenGitClient("repo")
def commitInfo = gitClient.getCommitInfo(commit, false)

then:
Expand All @@ -224,13 +224,13 @@ class GitClientTest extends Specification {

then:
commitInfo.sha == commit
commitInfo.author.name == "sullis"
commitInfo.author.email == "github@seansullivan.com"
commitInfo.author.iso8601Date == "2023-05-30T07:07:35-07:00"
commitInfo.committer.name == "GitHub"
commitInfo.committer.email == "noreply@github.com"
commitInfo.committer.iso8601Date == "2023-05-30T07:07:35-07:00"
commitInfo.fullMessage == "brotli4j 1.12.0 (#1592)"
commitInfo.author.name == "Test Author"
commitInfo.author.email == "test-author@example.com"
commitInfo.author.iso8601Date == "2026-03-12T17:02:46+01:00"
commitInfo.committer.name == "Test Author"
commitInfo.committer.email == "test-author@example.com"
commitInfo.committer.iso8601Date == "2026-03-12T17:02:46+01:00"
commitInfo.fullMessage == "Commit message 0"
}

def "test get latest commits"() {
Expand Down

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash
set -e

# IMPORTANT: always use relative paths, as tests move the folders to temp dirs
base_path="/tmp/shallow_with_origin/"
origin_path="origin"
repo_path="repo"

rm -rf $base_path
mkdir -p $base_path
cd $base_path

# create bare origin
mkdir -p $origin_path
cd $origin_path && git init --bare --initial-branch=master
cd ..

# create working copy to populate origin with commits
mkdir -p work && cd work
git init --initial-branch=master
git remote add origin "../$origin_path"
git config user.email "test-author@example.com"
git config user.name "Test Author"

# create 10 commits
for i in $(seq 0 9); do
echo "content $i" >> "file${i}.txt"
git add .
git commit -m "Commit message ${i}"
done

git push origin master
cd ..

# create shallow clone from origin (use file:// URL so --depth works, fix config after)
git clone --depth 1 "file://$base_path/$origin_path" $repo_path

# print commit SHAs for reference
echo "=== COMMIT SHAs ==="
cd work
git log --format="%H %s" --reverse
first_commit=$(git log --format="%H" --reverse | head -1)
echo "=== FIRST COMMIT (not in shallow clone): $first_commit ==="
cd ..

echo "=== SHALLOW CLONE HEAD ==="
cd $repo_path
git log --format="%H %s"
echo "=== IS SHALLOW ==="
git rev-parse --is-shallow-repository
cd ..

# cleanup origin (remove unnecessary files)
(cd $origin_path && rm -rf hooks info logs COMMIT_EDITMSG description)

# cleanup working repo (shallow clone) - rename .git to git
(cd $repo_path && rm -rf .git/hooks .git/info .git/logs .git/COMMIT_EDITMSG .git/description .git/index && mv .git git)

# update the repo config to use relative path (git clone uses absolute)
cd $repo_path/git
# Replace the absolute URL with relative path
python3 -c "
import re
with open('config', 'r') as f:
content = f.read()
content = re.sub(r'url = .*/origin', 'url = ../origin', content)
with open('config', 'w') as f:
f.write(content)
"
cd ../..

echo "=== ORIGIN CONFIG ==="
cat $origin_path/config
echo ""
echo "=== REPO CONFIG ==="
cat $repo_path/git/config
echo ""
echo "=== DONE ==="
echo "Resources at: $base_path"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[core]
repositoryformatversion = 0
filemode = true
bare = true
ignorecase = true
precomposeunicode = true
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x+)JMU044d040031QHËÌI5Ð+©(a8}Ádòámr[WwEùm,ÒȋíFRdV´€ÕÏSÃákѓ.›í/=h^¿žã’"#°"_ïƒÇë“÷†hžæÚrÝgGÑԂK“Ï.Ï
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x’M›0†{ö¯ð}µ¶ñR[•oXÚHÚÜ ²â$°mį/l®=u¤‘ÞyFój4šJÃë©I?L7¥ )j\QD9Ť©%¶gÒ$B˜3ΘQIÖb‹¼©ó-Ëâ¬4ˆE1%ÂDT¸‘ܬjn ŒqÑ(qɀ|›Žús5NÐ~èOÓR<?_Õ]—^}¬ôð"Î !ˆ0Ÿ d`¡Ëš“úoƒöҎ¯-|^ÃñÃ8…YÁ,S;/~øïÀ¥qaô‘½ÆvI/YÕ¦"©Þìw]r*P’w+k³ò>”¡5„M—Áª¨Š—î'€ÎæüÒß°:§®(®y`¬Þ÷ïb-lû0ËÐ_ÜâE;ùJ\’ÎÒEýÁ‹QšûÀ•n}°ëû_]“\çSt<‘?H3ÏÙl6zrƒÒï¶z‰GI×Çè ð{­êo¿ù‰\(™ÜgVxg)'»>µ×Qê{«?ƒÇ9üÔû×1€ûxA£l¤à/‘V¤}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
x’M›0†{ö¯ð=ÚÆÁi[•ðv³@å¶IÓH IS~}asÝSGég4¯F£m]{h,ŒO}§”¨D¨°8[jÁ9‘3¤ÁŸ  +ÓT’p.:ÕôÐD„ bQ謅Ä,„²*Ì
Á¹,!B…ŵÿÙv0S—Úý܏ÅÓ£ñM݋ú¬ÕgÑÖ_!6MJ)¦ŒÃ‘Žköê¿çÃåx€OS,½ J`š†0‚ÄÎò7ã$ʑí)6cºñ¤Ö‚&íúÇöÿÊqœ&vHÃÔAXuP¥Q¹çL„ÒÏW§€Ëu³ÒQMâðüwæ£iÂÝý.¦Â¶÷Cx£[4êe6‡&Cá`½w#œdžàD7îkÕÌô-”3­Éõ|wf‡a+ïÊOš›î)~™ïÌ­v™[ÅùUÝ[uüþ‡¤–ÏœˆÀy_nnåkg¨›~óç/»teó/àq/q?:p¯Q«Ë¥8(ÈÀ?!Ó¥0
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
x’Mo›@†{Þ_±÷(í~²‹”VÅc³RʒÔÜXh
bp>üë ñ5§Ž4Ò;Ïh^FSô]÷4AÎø—éh-DÌÅUîRžs^–’3”ç‚b$ŠŠæ¹´R—WT‚Áía‚Ø”H:.á‚J°d3!sdIá0,IY8ÄÇæ4ýéPÛq‚ÞEßLsq}iü´o¦Zûµè» A)ÅÔqၙÎkNö¿ê¡Ÿjx½Ä*#“d “(TžNÀ«(EíÖ[â~N?^Ô® ªß=>4ñßǺYX„\´¡ Ý.¬’(ϤSlËMzÛüpµ;ܶGbj-Óg½A˄Ÿ‘öC,…çeg³[4ë•^Țª³Yã6ó#¬tÀ\è½oÕÝ~
åEºbÍÝfx/Þ_ý‰“}öi¯šú‹ÎÙtdÏtsûb‹C¯Lи3›áü\¡æôíJg§pª£ïàrŽ@ùŸ¬/¯ÑÙq4µ…ütΤ~
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c76ef954d23f8fdb42dcf2fe956d6af5a31fe7bd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/master
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
ignorecase = true
precomposeunicode = true
[remote "origin"]
url = https://github.com/Netflix/zuul.git
url = ../origin
fetch = +refs/heads/master:refs/remotes/origin/master
[branch "master"]
remote = origin
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# pack-refs with: peeled fully-peeled sorted
c76ef954d23f8fdb42dcf2fe956d6af5a31fe7bd refs/remotes/origin/master
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c76ef954d23f8fdb42dcf2fe956d6af5a31fe7bd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c76ef954d23f8fdb42dcf2fe956d6af5a31fe7bd
Loading