Commit Graph

59 Commits

Author SHA1 Message Date
Cole Stanfield
11f1511e76 Fixing eval syntax error. 2010-10-21 12:18:51 -07:00
Avery Pennarun
df2302d774 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.
2010-06-24 16:57:58 -04:00
Avery Pennarun
8e770bd389 Merge remote branch 'origin/master'
* origin/master:
  Fixed regression with splitting out new subtree
  Use 'git merge -Xsubtree' when git version >= 1.7.0.
2010-06-24 02:11:04 -04:00
Avery Pennarun
9c632ea29c (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.
2010-06-24 01:53:05 -04:00
Pelle Wessman
39f5fff0d5 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.
2010-05-20 22:40:09 +02:00
Pelle Wessman
448e71e263 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.
2010-05-07 15:59:56 -04:00
Wayne Walter
c00d1d1168 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.)
2010-02-13 14:45:04 -05:00
Avery Pennarun
77ba305852 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.
2010-02-08 15:02:29 -05:00
Win Treese
ec54f0d9ad 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.
2010-02-06 15:06:45 -05:00
Avery Pennarun
349a70d5cf 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.
2010-02-06 15:06:45 -05:00
Avery Pennarun
e2d0a4502f 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.
2010-02-02 10:30:11 -05:00
Jakub Suder
6bd910a821 improved rev_is_descendant_of_branch() function 2010-01-12 23:34:52 +01:00
Jakub Suder
12629161a8 fixed bug in commit message for split 2010-01-12 22:38:34 +01:00
Jakub Suder
6e25f79f35 changed alias for --prefix from -p to -P 2010-01-12 22:38:21 +01:00
Jakub Suder
da949cc554 fix for subtree split not finding proper base for new commits 2010-01-10 13:09:26 +01:00
Jakub Suder
0a562948ae allow using --branch with existing branches if it makes sense 2010-01-10 13:09:26 +01:00
Jakub Suder
2da0969a79 added -m/--message option for setting merge commit message 2010-01-10 13:09:23 +01:00
Jakub Suder
6da401386e added -p alias for --prefix 2010-01-06 23:11:43 +01:00
Avery Pennarun
e31d1e2f30 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.
2009-10-02 18:23:54 -04:00
Avery Pennarun
2275f7077d 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.
2009-10-02 16:09:48 -04:00
Avery Pennarun
6f2012cdc0 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.
2009-10-02 16:08:58 -04:00
Pelle Wessman
8ac5eca1ea 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. 2009-09-30 14:29:42 +02:00
Avery Pennarun
227f781147 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.
2009-08-26 10:45:13 -04:00
Avery Pennarun
33aaa697a2 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.
2009-08-26 10:42:27 -04:00
kTln2
2987e6add3 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>
2009-08-20 13:25:29 -04:00
Avery Pennarun
d713e2d87a Make --squash work with the 'add' command too. 2009-05-30 04:13:47 -04:00
Avery Pennarun
1a8c36dc5f Fix splitting after using a squash merge. 2009-05-30 03:33:39 -04:00
Avery Pennarun
eb4fb91094 Don't squash-merge if the old and new commits are the same. 2009-05-30 03:33:17 -04:00
Avery Pennarun
1cc2cfff91 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.
2009-05-30 03:18:27 -04:00
Avery Pennarun
7ee9eef340 merge_msg() is really more like rejoin_msg(). 2009-05-30 01:51:38 -04:00
Avery Pennarun
8e79043c47 FIXME help for --squash option 2009-05-30 01:12:58 -04:00
Avery Pennarun
f4f29557e7 slightly rearrange help message for split. 2009-05-30 01:12:34 -04:00
Avery Pennarun
43a3951243 New --branch option to split command.
This is just a handy way to create a new branch from the newly-split subtree.
2009-05-30 01:12:32 -04:00
Avery Pennarun
f96bc79019 typo in comment 2009-05-30 00:47:59 -04:00
Avery Pennarun
ea28d67442 Abort if --rejoin fails.
Thanks to Eduardo Kienetz for noticing this.
2009-04-30 21:57:32 -04:00
Avery Pennarun
942dce5578 debug messages are off by default; use -d to enable.
Instead of debug messages, we print a progress counter to stderr.
2009-04-26 18:06:08 -04:00
Avery Pennarun
795e730e71 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.
2009-04-26 17:44:18 -04:00
Avery Pennarun
49cf82288a 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.
2009-04-26 17:07:16 -04:00
Avery Pennarun
a64f3a7286 Trim some extra merge commits that don't need to go into the split tree.
...and update test.sh to test for this.
2009-04-26 16:53:57 -04:00
Avery Pennarun
1f73862f3b Clarify why we can't do 'git rev-list' with a path. 2009-04-26 15:54:42 -04:00
Avery Pennarun
86de04c6eb Typo when searching for existing splits. 2009-04-26 09:55:59 -04:00
Avery Pennarun
d0eb1b1417 Add --annotate option, and create recognizable file content during tests. 2009-04-26 08:59:12 -04:00
Avery Pennarun
b9de53532c Handle it successfully if a given parent commit has no parents. 2009-04-25 00:06:45 -04:00
Avery Pennarun
13648af5ee 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.
2009-04-24 23:41:19 -04:00
Avery Pennarun
eb7b590c8c Add a new 'git subtree add' command for adding subtrees from a given rev. 2009-04-24 23:28:30 -04:00
Avery Pennarun
9a8821ff33 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.
2009-04-24 22:57:14 -04:00
Avery Pennarun
96db2c0448 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.
2009-04-24 22:38:58 -04:00
Avery Pennarun
d691265880 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...
2009-04-24 22:05:30 -04:00
Avery Pennarun
210d083904 Prune out some extra merge commits by comparing their parents correctly. 2009-04-24 21:49:19 -04:00
Avery Pennarun
847e868167 Quick test script for generating reasonably complex merge scenarios. 2009-04-24 21:35:50 -04:00