From 7073e69e382bc8247c28859d8b0eda2612cd6b94 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 6 Feb 2007 16:08:06 -0500 Subject: Don't do non-fastforward updates in fast-import. If fast-import is being used to update an existing branch of a repository, the user may not want to lose commits if another process updates the same ref at the same time. For example, the user might be using fast-import to make just one or two commits against a live branch. We now perform a fast-forward check during the ref updating process. If updating a branch would cause commits in that branch to be lost, we skip over it and display the new SHA1 to standard error. This new default behavior can be overridden with `--force`, like git-push and git-fetch. Signed-off-by: Shawn O. Pearce --- Documentation/git-fast-import.txt | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'Documentation/git-fast-import.txt') diff --git a/Documentation/git-fast-import.txt b/Documentation/git-fast-import.txt index 08450de9ac..2be6c4b807 100644 --- a/Documentation/git-fast-import.txt +++ b/Documentation/git-fast-import.txt @@ -38,6 +38,11 @@ OPTIONS See ``Date Formats'' below for details about which formats are supported, and their syntax. +--force:: + Force updating modified existing branches, even if doing + so would cause commits to be lost (as the new commit does + not contain the old commit). + --max-pack-size=:: Maximum size of each output packfile, expressed in MiB. The default is 4096 (4 GiB) as that is the maximum allowed @@ -92,11 +97,18 @@ run alongside parallel `git repack -a -d` or `git gc` invocations, or any other Git operation (including `git prune`, as loose objects are never used by gfi). -However, gfi does not lock the branch or tag refs it is actively -importing. After EOF, during its ref update phase, gfi blindly -overwrites each imported branch or tag ref. Consequently it is not -safe to modify refs that are currently being used by a running gfi -instance, as work could be lost when gfi overwrites the refs. +gfi does not lock the branch or tag refs it is actively importing. +After the import, during its ref update phase, gfi tests each +existing branch ref to verify the update will be a fast-forward +update (the commit stored in the ref is contained in the new +history of the commit to be written). If the update is not a +fast-forward update, gfi will skip updating that ref and instead +prints a warning message. gfi will always attempt to update all +branch refs, and does not stop on the first failure. + +Branch updates can be forced with `--force`, but its recommended that +this only be used on an otherwise quiet repository. Using `--force` +is not necessary for an initial import into an empty repository. Technical Discussion -- cgit v1.2.1