forked from importers/git-importer
		
	Compare commits
	
		
			3 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 1ec72ac80c | ||
|  | 033b8f8cee | ||
|  | aa73d97b35 | 
| @@ -85,7 +85,7 @@ class Git: | |||||||
|         """Checkout into the branch HEAD""" |         """Checkout into the branch HEAD""" | ||||||
|         new_branch = False |         new_branch = False | ||||||
|         if branch not in self.branches(): |         if branch not in self.branches(): | ||||||
|             self.git_run(["branch", "-q", branch, "HEAD"]) |             self.git_run(["switch", "-q", "--orphan", branch]) | ||||||
|             new_branch = True |             new_branch = True | ||||||
|         else: |         else: | ||||||
|             ref = f"refs/heads/{branch}" |             ref = f"refs/heads/{branch}" | ||||||
| @@ -182,6 +182,12 @@ class Git: | |||||||
|     def add(self, filename): |     def add(self, filename): | ||||||
|         self.git_run(["add", filename]) |         self.git_run(["add", filename]) | ||||||
|  |  | ||||||
|  |     def add_default_gitignore(self): | ||||||
|  |         if not (self.path / ".gitignore").exists(): | ||||||
|  |             with (self.path / ".gitignore").open("w") as f: | ||||||
|  |                 f.write(".osc\n") | ||||||
|  |             self.add(".gitignore") | ||||||
|  |  | ||||||
|     def add_default_lfs_gitattributes(self, force=False): |     def add_default_lfs_gitattributes(self, force=False): | ||||||
|         if not (self.path / ".gitattributes").exists() or force: |         if not (self.path / ".gitattributes").exists() or force: | ||||||
|             with (self.path / ".gitattributes").open("w") as f: |             with (self.path / ".gitattributes").open("w") as f: | ||||||
|   | |||||||
| @@ -150,6 +150,7 @@ class GitExporter: | |||||||
|  |  | ||||||
|         # create file if not existant |         # create file if not existant | ||||||
|         self.git.add_default_lfs_gitattributes(force=False) |         self.git.add_default_lfs_gitattributes(force=False) | ||||||
|  |         self.git.add_default_gitignore() | ||||||
|  |  | ||||||
|         to_download, to_delete = flat.commit.calc_delta(branch_state[flat.branch]) |         to_download, to_delete = flat.commit.calc_delta(branch_state[flat.branch]) | ||||||
|         for file in to_delete: |         for file in to_delete: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user