Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svn externals replacement #6

Closed
andry81 opened this issue Dec 30, 2022 · 17 comments
Closed

svn externals replacement #6

andry81 opened this issue Dec 30, 2022 · 17 comments

Comments

@andry81
Copy link

andry81 commented Dec 30, 2022

In svn you can reference a subdirectory in an external:

/ project-X
|
+---/ _externals
|   |
|   +---/ project-A
|       |
|       +---/ DirA1
|       +---/ DirA2
|       +---/ DirA3
|
+---/ DirX1
+---/ DirX2
+---/ DirX3
+---/ DirX4
+---/ DirX5

/ project-A
|
+---/ _externals
|   |
|   +---/ project-X
|       |
|       +---/ DirX3
|       +---/ DirX4
|       +---/ DirX5
|
+---/ DirA1
+---/ DirA2
+---/ DirA3
+---/ DirA4
+---/ DirA5

/project-X/_externals

svn-url-to-project-A project-A/DirA1
svn-url-to-project-A project-A/DirA2
svn-url-to-project-A project-A/DirA3

/project-A/_externals

svn-url-to-project-X project-X/DirX3
svn-url-to-project-X project-X/DirX4
svn-url-to-project-X project-X/DirX5

.gitlinks in project-X:

project-A _externals/project-X git-url-to-project-X master

.gitlinks in project-A:

project-X _externals/project-A git-url-to-project-A master

But how to checkout not all directories in each external (sparse checkout)?

@andry81
Copy link
Author

andry81 commented Jan 7, 2023

