Skip to contentSkip to conversation

git-clone -s: document problems with git gc --prune

PATCH In review Miklos Vajna 2 participants 3 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 git-clone -s: document problems with git gc --prune

There is a scenario when using git clone -s and git gc --prune togother is dangerous. Document this.

---

I see people on #git regularly who do not know about this option can cause problems, so I think it's important to document this.

 Documentation/git-clone.txt |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Documentation/git-clone.txt +6 -0
index fdccbd4..5c4d936 100644
@@ -62,6 +62,12 @@ OPTIONS
 	.git/objects/info/alternates to share the objects
 	with the source repository.  The resulting repository
 	starts out without any object of its own.
+	*NOTE*: this is a possibly dangerous operation; do *not* use
+	it unless you understand what it does. If you clone your
+	repository using this option, you delete branches in the
+	source repository and you run linkgit:git-gc[1] using the
+	`--prune` option, then it will remove objects which are
+	referenced ones in the target repository!
 
 --reference <repository>::
 	If the reference repository is on the local machine
Signature · 1 line
1.5.4.rc3.4.g16335-dirty
#1 lore raw
Quoted 17 lines · Miklos Vajna

There is a scenario when using git clone -s and git gc --prune togother is dangerous. Document this.

---

I see people on #git regularly who do not know about this option can cause problems, so I think it's important to document this.

 Documentation/git-clone.txt |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Documentation/git-clone.txt +0 -0
index fdccbd4..5c4d936 100644

Documentation/git-clone.txt OPTIONS · line 70

Quoted 9 lines
Documentation/git-clone.txt +6 -0
@@ -62,6 +62,12 @@ OPTIONS
 	.git/objects/info/alternates to share the objects
 	with the source repository.  The resulting repository
 	starts out without any object of its own.
+	*NOTE*: this is a possibly dangerous operation; do *not* use
+	it unless you understand what it does. If you clone your
+	repository using this option, you delete branches in the
+	source repository and you run linkgit:git-gc[1] using the
+	`--prune` option, then it will remove objects which are
+	referenced ones in the target repository!

I find that second sentence hard to understand. Maybe:

If you clone your repository using this option, then delete branches in the source repository and then run linkgit:git-gc[1] using the '--prune' option in the source repository, it may remove objects which are referenced by the cloned repository.

-brandon

#2 lore raw

PATCH 1/1 git-clone -s: document problems with git gc --prune

There is a scenario when using git clone -s and git gc --prune togother is dangerous. Document this.

---

Quoted 6 lines · Brandon Casey

I find that second sentence hard to understand. Maybe:

If you clone your repository using this option, then delete branches in the source repository and then run linkgit:git-gc[1] using the '--prune' option in the source repository, it may remove objects which are referenced by the cloned repository.

Here is the re-worded version.

 Documentation/git-clone.txt |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
Documentation/git-clone.txt +8 -0
index fdccbd4..2341881 100644
@@ -62,6 +62,14 @@ OPTIONS
 	.git/objects/info/alternates to share the objects
 	with the source repository.  The resulting repository
 	starts out without any object of its own.
+	*NOTE*: this is a possibly dangerous operation; do *not* use
+	it unless you understand what it does. If you clone your
+	repository using this option, then delete branches in the
+	source repository and then run linkgit:git-gc[1] using the
+	'--prune' option in the source repository, it may remove
+	objects which are referenced by the cloned repository.
+
+
 
 --reference <repository>::
 	If the reference repository is on the local machine
Signature · 1 line
1.5.4.rc3.4.g16335-dirty