Closed Jonkimi closed 6 years ago
git subtree add -P HSSCore HSSCore master
I don't have HSSCore
.
The idea of a Minimal, Verifiable, Complete Example is that it makes it easy for other people to verify your claim that Git is broken.
So a small public repository would do just fine.
As it is, you're in luck (at least half-lucky), as the git-subtree
command already comes with tests. I say half-lucky because they work for me.
But they do suggest that something goes wrong in your setup (something we saw earlier, in git stash
's context). To see what I mean, just add the set -x
somewhere after the #!/bin/sh
line in git-subtree
and call the command again that fails for you. You should see something similar to this:
++ git rev-parse --parseopt -- add '--prefix=sub dir' FETCH_HEAD
+ eval 'set -- -P '\''sub dir'\'' -- '\''add'\'' '\''FETCH_HEAD'\'''
++ set -- -P 'sub dir' -- add FETCH_HEAD
Except that in your case, it probably says eval ''
. I strongly suspect this to be the case, as we saw exactly this symptom before, at least with git stash
and with git flow
: some overzealous anti-malware (most often, Comodo Internet Security) thought that the sub shell called here indicates some sort of shellcode exploit, and simply shuts down the git rev-parse
subprocess (and since git subtree
is a Unix shell script, like so many Unix shell scripts, it does not really get error checking right and fails to pick up on the shut down process), so git subtree
goes on and tries to use what it thinks is not an empty string.
But it is an empty string, so the git rev-parse --parseopt
function never has a chance of normalizing the command-line, and therefore the command-parsing of git-subtree
gets thoroughly confused (because the --
is missing that git rev-parse --parseopt
would have inserted at the appropriate spot).
Probably you have Comodo Internet Security?
The idea of a Minimal, Verifiable, Complete Example is that it makes it easy for other people to verify your claim that Git is broken.
Thank you for your advice, I will do better.
It did say eval ''
after I added set -x
in git-subtree . And I have Comodo Internet Security.
The output after I added set -x
in git-subtree :
+ test 5 -eq 0
+ OPTS_SPEC='git subtree add --prefix=<prefix> <commit>
git subtree add --prefix=<prefix> <repository> <ref>
git subtree merge --prefix=<prefix> <commit>
git subtree pull --prefix=<prefix> <repository> <ref>
git subtree push --prefix=<prefix> <repository> <ref>
git subtree split --prefix=<prefix> <commit...>
--
h,help show the help
q quiet
d show debug messages
P,prefix= the name of the subdir to split out
m,message= use the given message as the commit message for the merge commit
options for '\''split'\''
annotate= add a prefix to commit message of new commits
b,branch= create a new branch from the split subtree
ignore-joins ignore prior --rejoin commits
onto= try connecting new tree to an existing one
rejoin merge the new branch back into HEAD
options for '\''add'\'', '\''merge'\'', and '\''pull'\''
squash merge subtree changes as a single commit
'
+ eval ''
++ git --exec-path
+ PATH='/mingw64/libexec/git-core:/mingw64/bin:/usr/bin:/c/Users/liaojun/bin:/c/Program Files (x86)/Common Files/Oracle/Java/javapath:/c/Program Files (x86)/Eziriz/.NET Reactor:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0/libnvvp:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/libnvvp:/c/Program Files (x86)/Common Files/Intel/Shared Libraries/redist/intel64/compiler:/d/Program Files/Python/Python36/Scripts:/d/Program Files/Python/Python36:/c/ProgramData/Oracle/Java/javapath:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/c/Users/liaojun/.dnx/bin:/c/Program Files/Microsoft DNX/Dnvm:/c/Program Files/Microsoft SQL Server/120/Tools/Binn:/c/Program Files/Microsoft SQL Server/130/Tools/Binn:/c/Program Files/dotnet:/c/Program Files (x86)/Windows Kits/8.1/Windows Performance Toolkit:/c/Go/bin:/c/ProgramData/chocolatey/bin:/c/Program Files (x86)/vim/vim80:/d/06-software/colortool:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/bin:/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.1/libnvvp:/c/Program Files/NVIDIA Corporation/Nsmi:/c/Program Files (x86)/nodejs:/d/Program Files/MacType:/c/Program Files (x86)/Common Files/Thunder Network/KanKan/Codecs:/c/Program Files/Microsoft Windows Performance Toolkit:/c/mingw-w64/mingw32/bin:/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin:/c/Program Files/Microsoft SQL Server/110/Tools/Binn:/c/Program Files (x86)/Microsoft SDKs/TypeScript/1.0:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/cmd:/c/Program Files/NVIDIA Corporation/Nsmi:/c/Program Files/Microsoft VS Code/bin:/d/Program Files/Python/Python36/Scripts:/d/Program Files/Python/Python36:/c/Users/liaojun/AppData/Local/Microsoft/WindowsApps:/c/Program Files/Microsoft VS Code/bin:/c/Program Files/CMake/bin:/c/Users/liaojun/.babun:/c/Users/liaojun/AppData/Roaming/npm:/c/Program Files (x86)/Nmap:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/c/Program Files/NVIDIA Corporation/Nsmi:C:/Program Files/Git/mingw64/libexec/git-core'
+ . git-sh-setup
++ unset CDPATH
++ IFS='
'
+++ git --exec-path
++ . 'C:/Program Files/Git/mingw64/libexec/git-core/git-sh-i18n'
+++ TEXTDOMAIN=git
+++ export TEXTDOMAIN
+++ test -z ''
+++ TEXTDOMAINDIR=/mingw64/share/locale
+++ export TEXTDOMAINDIR
+++ GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
+++ test -n ''
+++ test -n fallthrough
+++ GIT_INTERNAL_GETTEXT_SH_SCHEME=fallthrough
+++ export GIT_INTERNAL_GETTEXT_SH_SCHEME
+++ case "$GIT_INTERNAL_GETTEXT_SH_SCHEME" in
++ GIT_QUIET=
++ test -n ''
++ dashless=
++ '[' -z '' ']'
+++ eval_gettext 'usage: $dashless $USAGE'
+++ printf %s 'usage: $dashless $USAGE'
++++ git sh-i18n--envsubst --variables 'usage: $dashless $USAGE'
+++ export PATH dashless USAGE
+++ git sh-i18n--envsubst 'usage: $dashless $USAGE'
++ LONG_USAGE='usage: '
++ case "$1" in
++ case $(uname -s) in
+++ uname -s
++ test -x /usr/bin/sort
++ test -x /usr/bin/find
++ type builtin
++ test -z ''
++ git_dir_init
+++ git rev-parse --git-dir
++ GIT_DIR=.git
++ '[' -z '' ']'
+++ git rev-parse --show-cdup
++ test -z ''
++ test -n .git
+++ cd .git
+++ pwd
+++ builtin pwd -W
++ GIT_DIR=G:/05-code/04-C#/hotelSelfSys/.git
+++ git rev-parse --git-path objects
++ : .git/objects
+ require_work_tree
++ git rev-parse --is-inside-work-tree
+ test true = true
+ quiet=
+ branch=
+ debug=
+ command=
+ onto=
+ rejoin=
+ ignore_joins=
+ annotate=
+ squash=
+ message=
+ prefix=
+ echo 'Options: add -P HSSCore HSSCore master'
Options: add -P HSSCore HSSCore master
+ test 5 -gt 0
+ opt=add
+ shift
+ case "$opt" in
+ die 'Unexpected option: add'
+ die_with_status 1 'Unexpected option: add'
+ status=1
+ shift
+ printf '%s\n' 'Unexpected option: add'
Unexpected option: add
+ exit 1
Setup
Hopefully, no.
Details
Bash
I add
echo "Options: $*"
in line 80 ofC:\Program Files\Git\mingw64\libexec\git-core\git-subtree
operation success.
operation failed.
I ran same command succeed on Linux, so I modified this command and run success according to Options output on Linux
Modified Command and Operation Output:
Command and Operation Output on Linux