Seems w/o sparse checkout support (https://git-scm.com/docs/git-sparse-checkout) or w/o a custom method of checkout w/o builtin recursion, there is currently no way to use recursed submodules (gil update with links creation). Without links creation there is another issues with gil pull.

#7 #8 #9 #10 #11

Conclusion

Side issues

But issues with the GitExtensions can be ignored.

@chronoxor
Copy link
Owner

Can you prepare a minimal public repository structure that reproduces all the issues? So I can check them on my side

@andry81
Copy link
Author

andry81 commented Jan 8, 2023

Can you prepare a minimal public repository structure that reproduces all the issues? So I can check them on my side

First simple tests: #11 (comment)

@chronoxor
Copy link
Owner

chronoxor commented Jan 8, 2023

Please try https://github.com/chronoxor/gil-test1-root

git clone https://github.com/chronoxor/gil-test1-root.git
cd gil-test1-root
gil update
gil status

@andry81
Copy link
Author

andry81 commented Jan 8, 2023

Please try chronoxor/gil-test1-root

git clone https://github.com/chronoxor/gil-test1-root.git
cd gil-test1-root
gil update
gil status

That is a different project. In mine case A has B as a dependency, when B has A. There is no 3d one. And this is not recursive in SVN, because were taken sudirectories, not the externals. Now I want to port SVN into GIT.

And that is wrong, _externals must exist, there is no sense to ignore it.

A -> B

Externals of A must exist, when externals of B in A may not. The same for B -> A.

@chronoxor
Copy link
Owner

You can have tree-based projects dependency explicitly:

  • A
  • B->A
  • C->A
    C->B->A

If you want to have cycles projects dependencies, you have to place them under some root project and put root .gitlinks in it:

  • A->B
  • B->A
  • C->A->B->A->....
    C->B->A->B->....
  • ROOT->A
    ROOT->B
    ROOT->C

That's how gil tool works now

@andry81
Copy link
Author

andry81 commented Jan 8, 2023

  • ROOT->A
    ROOT->B
    ROOT->C

You have used _externals/* in .gitignore in case of https://github.com/chronoxor/gil-test1-root.git. I didn't want to ignore it.

@chronoxor
Copy link
Owner

Linked externals should be ignored if you commit in the current repository with git commit command. However you could commit with gil commit command - as the result all changes in the current repository and all linked ones will be committed by checking dependencies in .gitlinks file.

@chronoxor
Copy link
Owner

The following commands are working for the whole linked structure:

  • gil pull [params]
  • gil push [params]
  • gil commit [params]
  • gil status [params]

@chronoxor
Copy link
Owner

My common workflow is to make changes in several linked projects, then go to the root and make global commit with

gil commit -a -m "Commit message"
gil push

@andry81
Copy link
Author

andry81 commented Jan 8, 2023

My common workflow is to make changes in several linked projects, then go to the root and make global commit with

gil commit -a -m "Commit message"
gil push

I don't like this method of committing. I use GitExtensions to make a commit and push. This is a convenient way to commit anything in git. First of all you see all unstaged items in the GUI and can run commands on them like the reset directly on selected items in unstaged area. At second, you see the difference file for each item from the changeset. At third, you have access to the history of commit messages and can amend with last commit message restore. Plus all other options and advantages. With the gil commit I don't have all of this.

@andry81
Copy link
Author

andry81 commented Jan 8, 2023

Linked externals should be ignored if you commit in the current repository with git commit command.

How you suppose to work like this? I have to maintain 2 working copies at the same time for each project? I have to copy all the local changes between 2 projects with and w/o externals before commit them. This is quite a ridiculous.

By the way, the sparse checkout automatically does ignore filtered paths (https://git-scm.com/docs/git-sparse-checkout):

This command is used to create sparse checkouts, which change the working tree from having all tracked files present to only having a subset of those files.
...
When in a sparse-checkout, other Git commands behave a bit differently. For example, switching branches will not update paths outside the sparse-checkout directories/patterns, and git commit -a will not record paths outside the sparse-checkout directories/patterns as deleted.
...
Since submodules may have unpushed changes or untracked files, removing them could result in data loss. Thus, changing sparse inclusion/exclusion rules will not cause an already checked out submodule to be removed from the working copy.

So if you would implement the sparse checkout then, it is better to convert .gitlinks into yaml structure like vcstool has, to be able to avoid submodules to be checked out by default.

Here is example of the sparse checkout in the vcstool:

dirk-thomas/vcstool#218
https://github.com/dirk-thomas/vcstool/pull/219/files

@chronoxor
Copy link
Owner

As your projects are linked with a symbolic link, you have only one place to update and commit (e.g. in A, or B->A which points to the same place as A).

@chronoxor
Copy link
Owner

chronoxor commented Jan 8, 2023

I also use TortoiseGit sometimes to review & commit, but you have to do it separately for each project you change (e.g. A and B).

@andry81
Copy link
Author

andry81 commented Jan 14, 2023

As your projects are linked with a symbolic link, you have only one place to update and commit (e.g. in A, or B->A which points to the same place as A).

I want a single place to commit from and I want to observe the dependencies at the same time. Better to back off the recursion at all so the links won't raise the problem.

I also use TortoiseGit sometimes to review & commit, but you have to do it separately for each project you change (e.g. A and B).

That was a bit bad idea because there is many git tools and IDEs which does call to git directly, so the script does interfere with them and interrupts the usage. I have to switch to GUI/tools and back to the script to make a simple commit or pull.
Of cause you can use the script once like to clone or to link, but deal with it each time you want to commit or pull is redundant. This just mine opinion.

PS: I've found another closest solution and updated the comment: #6 (comment)

@andry81
Copy link
Author

andry81 commented Jan 15, 2023

Just for instance. I have tried to promote one of the GitExt side issues and this is what they said:

gitextensions/gitextensions#10642 (comment)

You have a funky state and I doubt is supported as valid git state.

So just because git is detecting nested repo and helping you out in summary call, it is not a submodule. The modules file is required to actually work git submodules.

@andry81
Copy link
Author

andry81 commented Jan 23, 2023

Just for instance. Have sent questions into git folks mailing list:
https://lore.kernel.org/git/[email protected]/

andry81 added a commit to andry81/contools that referenced this issue Feb 11, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/svncmd that referenced this issue Feb 11, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/tacklelib that referenced this issue Feb 11, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/contools that referenced this issue Feb 15, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/tacklelib that referenced this issue Feb 20, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/contools that referenced this issue Feb 20, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/svncmd that referenced this issue Mar 5, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
@andry81 andry81 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 17, 2023
andry81 added a commit to andry81/tacklelib that referenced this issue Apr 4, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/contools that referenced this issue Apr 4, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/svncmd that referenced this issue Apr 4, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/contools that referenced this issue Apr 20, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/svncmd that referenced this issue Apr 20, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/tacklelib that referenced this issue Apr 20, 2023
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
andry81 added a commit to andry81/tacklelib that referenced this issue Feb 2, 2024
* changed: .externals: added usage of `vcstool` fork (https://github.com/plusone-robotics/vcstool) project to port `svn:externals` dependencies from svn into git
* changed: .gitlinks: removed usage of `git-links` (https://github.com/chronoxor/gil) project because found as not acceptable for usage: chronoxor/gil#6, https://lore.kernel.org/git/[email protected]
* changed: README.md: readme update
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants