Use Test Harness
Clean up the git-subtree tests to conform the git project conventions
and use the existing test harness.
Signed-off-by: David A. Greene <greened@obbligato.org>
Clean up the git-subtree tests to conform the git project conventions
and use the existing test harness.
Signed-off-by: David A. Greene <greened@obbligato.org>
Rename Test
Rename the subtree test file to conform with git project conventions.
Signed-off-by: David A. Greene <greened@obbligato.org>
Rename the subtree test file to conform with git project conventions.
Signed-off-by: David A. Greene <greened@obbligato.org>
Move Tests Into Subdirectory
Move the git-subtree tests into a "t" subdir to reflect how
testing works at the top level.
Signed-off-by: David A. Greene <greened@obbligato.org>
Move the git-subtree tests into a "t" subdir to reflect how
testing works at the top level.
Signed-off-by: David A. Greene <greened@obbligato.org>
Skip commit objects that should be trees, rather than copying them.
An improvement on the previous patch, based on more reports from Sum-Wai
Low.
An improvement on the previous patch, based on more reports from Sum-Wai
Low.
It's also okay if an expected tree object is actually a commit.
...that happens with submodules sometimes, so don't panic.
Reported by Sum-Wai Low.
...that happens with submodules sometimes, so don't panic.
Reported by Sum-Wai Low.
Added check to order of processed commits.
With debug messages enabled, "incorrect order" will be output whenever a
commit is processed before its parents have been processed. This can be
determined by checking to see if a parent isn't mapped to a new commit, but
it has been processed.
With debug messages enabled, "incorrect order" will be output whenever a
commit is processed before its parents have been processed. This can be
determined by checking to see if a parent isn't mapped to a new commit, but
it has been processed.
Split cmd now processes commits in topo order.
Added the "--topo-order" option to git rev-list. Without this, it seems that
the revision list is coming back in reverse order but it is sorted
chronologically. This does not gurantee that parent commits are handled
before child commits.
Added the "--topo-order" option to git rev-list. Without this, it seems that
the revision list is coming back in reverse order but it is sorted
chronologically. This does not gurantee that parent commits are handled
before child commits.
Fix a few typos/grammar-o's in the preceding commit.
docs: Description, synopsys, options and examples changes.
Description: Made the difference from submodules and the subtree
merge strategy clearer.
Synopsys and options: Synchronize with 'git subtree -h' output.
I hope, properly.
Examples: Added example descriptions in captions. Small fixes.
Signed-off-by: John Yani <vanuan@gmail.com>
Description: Made the difference from submodules and the subtree
merge strategy clearer.
Synopsys and options: Synchronize with 'git subtree -h' output.
I hope, properly.
Examples: Added example descriptions in captions. Small fixes.
Signed-off-by: John Yani <vanuan@gmail.com>
Fixing eval syntax error.
Fix typo: an -> a
Thanks to Vanuan on github.
Thanks to Vanuan on github.
docs: simplify example 1
The documentation was written prior to Wayne Walter's 2-parameter add.
Using 2-parameter add in example 1 makes the example much simpler.
The documentation was written prior to Wayne Walter's 2-parameter add.
Using 2-parameter add in example 1 makes the example much simpler.
Another fix for PATH and msysgit.
Evan Shaw tells me the previous fix didn't work. Let's use this one
instead, which he says does work.
This fix is kind of wrong because it will run the "correct" git-sh-setup
*after* the one in /usr/bin, if there is one, which could be weird if you
have multiple versions of git installed. But it works on my Linux and his
msysgit, so it's obviously better than what we had before.
Evan Shaw tells me the previous fix didn't work. Let's use this one
instead, which he says does work.
This fix is kind of wrong because it will run the "correct" git-sh-setup
*after* the one in /usr/bin, if there is one, which could be weird if you
have multiple versions of git installed. But it works on my Linux and his
msysgit, so it's obviously better than what we had before.
Merge remote branch 'origin/master'
* origin/master:
Fixed regression with splitting out new subtree
Use 'git merge -Xsubtree' when git version >= 1.7.0.
* origin/master:
Fixed regression with splitting out new subtree
Use 'git merge -Xsubtree' when git version >= 1.7.0.
(Hopefully) fix PATH setting for msysgit.
Reported by Evan Shaw. The problem is that $(git --exec-path) includes a
'git' binary which is incompatible with the one in /usr/bin; if you run it,
it gives you an error about libiconv2.dll.
You might think we could just add $(git --exec-path) at the *end* of PATH,
but then if there are multiple versions of git installed, we could end up
with the wrong one; earlier versions used to put git-sh-setup in /usr/bin,
so we'd pick up that one before the new one.
So now we just set PATH back to its original value right after running
git-sh-setup, and we should be okay.
Reported by Evan Shaw. The problem is that $(git --exec-path) includes a
'git' binary which is incompatible with the one in /usr/bin; if you run it,
it gives you an error about libiconv2.dll.
You might think we could just add $(git --exec-path) at the *end* of PATH,
but then if there are multiple versions of git installed, we could end up
with the wrong one; earlier versions used to put git-sh-setup in /usr/bin,
so we'd pick up that one before the new one.
So now we just set PATH back to its original value right after running
git-sh-setup, and we should be okay.
Fixed regression with splitting out new subtree
A folder in a repository that wasn't initially imported as a subtree could no longer be splitted into an entirely new subtree with no parent.
A fix and a new test to fix that regression is added here.
A folder in a repository that wasn't initially imported as a subtree could no longer be splitted into an entirely new subtree with no parent.
A fix and a new test to fix that regression is added here.
Use 'git merge -Xsubtree' when git version >= 1.7.0.
It's possible to specify the subdir of a subtree since Git 1.7.0 - adding
support for that functionality to make the merge more stable.
Also checking for git version - now only uses the new subtree subdir option
when on at least 1.7.
It's possible to specify the subdir of a subtree since Git 1.7.0 - adding
support for that functionality to make the merge more stable.
Also checking for git version - now only uses the new subtree subdir option
when on at least 1.7.
Added new 'push' command and 2-parameter form of 'add'.
Now you can do:
git subtree add --prefix=whatever git://wherever branchname
to add a new branch, instead of rather weirdly having to do 'git fetch'
first. You can also split and push in one step:
git subtree push --prefix=whatever git://wherever newbranch
(Somewhat cleaned up by apenwarr.)
Now you can do:
git subtree add --prefix=whatever git://wherever branchname
to add a new branch, instead of rather weirdly having to do 'git fetch'
first. You can also split and push in one step:
git subtree push --prefix=whatever git://wherever newbranch
(Somewhat cleaned up by apenwarr.)
Docs: cleaning up example textual redundancy
Signed-off-by: Dan Sabath <dsabath@whitepages.com>
Signed-off-by: Dan Sabath <dsabath@whitepages.com>
docs: add simple 'add' case to clarify setup.
This patch adds a simple use case for adding a library to an existing
repository.
Signed-off-by: Dan Sabath <dsabath@whitepages.com>
This patch adds a simple use case for adding a library to an existing
repository.
Signed-off-by: Dan Sabath <dsabath@whitepages.com>
Some recent tests accidentally depended on very new versions of git.
The "--format" option is too new. Use "--pretty=format:" (which means the
same thing) instead. Now it works again on git 1.6.0 (at least).
The "--format" option is too new. Use "--pretty=format:" (which means the
same thing) instead. Now it works again on git 1.6.0 (at least).
Oops. Apparently I didn't run 'make test' after most recent change.
Thanks to Dan Sabath for pointing that out.
Thanks to Dan Sabath for pointing that out.
Improve checking for existence of the --prefix directory.
For add, the prefix must *not* already exist. For all the other commands,
it *must* already exist.
For add, the prefix must *not* already exist. For all the other commands,
it *must* already exist.
Make sure that <prefix> exists when splitting.
And test cases for that check, as well as for an error if no prefix is
specified at all.
And test cases for that check, as well as for an error if no prefix is
specified at all.
Make tests pass with recent git (1.7.0 and up).
It seems that in older versions, --message="" was interpreted as "use the
default commit message" instead of "use an empty commit message", and
git-subtree was depending on this behaviour. Now we don't, so tests pass
again.
It seems that in older versions, --message="" was interpreted as "use the
default commit message" instead of "use an empty commit message", and
git-subtree was depending on this behaviour. Now we don't, so tests pass
again.
git-subtree.txt: add another example.
Jakub's changes broke the progress message slightly.
We really need that ^M (\r), not a ^J (\n) if we want the status message to
overwrite itself nicely.
We really need that ^M (\r), not a ^J (\n) if we want the status message to
overwrite itself nicely.
Merge branch 'master' of git://github.com/psionides/git-subtree
* 'master' of git://github.com/psionides/git-subtree:
improved rev_is_descendant_of_branch() function
added temporary test dirs to gitignore
added tests for recent changes
fixed bug in commit message for split
changed alias for --prefix from -p to -P
fix for subtree split not finding proper base for new commits
allow using --branch with existing branches if it makes sense
added -m/--message option for setting merge commit message
added -p alias for --prefix
* 'master' of git://github.com/psionides/git-subtree:
improved rev_is_descendant_of_branch() function
added temporary test dirs to gitignore
added tests for recent changes
fixed bug in commit message for split
changed alias for --prefix from -p to -P
fix for subtree split not finding proper base for new commits
allow using --branch with existing branches if it makes sense
added -m/--message option for setting merge commit message
added -p alias for --prefix
Fix refspecs in given example for git subtree pull.
(Updated slightly by apenwarr)
(Updated slightly by apenwarr)
improved rev_is_descendant_of_branch() function
added temporary test dirs to gitignore
added tests for recent changes
fixed bug in commit message for split
changed alias for --prefix from -p to -P
fix for subtree split not finding proper base for new commits
allow using --branch with existing branches if it makes sense
added -m/--message option for setting merge commit message
added -p alias for --prefix
Weird, I forgot to have 'make test' call test.sh.
make git version dynamic when building documentation
Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
add installation support to Makefile
Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Oops, forgot a COPYING file. It's GPLv2.
Thanks to Ben Walton for pointing this out.
Thanks to Ben Walton for pointing this out.
Add some tips for how to install.
cmd_pull didn't support --squash correctly.
We should implement it as
git fetch ...
git subtree merge ...
But we were instead just calling
git pull -s subtree ...
because 'git subtree merge' used to be just an alias for 'git merge -s
subtree', but it no longer is.
We should implement it as
git fetch ...
git subtree merge ...
But we were instead just calling
git pull -s subtree ...
because 'git subtree merge' used to be just an alias for 'git merge -s
subtree', but it no longer is.
Fix a minor problem in identifying squashes vs. normal splits.
This didn't seem to have any noticeable side effects other than
suspicious-looking log messages when you used -d.
This didn't seem to have any noticeable side effects other than
suspicious-looking log messages when you used -d.
If someone provides a --prefix that ends with slash, strip the slash.
Prefixes that differ only in the trailing slash should be considered
identical.
Also update the test to check that this works.
Prefixes that differ only in the trailing slash should be considered
identical.
Also update the test to check that this works.
Merge branch 'master' of git://github.com/voxpelli/git-subtree
* 'master' of git://github.com/voxpelli/git-subtree:
Check that the type of the tree really is a tree and not a commit as it seems to sometimes become when eg. a submodule has existed in the same position previously.
* 'master' of git://github.com/voxpelli/git-subtree:
Check that the type of the tree really is a tree and not a commit as it seems to sometimes become when eg. a submodule has existed in the same position previously.
Add a README that says to email me instead of using github mail.
What's with this new generation who hates email so much?
What's with this new generation who hates email so much?
Check that the type of the tree really is a tree and not a commit as it seems to sometimes become when eg. a submodule has existed in the same position previously.
Fix behaviour if you have a branch named the same as your --prefix
We were trying to 'git checkout $prefix', which is ambiguous if $prefix
names a directory *and* a branch. Do 'git checkout -- $prefix' instead.
The main place this appeared was in 'git subtree add'.
Reported by several people.
We were trying to 'git checkout $prefix', which is ambiguous if $prefix
names a directory *and* a branch. Do 'git checkout -- $prefix' instead.
The main place this appeared was in 'git subtree add'.
Reported by several people.
Improve patch to use git --exec-path: add to PATH instead.
If you (like me) are using a modified git straight out of its source
directory (ie. without installing), then --exec-path isn't actually correct.
Add it to the PATH instead, so if it is correct, it'll work, but if it's
not, we fall back to the previous behaviour.
If you (like me) are using a modified git straight out of its source
directory (ie. without installing), then --exec-path isn't actually correct.
Add it to the PATH instead, so if it is correct, it'll work, but if it's
not, we fall back to the previous behaviour.
Add explicit path of git installation by 'git --exec-path'.
As pointed out by documentation, the correct use of 'git-sh-setup' is
using $(git --exec-path) to avoid problems with not standard
installations.
Signed-off-by: gianluca.pacchiella <pacchiel@studenti.ph.unito.it>
As pointed out by documentation, the correct use of 'git-sh-setup' is
using $(git --exec-path) to avoid problems with not standard
installations.
Signed-off-by: gianluca.pacchiella <pacchiel@studenti.ph.unito.it>
sort assertion to make it more generic
fixed order of assertion in tests
todo: idea for a 'git subtree grafts' command
todo
todo^
todo
Docs: when pushing to github, the repo path needs to end in .git
Reported by Thell Fowler.
Reported by Thell Fowler.
todo
Some todo items reported by pmccurdy
update todo
man page: add an EXAMPLES section.
Add basic git-subtree manpage in asciidoc format.
Make --squash work with the 'add' command too.
Fix splitting after using a squash merge.
Don't squash-merge if the old and new commits are the same.
Basic "subtree merge --squash" support.
Instead of merging in the history of the entire subproject, just squash it
all into one commit, but try to at least track which commits we used so that
we can do future merges correctly.
Bonus feature: we can actually switch branches of the subproject this way,
just by "squash merging" back and forth from one tag to another.
Instead of merging in the history of the entire subproject, just squash it
all into one commit, but try to at least track which commits we used so that
we can do future merges correctly.
Bonus feature: we can actually switch branches of the subproject this way,
just by "squash merging" back and forth from one tag to another.
merge_msg() is really more like rejoin_msg().
FIXME help for --squash option
slightly rearrange help message for split.
New --branch option to split command.
This is just a handy way to create a new branch from the newly-split subtree.
This is just a handy way to create a new branch from the newly-split subtree.
typo in comment
More to-do items based on feedback
Abort if --rejoin fails.
Thanks to Eduardo Kienetz for noticing this.
Thanks to Eduardo Kienetz for noticing this.
debug messages are off by default; use -d to enable.
Instead of debug messages, we print a progress counter to stderr.
Instead of debug messages, we print a progress counter to stderr.
test.sh: oops, never intended to count the raw number of commits.
Just needed to make sure the count was non-zero.
Just needed to make sure the count was non-zero.
Simplify merges even more aggressively.
If any one of the parents is the same as the current one, then clearly the
other parent branch isn't important, so throw it away entirely.
Can't remember why I didn't do this before, but if I rediscover it, it
definitely needs a unit test.
If any one of the parents is the same as the current one, then clearly the
other parent branch isn't important, so throw it away entirely.
Can't remember why I didn't do this before, but if I rediscover it, it
definitely needs a unit test.
test.sh: make sure no commit changes more than one file at a time.
Only copy a commit if it has at least one nonidentical parent.
This is a simplification of the previous logic. I don't *think* it'll break
anything.
Results in far fewer useless merge commmits when playing with gitweb in the
git project:
git subtree split --prefix=gitweb --annotate='(split) ' 0a8f4f0^^..f2e7330
--onto=1130ef3
...and it doesn't *seem* to eliminate anything important.
This is a simplification of the previous logic. I don't *think* it'll break
anything.
Results in far fewer useless merge commmits when playing with gitweb in the
git project:
git subtree split --prefix=gitweb --annotate='(split) ' 0a8f4f0^^..f2e7330
--onto=1130ef3
...and it doesn't *seem* to eliminate anything important.
Trim some extra merge commits that don't need to go into the split tree.
...and update test.sh to test for this.
...and update test.sh to test for this.
test.sh tweak
Add some basic assertions to test.sh.
Add a 'create' helper function in test.sh.
Clarify why we can't do 'git rev-list' with a path.
Typo when searching for existing splits.
Add --annotate option, and create recognizable file content during tests.
todo list
Change test.sh to test the new add, merge, and pull commands.
Handle it successfully if a given parent commit has no parents.
Add 'git subtree merge' and 'git subtree pull'.
These are simple shortcuts for 'git merge -s subtree' and 'git pull -s
subtree', but it makes sense to have it all in one command.
These are simple shortcuts for 'git merge -s subtree' and 'git pull -s
subtree', but it makes sense to have it all in one command.
Add a new 'git subtree add' command for adding subtrees from a given rev.
Pass the path using the --prefix option instead of on the command line.
I like this better. It's more like git-read-tree and some other commands.
I like this better. It's more like git-read-tree and some other commands.
Okay, that was a little too aggressive.
Now we only prune out a commit if it has exactly one remaining parent and
that parent's tree is identical to ours.
But I also changed the test to create the initial "-s ours" merge in one
step instead of two, and that merge can be eliminated since one of its
parents doesn't affect the subdir at all, and is thus deleted.
Now we only prune out a commit if it has exactly one remaining parent and
that parent's tree is identical to ours.
But I also changed the test to create the initial "-s ours" merge in one
step instead of two, and that merge can be eliminated since one of its
parents doesn't affect the subdir at all, and is thus deleted.
Even more aggressive commit trimming.
Now we cut out a commit if any of its parents had the same tree; just use
that parent in its place. This makes the history look nice, but I don't
think it's quite right...
Now we cut out a commit if any of its parents had the same tree; just use
that parent in its place. This makes the history look nice, but I don't
think it's quite right...
Prune out some extra merge commits by comparing their parents correctly.
Quick test script for generating reasonably complex merge scenarios.
Skip over empty commits.
But we still need to get rid of unnecessary merge commits somehow...
But we still need to get rid of unnecessary merge commits somehow...
Hmm... can't actually filter rev-list on the subdir name.
Otherwise we can't keep track of parent relationships. Argh.
This change makes it "work", but we get a bunch of empty commits.
Otherwise we can't keep track of parent relationships. Argh.
This change makes it "work", but we get a bunch of empty commits.
Added a --onto option, but it's so complicated I can't tell if it works.