Re: To graft or not to graft... (Re: Recovering from repository corruption)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jeff King <peff@...>
Cc: <git@...>, Linus Torvalds <torvalds@...>, Stephen R. van den Berg <srb@...>, Denis Bueno <dbueno@...>
Date: Thursday, June 12, 2008 - 6:21 am

On Thursday 12 June 2008, Jeff King wrote:

Correct. My point is that if you want to talk to people about revisions, 
you'd better do it from a repo where people agree on the entire 
history. On the other hand, if you want to do archaeology with grafts, 
you should be aware that you are subverting one of the core guarantees 
provided by Git (i.e. a commit id verifies full ancestry of a commit), 
and therefore shouldn't communicate with other repos _at_ _all_, as 
other repos can easily be confused (see [1]).


Yes, by forcing git-filter-branch, you can no longer push/pull to/from 
such a historical repo. But as this thread has already demonstrated, 
with grafts you can't clone from such a repo today (nor pull in certain 
circumstances, see [1]); so the way I see it, communication with this 
repo is _already_ limited. By disallowing grafts and forcing a rewrite 
of the entire repo, we force these communication problems to be more 
explicit/visible.


Indeed. :)

AFAICS, there's two use cases for grafts:
1. As a preparation for rewriting the history with git-filter-branch.
2. For providing historical repos (like you mention above).

My suggestion only makes life harder for people in the second use case.
If there are many people in the second use case, and they deem 
the "follow-grafts" config option unacceptable, I expect them to flame 
my suggestion to a crisp, and we'll have to think of something else...


Have fun! :)

...Johan

[1]: Consider the following:

### Create a repo with one commit, A
$ mkdir foo
$ cd foo
$ git init
Initialized empty Git repository in /path/to/foo/.git/
$ echo foo > foo
$ git add foo
$ git commit -mA
Created initial commit fe2ec02: A
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 foo
### Clone the repo
$ cd ..
$ git clone /path/to/foo bar
Initialize bar/.git
Initialized empty Git repository in /path/to/bar/.git/
### Create 3 more commits in the original repo: A---B---C---D
$ cd foo
$ echo bar >> foo && git commit -a -mB
Created commit ad10f00: B
 1 files changed, 1 insertions(+), 0 deletions(-)
$ echo baz >> foo && git commit -a -mC
Created commit be96559: C
 1 files changed, 1 insertions(+), 0 deletions(-)
$ echo xyzzy >> foo && git commit -a -mD
Created commit f2bafe5: D
 1 files changed, 1 insertions(+), 0 deletions(-)
### Create a graft removing C from the history: A---B---D
$ echo "f2bafe58175e132077285e7fbbcec30859101d2e \ 
ad10f005205f61429dccda95e1442dabe31fbfbe" > .git/info/grafts
### Pull the recent changes into the clone
$ cd ../bar
$ git pull
remote: Counting objects: 8, done.
remote: Compressing objects: 100% (2/2), done.
Unpacking objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 0 (delta 0)
error: Could not read be965599d99192f624b8d8bbf3cab412872586fc
From /path/to/foo/
 + fe2ec02...f2bafe5 master     -> origin/master  (forced update)
error: Could not read be965599d99192f624b8d8bbf3cab412872586fc
error: Could not read be965599d99192f624b8d8bbf3cab412872586fc
Auto-merged foo
CONFLICT (add/add): Merge conflict in foo
Automatic merge failed; fix conflicts and then commit the result.

AFAICS, git-pull can easily become just as confused by grafts as 
git-clone. I wouldn't be surprised by a similar example for git-push.

I can only draw the conclusion that with current versions of Git, repos 
with grafts should _never_ be made public.

-- 
Johan Herland, <johan@herland.net>
www.herland.net
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Recovering from repository corruption, Denis Bueno, (Tue Jun 10, 1:26 pm)
Re: Recovering from repository corruption, Nicolas Pitre, (Tue Jun 10, 3:40 pm)
Re: Recovering from repository corruption, Denis Bueno, (Tue Jun 10, 3:42 pm)
Re: Recovering from repository corruption, Jakub Narebski, (Tue Jun 10, 1:55 pm)
Re: Recovering from repository corruption, Denis Bueno, (Tue Jun 10, 3:38 pm)
Re: Recovering from repository corruption, Jakub Narebski, (Tue Jun 10, 3:59 pm)
Re: Recovering from repository corruption, Denis Bueno, (Tue Jun 10, 4:03 pm)
Re: Recovering from repository corruption, Linus Torvalds, (Tue Jun 10, 4:23 pm)
Re: Recovering from repository corruption, Denis Bueno, (Tue Jun 10, 4:28 pm)
Re: Recovering from repository corruption, Linus Torvalds, (Tue Jun 10, 5:09 pm)
To graft or not to graft... (Re: Recovering from repository ..., Stephen R. van den Berg, (Wed Jun 11, 7:21 pm)
Re: To graft or not to graft... (Re: Recovering from reposit..., Johan Herland, (Thu Jun 12, 6:21 am)
Re: To graft or not to graft... (Re: Recovering from reposit..., Stephen R. van den Berg, (Thu Jun 12, 8:20 am)
Re: Recovering from repository corruption, Junio C Hamano, (Tue Jun 10, 6:52 pm)
Re: Recovering from repository corruption, Denis Bueno, (Tue Jun 10, 5:27 pm)
Re: Recovering from repository corruption, Denis Bueno, (Tue Jun 10, 5:22 pm)
Re: Recovering from repository corruption, Linus Torvalds, (Tue Jun 10, 5:48 pm)
Re: Recovering from repository corruption, Denis Bueno, (Tue Jun 10, 6:09 pm)
Re: Recovering from repository corruption, Linus Torvalds, (Tue Jun 10, 6:45 pm)
Re: Recovering from repository corruption, Nicolas Pitre, (Tue Jun 10, 8:43 pm)
Re: Recovering from repository corruption, Linus Torvalds, (Tue Jun 10, 9:39 pm)
Re: Recovering from repository corruption, Nicolas Pitre, (Tue Jun 10, 9:47 pm)
Re: Recovering from repository corruption, Linus Torvalds, (Tue Jun 10, 7:00 pm)
Re: Recovering from repository corruption, Tarmigan, (Tue Jun 10, 6:25 pm)
Re: Recovering from repository corruption, Denis Bueno, (Tue Jun 10, 6:41 pm)
Re: Recovering from repository corruption, Jakub Narebski, (Tue Jun 10, 4:14 pm)
Re: Recovering from repository corruption, Denis Bueno, (Tue Jun 10, 4:35 pm)