Skip to content

Commit 25e465e

Browse files
author
Lars Schneider
committed
Merge git adsk v1.4.2
1 parent 8262b94 commit 25e465e

21 files changed

+560
-15
lines changed

checkout.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
set -e
88

99
git checkout $@
10-
git submodule update --recursive
10+
git submodule update --init --recursive

clean-checkout.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Clean checkout of a branch/tag/commit including all submodules.
4+
# Attention: This is going to delete all local changes!
5+
#
6+
# Usage: git <KIT_ID> clean-checkout <options> <branch>
7+
#
8+
# <options> will be passed to the git clean command, see git-clean reference
9+
# for available options (-d --force --quiet are passed by default)
10+
# <branch> is expected to be the last argument
11+
#
12+
# Example: git ask clean-checkout master
13+
#
14+
set -e
15+
16+
# check if there is at least one argument passed to the command
17+
if [ $# -lt 1 ]; then
18+
echo "No branch/commit specified"
19+
exit 1
20+
fi
21+
22+
# read branch and options from the arguments, branch is expected to be the last argument
23+
REF=${!#}
24+
OPTIONS=${@:1:$#-1}
25+
26+
# fetch latest changes from all remotes
27+
git fetch --all --force
28+
29+
# check if the requested ref (branch/tag/commit) exists
30+
if [ -z "$(git cat-file -t $REF)" ]; then
31+
echo "Specified ref '$REF' not found"
32+
exit 1
33+
fi
34+
35+
# sync submodules in case submodule URLs have changed
36+
git submodule sync --recursive
37+
38+
# reset repo to have a clean state that enables a checkout in the next step
39+
git reset --hard HEAD
40+
41+
# checkout branch and update submodules
42+
git checkout --force $REF
43+
git submodule update --force --init --recursive
44+
45+
# clean up repo and submodules
46+
git clean -d --force --quiet $OPTIONS
47+
git submodule foreach git clean -d --force --quiet $OPTIONS
48+
git submodule foreach git reset --hard HEAD

config.include

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33
# c.f. https://groups.google.com/forum/#!topic/git-for-windows/9WrSosaa4A8
44
fscache = true
55

6+
[help]
7+
autocorrect = 1
8+
9+
[color]
10+
diff = auto
11+
status = auto
12+
branch = auto
13+
ui = true
14+
15+
[submodule]
16+
fetchJobs = 0
17+
18+
# Configure pull to fetch-and-rebase rather than fetch-and-merge.
19+
# Also, prevent these rebases from inlining an existing local merge.
20+
# See this article for a thorough explanation:
21+
# https://medium.com/@porteneuve/getting-solid-at-git-rebase-vs-merge-4fa1a48c53aa#.ntv2atccl
22+
[pull]
23+
rebase = preserve
24+
25+
[rebase]
26+
autoStash = true
627

728
[push]
829
default = simple
@@ -16,9 +37,13 @@
1637
batch = true
1738
ConcurrentTransfers = 10
1839

40+
[lfs "transfer"]
41+
maxretries = 10
42+
1943
[filter "lfs"]
2044
clean = git-lfs clean %f
2145
smudge = git-lfs smudge %f
46+
process = git-lfs filter-process
2247
required = true
2348

2449

@@ -67,3 +92,10 @@
6792
echo \"Enterprise Config command '$COMMAND' not found.\"; \
6893
fi \
6994
}; f"
95+
96+
97+
###############################################################################
98+
# GitHub for Windows
99+
###############################################################################
100+
[ghfw]
101+
disableverification = true

copr.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Checkout a Pull Request
4+
#
5+
# Usage: git <KIT_ID> copr <GitHub Pull Request number>
6+
#
7+
# c.f. https://gist.github.com/gnarf/5406589#gistcomment-1243876
8+
#
9+
set -e
10+
11+
git fetch --force --update-head-ok ${2:-origin} refs/pull/$1/head:pr/$1
12+
git checkout pr/$1;

help.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Command: git $KIT_ID pull
3232
3333
# Deleted
3434
Description: list the files that have been deleted from the current repository
35-
Command: git adsk show-deleted [-h] [<path/to/file>]
36-
Example: git adsk show-deleted
35+
Command: git adsk show-deleted [-h] [<path/to/file>]
36+
Example: git adsk show-deleted
3737
3838
# Help
3939
Description: This help page.
@@ -43,6 +43,10 @@ Command: git $KIT_ID help
4343
Description: Print version information.
4444
Command: git $KIT_ID version
4545
46+
# Paste
47+
Description: upload a file as a GitHub gist
48+
Command: git $KIT_ID paste <path/to/file>
49+
4650
---
4751
You can easily add your own commands. See $INFO_URL for details.
4852

install-helper.ps1

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# =====================================================================
2+
# Copyright 2011 - Present RealDimensions Software, LLC, and the
3+
# original authors/contributors from ChocolateyGallery
4+
# at https://github.com/chocolatey/chocolatey.org
5+
#
6+
# Licensed under the Apache License, Version 2.0 (the "License");
7+
# you may not use this file except in compliance with the License.
8+
# You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
# =====================================================================
18+
19+
$gitInstallerURL = 'https://github.com/git-for-windows/git/releases/download/v2.11.0.windows.3/Git-2.11.0.3-64-bit.exe'
20+
$gitInstallerHash = 'c3897e078cd7f7f496b0e4ab736ce144c64696d3dbee1e5db417ae047ca3e27f'
21+
22+
if ((Get-WmiObject Win32_OperatingSystem).OSArchitecture -eq "32-bit") {
23+
$gitInstallerURL = 'https://github.com/git-for-windows/git/releases/download/v2.11.0.windows.3/Git-2.11.0.3-32-bit.exe'
24+
$gitInstallerHash = 'dff9bec9c4e21eaba5556fe4a7b1071d1f18e3a8b9645bffb48fda9eaee37e62'
25+
}
26+
27+
if ($env:TEMP -eq $null) {
28+
$env:TEMP = Join-Path $env:SystemDrive 'temp'
29+
}
30+
31+
$tempDir = Join-Path $env:TEMP "adsk-bundle"
32+
if (![System.IO.Directory]::Exists($tempDir)) {[System.IO.Directory]::CreateDirectory($tempDir)}
33+
$gitInstallerEXE = Join-Path $tempDir "Git-64-bit-installer.exe"
34+
$bootstrap = Join-Path $tempDir "install-Git-and-GitADSK.bat"
35+
36+
# PowerShell v2/3 caches the output stream. Then it throws errors due
37+
# to the FileStream not being what is expected. Fixes "The OS handle's
38+
# position is not what FileStream expected. Do not use a handle
39+
# simultaneously in one FileStream and in Win32 code or another
40+
# FileStream."
41+
function Fix-PowerShellOutputRedirectionBug {
42+
$poshMajorVerion = $PSVersionTable.PSVersion.Major
43+
44+
if ($poshMajorVerion -lt 4) {
45+
try{
46+
# http://www.leeholmes.com/blog/2008/07/30/workaround-the-os-handles-position-is-not-what-filestream-expected/ plus comments
47+
$bindingFlags = [Reflection.BindingFlags] "Instance,NonPublic,GetField"
48+
$objectRef = $host.GetType().GetField("externalHostRef", $bindingFlags).GetValue($host)
49+
$bindingFlags = [Reflection.BindingFlags] "Instance,NonPublic,GetProperty"
50+
$consoleHost = $objectRef.GetType().GetProperty("Value", $bindingFlags).GetValue($objectRef, @())
51+
[void] $consoleHost.GetType().GetProperty("IsStandardOutputRedirected", $bindingFlags).GetValue($consoleHost, @())
52+
$bindingFlags = [Reflection.BindingFlags] "Instance,NonPublic,GetField"
53+
$field = $consoleHost.GetType().GetField("standardOutputWriter", $bindingFlags)
54+
$field.SetValue($consoleHost, [Console]::Out)
55+
[void] $consoleHost.GetType().GetProperty("IsStandardErrorRedirected", $bindingFlags).GetValue($consoleHost, @())
56+
$field2 = $consoleHost.GetType().GetField("standardErrorWriter", $bindingFlags)
57+
$field2.SetValue($consoleHost, [Console]::Error)
58+
} catch {
59+
Write-Output "Unable to apply redirection fix."
60+
}
61+
}
62+
}
63+
64+
Fix-PowerShellOutputRedirectionBug
65+
66+
function Download-File {
67+
param (
68+
[string]$url,
69+
[string]$file
70+
)
71+
$downloader = new-object System.Net.WebClient
72+
$defaultCreds = [System.Net.CredentialCache]::DefaultCredentials
73+
if ($defaultCreds -ne $null) {
74+
$downloader.Credentials = $defaultCreds
75+
}
76+
$downloader.DownloadFile($url, $file)
77+
}
78+
79+
Download-File $gitInstallerURL $gitInstallerEXE
80+
81+
if ($PSVersionTable.PSVersion.Major -ge 4) {
82+
$hash = Get-FileHash $gitInstallerEXE -Algorithm SHA256
83+
if ($hash.Hash -ne $gitInstallerHash) {
84+
Write-Output "ERROR: SHA256 hash of the Git for Windows installer does not match."
85+
exit
86+
}
87+
} else {
88+
Write-Output "WARNING: SHA256 hash of the Git for Windows installer cannot be checked as your Powershell version is outdated (expected on Windows 7 and below)."
89+
}
90+
91+
Set-Content $bootstrap "@echo off" -Encoding ASCII
92+
Add-Content $bootstrap "`"$gitInstallerEXE`" /SILENT /COMPONENTS=`"icons,icons\desktop,ext,ext\shellhere,ext\guihere,assoc,assoc_sh`"" -Encoding ASCII
93+
Add-Content $bootstrap "SET PATH=%PATH%;`"C:\Program Files\Git\bin`""
94+
Add-Content $bootstrap "git config --system --unset credential.helper" -Encoding ASCII
95+
Add-Content $bootstrap "git clone -c credential.helper=`"!f() { cat >/dev/null; echo `"username=%1`"; echo `"password=%2`"; }; f`" --branch production https://git.autodesk.com/github-solutions/adsk-git.git `"%HOMEDRIVE%%HOMEPATH%\.adsk-git`"" -Encoding ASCII
96+
Add-Content $bootstrap "git config --global include.path `"%HOMEDRIVE%%HOMEPATH%/.adsk-git/config.include`"" -Encoding ASCII
97+
98+
if ("<<USERNAME>>" -eq "token") {
99+
Add-Content $bootstrap "cmd /V /C `"set GITHUB_TOKEN=%2 && git adsk`"" -Encoding ASCII
100+
} else {
101+
Add-Content $bootstrap "cmd /V /C `"git adsk`"" -Encoding ASCII
102+
}
103+
104+
Start-Process -verb RunAs $bootstrap '<<USERNAME>> <<PASSWORD>>'

install.bat

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@echo off
2+
rem
3+
rem Run `install.bat` to install the Autodesk Git Bundle. It will ask
4+
rem you for your credentials!
5+
rem
6+
rem Run `install.bat <TOKEN>` to install the Autodesk Git Bundle with a
7+
rem GitHub token. More info here:
8+
rem https://help.github.com/articles/creating-an-access-token-for-command-line-use/
9+
rem
10+
11+
echo Installing Autodesk Git Bundle...
12+
13+
if [%1]==[] goto ask
14+
15+
SET USERNAME=token
16+
SET PASSWORD=%1
17+
goto :run
18+
19+
:ask
20+
set /p USERNAME="Please enter your Autodesk username and press [ENTER]: "
21+
set "psCommand=powershell -Command "$pword = read-host 'Please enter your Autodesk password (no GitHub token!) and press [ENTER]' -AsSecureString ; ^
22+
$BSTR=[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($pword); ^
23+
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)""
24+
for /f "usebackq delims=" %%p in (`%psCommand%`) do set PASSWORD=%%p
25+
26+
:run
27+
@powershell -NoProfile -ExecutionPolicy Bypass -Command "$auth = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes('%USERNAME%:%PASSWORD%')); $webClient = New-Object System.Net.WebClient; $webClient.Headers.add('Accept','application/vnd.github.v3.raw'); $webClient.Headers.add('Authorization',\"Basic ${auth}\"); iex $webClient.DownloadString('https://git.autodesk.com/api/v3/repos/github-solutions/adsk-git/contents/install-helper.ps1?ref=production').replace('<<USERNAME>>','%USERNAME%').replace('<<PASSWORD>>','%PASSWORD%')"

install.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env bash
2+
#
3+
# Eases the installation of git adsk like this:
4+
# curl --user '<YOUR-USER>:<YOUR-PASSWORD>' https://git.autodesk.com/raw/github-solutions/adsk-git/master/install.sh | sh
5+
#
6+
git clone --branch production https://git.autodesk.com/github-solutions/adsk-git.git ~/.adsk-git
7+
git config --global include.path ~/.adsk-git/config.include

lib/lnx/find_pfx.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# We would like to see what the user would when
55
# typing `which git`
66

7-
use 5.016;
7+
use strict;
88
use warnings;
99
use File::Basename;
1010

lib/lnx/setup_helpers.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
function open_url () {
2+
:
3+
}
4+
15
function credential_helper {
26
echo cache
37
}
@@ -10,7 +14,7 @@ function credential_helper_parameters {
1014
function install_git_lfs {
1115
local KIT_PATH=$1
1216
local VERSION=$2
13-
local GIT_LFS_CHECKSUM="aba77a55638502b4d58cad5c52bfdf98"
17+
local GIT_LFS_CHECKSUM=33e65b2e1321fed86a6adbfcf008ea3c
1418
# Run this to calculate the hash for a new version:
1519
# export V="1.1.1"; curl --location https://github.com/github/git-lfs/releases/download/v$V/git-lfs-linux-amd64-$V.tar.gz | md5
1620

0 commit comments

Comments
 (0)