forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 141
subtree: Fix handling of complex history #493
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
Open
tqc
wants to merge
7
commits into
gitgitgadget:maint
Choose a base branch
from
tqc:tqc/subtree
base: maint
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9cff2a0
subtree: handle multiple parents passed to cache_miss
tqc 79b5f4a
subtree: exclude commits predating add from recursive processing
tqc 8eec183
subtree: persist cache between split runs
tqc 1490ce1
subtree: add git subtree map command
tqc 2d10329
subtree: add git subtree use and ignore commands
tqc a7aaedf
subtree: more robustly distinguish subtree and mainline commits
tqc fe2e481
subtree: document new subtree commands
tqc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,13 +238,13 @@ cache_miss () { | |
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, Johannes Schindelin wrote (reply to this):
|
||
|
||
check_parents () { | ||
missed=$(cache_miss "$1") | ||
missed=$(cache_miss $1) | ||
local indent=$(($2 + 1)) | ||
for miss in $missed | ||
do | ||
if ! test -r "$cachedir/notree/$miss" | ||
then | ||
debug " incorrect order: $miss" | ||
debug " unprocessed parent commit: $miss ($indent)" | ||
process_split_commit "$miss" "" "$indent" | ||
fi | ||
done | ||
|
@@ -392,6 +392,24 @@ find_existing_splits () { | |
done | ||
} | ||
|
||
find_mainline_ref () { | ||
debug "Looking for first split..." | ||
dir="$1" | ||
revs="$2" | ||
|
||
git log --reverse --grep="^git-subtree-dir: $dir/*\$" \ | ||
--no-show-signature --pretty=format:'START %H%n%s%n%n%b%nEND%n' $revs | | ||
while read a b junk | ||
do | ||
case "$a" in | ||
git-subtree-mainline:) | ||
echo "$b" | ||
return | ||
;; | ||
esac | ||
done | ||
} | ||
|
||
copy_commit () { | ||
# We're going to set some environment vars here, so | ||
# do it in a subshell to get rid of them safely later | ||
|
@@ -646,9 +664,9 @@ process_split_commit () { | |
|
||
progress "$revcount/$revmax ($createcount) [$extracount]" | ||
|
||
debug "Processing commit: $rev" | ||
debug "Processing commit: $rev ($indent)" | ||
exists=$(cache_get "$rev") | ||
if test -n "$exists" | ||
if test -z "$(cache_miss "$rev")" | ||
then | ||
debug " prior: $exists" | ||
return | ||
|
@@ -773,6 +791,17 @@ cmd_split () { | |
|
||
unrevs="$(find_existing_splits "$dir" "$revs")" | ||
|
||
mainline="$(find_mainline_ref "$dir" "$revs")" | ||
if test -n "$mainline" | ||
then | ||
debug "Mainline $mainline predates subtree add" | ||
git rev-list --topo-order --skip=1 $mainline | | ||
while read rev | ||
do | ||
cache_set "$rev" "" | ||
done || exit $? | ||
fi | ||
|
||
# We can't restrict rev-list to only $dir here, because some of our | ||
# parents have the $dir contents the root, and those won't match. | ||
# (and rev-list --follow doesn't seem to solve this) | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the Git mailing list, Ed Maste wrote (reply to this):