• Icon: Bug Bug
    • Resolution: Tracked Elsewhere
    • Icon: Medium Medium
    • None
    • 1.8.0.2
    • None
    • None
    • Mac OSX 10.8.5
      Embedded Git 1.8.4.2
      System Git 1.8.3.4 (for command line uses)

      I can't add a new subtree or link to an existing subtree.

      The repositories are on Bitbucket (sorry I can't put a link to them, they're private. If it's necessary I can create fake repos).

      If I try to add a new subtree on a non-existing folder, Sourcetree asks for my password, I enter it, and later I get these errors:

      -------------------------------------------------------------------------------------

      git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Users/sergidiaz/Desarrollo/XXX-for-android/jni/Test https://sergidiaz@bitbucket.org/YYY/XXX-for-ios.git master

      2013-12-13 13:02:29.146 git-credential-sourcetree[8201:707] Error (internetKeychainItemForServer:withUsername:path:port:protocol - The specified item could not be found in the keychain.

      From https://bitbucket.org/YYY/XXX-for-ios

      • branch master -> FETCH_HEAD

      error: Invalid path '/Users/sergidiaz/Desarrollo/XXX-for-android/jni/Test/.gitignore'

      error: Invalid path '/Users/sergidiaz/Desarrollo/XXX-for-android/jni/Test/.gitmodules'

      error: Invalid path '/Users/sergidiaz/Desarrollo/XXX-for-android/jni/Test/3D Assets/Balon.FBX'

      error: Invalid path '/Users/sergidiaz/Desarrollo/XXX-for-android/jni/Test/3D Assets/CAMP.mesh'

      (More Invalid path errors, one for each file...)

      error: pathspec 'jni/Test' did not match any file(s) known to git.

      Completed with errors, see above

      -------------------------------------------------------------------------------------

      If I create the folder I simply get a "prefix already exists" error.

      If I create a subtree using the command line, following this guide from your own blog (http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/) and then I try to link to it, I get the same "prefix already exists" error.

            [SRCTREE-2000] Can't add or link a subtree

            Thanks. (I'll wait for the update in SourceTree)

            joostfontein added a comment - Thanks. (I'll wait for the update in SourceTree)

            KieranA added a comment -

            Hey Joost,

            The associated issue for squash is SRCTREE-2024.

            To get subtree working on the command line you'll want to follow this guide: http://engineeredweb.com/blog/how-to-install-git-subtree/

            Cheers!

            KieranA added a comment - Hey Joost, The associated issue for squash is SRCTREE-2024 . To get subtree working on the command line you'll want to follow this guide: http://engineeredweb.com/blog/how-to-install-git-subtree/ Cheers!

            Hi Kieran,

            Can I track somewhere what the status is of feature request to add 'squash' commits on adding a subtree?

            For the meanwhile: How do I use commandline and include "--squash" in the command line? (I'm not into command line at all ...)

            • I clicked Terminal
            • Terminal went to correct directory
            • I entered:
              "git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree pull -P dev3 --squash git@bitbucket.org:username/reponame.git master"
            • Terminal responded:
              git: 'subtree' is not a git command. See 'git --help'.
            • When I do git --version:
              1.8.0

            joostfontein added a comment - Hi Kieran, Can I track somewhere what the status is of feature request to add 'squash' commits on adding a subtree? For the meanwhile: How do I use commandline and include "--squash" in the command line? (I'm not into command line at all ...) I clicked Terminal Terminal went to correct directory I entered: "git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree pull -P dev3 --squash git@bitbucket.org:username/reponame.git master" Terminal responded: git: 'subtree' is not a git command. See 'git --help'. When I do git --version: 1.8.0

            Case A: yes I used SourceTree. Tried again => same results.
            (Well ... case B works. So think that is fine for now).

            Case B:
            OK. That would be nice!

            joostfontein added a comment - Case A: yes I used SourceTree. Tried again => same results. (Well ... case B works. So think that is fine for now). Case B: OK. That would be nice!

            KieranA added a comment -

            Hey Joost,

            In case A, did you add the subtree using SourceTree? Are you sure it's named 'dev2'?

            As for case B, there's a feature request open to add 'squash' commits on adding a subtree.

            Cheers

            KieranA added a comment - Hey Joost, In case A, did you add the subtree using SourceTree? Are you sure it's named 'dev2'? As for case B, there's a feature request open to add 'squash' commits on adding a subtree. Cheers

            Case A
            After adding the subtree, I did a pull with this result:
            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree pull -P dev2 --squash git@bitbucket.org:XXXX/YYYY.git master
            From bitbucket.org:org:XXXX/YYYY

            • branch master -> FETCH_HEAD
              Can't squash-merge: 'dev2' was never added.
              Completed with errors, see above

            If I do a pull without squash commits, it does pull. However, all files appear in the root of the repo; not in dev2.. (Specifying the LocalRelativePath like dev2/, /dev2 or /dev2/ doesn't help)

            Case B
            Does work. However, when adding the subtree, it immediately does a pull. There is no option to ask for "squash commits", so it ends up with a complete list of commits..

            joostfontein added a comment - Case A After adding the subtree, I did a pull with this result: git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree pull -P dev2 --squash git@bitbucket.org:XXXX/YYYY.git master From bitbucket.org:org:XXXX/YYYY branch master -> FETCH_HEAD Can't squash-merge: 'dev2' was never added. Completed with errors, see above If I do a pull without squash commits, it does pull. However, all files appear in the root of the repo; not in dev2.. (Specifying the LocalRelativePath like dev2/, /dev2 or /dev2/ doesn't help) Case B Does work. However, when adding the subtree, it immediately does a pull. There is no option to ask for "squash commits", so it ends up with a complete list of commits..

            KieranA added a comment -

            If you don't mind I'm going to close this and link it to the issue that's aimed at fixing it. All the information in this issue will be used though to get some sort of fix implemented to stop users from using absolute paths or paths that are outside the scope of the repository.

            Cheers

            KieranA added a comment - If you don't mind I'm going to close this and link it to the issue that's aimed at fixing it. All the information in this issue will be used though to get some sort of fix implemented to stop users from using absolute paths or paths that are outside the scope of the repository. Cheers

            KieranA added a comment -

            My test cases:

            Case A
            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Volumes/OTHER/Sparkle/Test https://Kezzer@bitbucket.org/Kezzer/testing.git master 
            prefix '/Volumes/OTHER/Sparkle/Test' already exists.
            Completed with errors, see above
            

            Easy to reproduce. Paths should always be relative. The prefix you've used in this case is absolute. Admittedly this is a fault of the file picker that's used which will, when choosing certain directories, use the full absolute path. To fix this problem, just use the local relative path (local to the repo).

            Case B
            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Volumes/OTHER/Sparkle/Blah https://Kezzer@bitbucket.org/Kezzer/testing.git master 
            From https://bitbucket.org/Kezzer/testing
             * branch            master     -> FETCH_HEAD
            error: Invalid path '/Volumes/OTHER/Sparkle/Blah/.gitmodules'
            error: Invalid path '/Volumes/OTHER/Sparkle/Blah/apowdj.markdown'
            error: Invalid path '/Volumes/OTHER/Sparkle/Blah/submod'
            error: pathspec 'Blah' did not match any file(s) known to git.
            git fetch https://Kezzer@bitbucket.org/Kezzer/testing.git master
            Completed with errors, see above
            

            Again, easy to reproduce because of the non-relative path that's used. Git is executing in the context of the repository, so just use a relative path. Here's the output when using a relative path instead:

            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P Blah https://Kezzer@bitbucket.org/Kezzer/testing.git master 
            From https://bitbucket.org/Kezzer/testing
             * branch            master     -> FETCH_HEAD
            Added dir 'Blah'
            git fetch https://Kezzer@bitbucket.org/Kezzer/testing.git master
            Completed successfully
            

            As a result of these findings I'm assuming we could produce a warning for absolute paths. The same problem would occur if you would do it at the terminal in effect. It's just because of the context in which Git is running, and expecting paths relative to itself. Git doesn't know where the current repository it's running from could be located. This is why absolute paths are no good, you can move repositories around wherever you want, at which point the paths will break.

            I think we need to turn this into a feature request to firstly warn users about using absolute paths and secondly try and get that folder picker to use relative paths where possible.

            KieranA added a comment - My test cases: Case A git -c diff.mnemonicprefix= false -c core.quotepath= false -c credential.helper=sourcetree subtree add -P /Volumes/OTHER/Sparkle/Test https: //Kezzer@bitbucket.org/Kezzer/testing.git master prefix '/Volumes/OTHER/Sparkle/Test' already exists. Completed with errors, see above Easy to reproduce. Paths should always be relative . The prefix you've used in this case is absolute. Admittedly this is a fault of the file picker that's used which will, when choosing certain directories, use the full absolute path. To fix this problem, just use the local relative path (local to the repo). Case B git -c diff.mnemonicprefix= false -c core.quotepath= false -c credential.helper=sourcetree subtree add -P /Volumes/OTHER/Sparkle/Blah https: //Kezzer@bitbucket.org/Kezzer/testing.git master From https: //bitbucket.org/Kezzer/testing * branch master -> FETCH_HEAD error: Invalid path '/Volumes/OTHER/Sparkle/Blah/.gitmodules' error: Invalid path '/Volumes/OTHER/Sparkle/Blah/apowdj.markdown' error: Invalid path '/Volumes/OTHER/Sparkle/Blah/submod' error: pathspec 'Blah' did not match any file(s) known to git. git fetch https: //Kezzer@bitbucket.org/Kezzer/testing.git master Completed with errors, see above Again, easy to reproduce because of the non-relative path that's used. Git is executing in the context of the repository, so just use a relative path. Here's the output when using a relative path instead: git -c diff.mnemonicprefix= false -c core.quotepath= false -c credential.helper=sourcetree subtree add -P Blah https: //Kezzer@bitbucket.org/Kezzer/testing.git master From https: //bitbucket.org/Kezzer/testing * branch master -> FETCH_HEAD Added dir 'Blah' git fetch https: //Kezzer@bitbucket.org/Kezzer/testing.git master Completed successfully As a result of these findings I'm assuming we could produce a warning for absolute paths. The same problem would occur if you would do it at the terminal in effect. It's just because of the context in which Git is running, and expecting paths relative to itself. Git doesn't know where the current repository it's running from could be located. This is why absolute paths are no good, you can move repositories around wherever you want, at which point the paths will break. I think we need to turn this into a feature request to firstly warn users about using absolute paths and secondly try and get that folder picker to use relative paths where possible.

            I get the same types of errors, only my drive is my local hard drive, not a network drive.

            I've tried it all the ways I can think of, but currently I have it setup via the command line as described here:
            http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/

            When I try to make the link in sourcetree I get this error message:

            git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Users/XXX/Code/XXX-test/assets/XXX_components/XXX https://XXX@bitbucket.org/XXX/XXX.git master
            prefix '/Users/XXX/Code/XXX-test/assetsXXX_components/XXX' already exists.
            Completed with errors, see above

            Peter Murphy added a comment - I get the same types of errors, only my drive is my local hard drive, not a network drive. I've tried it all the ways I can think of, but currently I have it setup via the command line as described here: http://blogs.atlassian.com/2013/05/alternatives-to-git-submodule-git-subtree/ When I try to make the link in sourcetree I get this error message: git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree subtree add -P /Users/XXX/Code/XXX-test/assets/XXX_components/XXX https://XXX@bitbucket.org/XXX/XXX.git master prefix '/Users/XXX/Code/XXX-test/assetsXXX_components/XXX' already exists. Completed with errors, see above

            It's a virtual drive. I use an encrypted file that is mounted as volume using TrueCrypt.

            joostfontein added a comment - It's a virtual drive. I use an encrypted file that is mounted as volume using TrueCrypt.

              Unassigned Unassigned
              4ebd4a7a51c7 Sergi Díaz
              Affected customers:
              1 This affects my team
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: