summaryrefslogtreecommitdiff
path: root/contrib/subtree/git-subtree.sh
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'dw/subtree-split-do-not-drop-merge'Junio C Hamano2016-02-031-2/+10
|\ | | | | | | | | | | | | | | The "split" subcommand of "git subtree" (in contrib/) incorrectly skipped merges when it shouldn't, which was corrected. * dw/subtree-split-do-not-drop-merge: contrib/subtree: fix "subtree split" skipped-merge bug
| * contrib/subtree: fix "subtree split" skipped-merge bugdw/subtree-split-do-not-drop-mergeDave Ware2016-01-201-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'git subtree split' can incorrectly skip a merge even when both parents act on the subtree, provided the merge results in a tree identical to one of the parents. Fix by copying the merge if at least one parent is non-identical, and the non-identical parent is not an ancestor of the identical parent. Also, add a test case which checks that a descendant remains a descendent on the subtree in this case. Signed-off-by: Dave Ware <davidw@realtimegenomics.com> Reviewed-by: David A. Greene <greened@obbligato.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'rm/subtree-unwrap-tags'Junio C Hamano2016-01-221-2/+8
|\ \ | |/ |/| | | | | | | | | | | | | | | | | "git subtree" (in contrib/) records the tag object name in the commit log message when a subtree is added using a tag, without peeling it down to the underlying commit. The tag needs to be peeled when "git subtree split" wants to work on the commit, but the command forgot to do so. * rm/subtree-unwrap-tags: contrib/subtree: unwrap tag refs
| * contrib/subtree: unwrap tag refsrm/subtree-unwrap-tagsRob Mayoff2015-11-241-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a subtree was added using a tag ref, the tag ref is stored in the subtree commit message instead of the underlying commit's ref. To split or push subsequent changes to the subtree, the subtree command needs to unwrap the tag ref. This patch makes it do so. The problem was described in a message to the mailing list from Junio C Hamano dated 29 Apr 2014, with the subject "Re: git subtree issue in more recent versions". The archived message can be found at <http://comments.gmane.org/gmane.comp.version-control.git/247503>. Signed-off-by: Rob Mayoff <mayoff@dqd.com> Signed-off-by: Jeff King <peff@peff.net>
* | contrib/subtree: Handle '--prefix' argument with a slash appendedTechlive Zheng2015-11-131-1/+1
| | | | | | | | | | | | | | | | | | 'git subtree merge' will fail if the argument of '--prefix' has a slash appended. Signed-off-by: Techlive Zheng <techlivezheng@gmail.com> Signed-off-by: David A. Greene <greened@obbligato.org> Signed-off-by: Jeff King <peff@peff.net>
* | contrib/subtree: respect spaces in a repository pathas/subtree-with-spacesAlexey Shumkin2015-09-081-1/+1
| | | | | | | | | | | | | | | | | | Remote repository may have spaces in its path, so take it into account. Also, as far as there are no tests for the `push` command, add them. Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | t7900-subtree: test the "space in a subdirectory name" caseAlexey Shumkin2015-09-081-1/+1
|/ | | | | | | | | | | | | | | | In common case there can be spaces in a subdirectory name. Change tests accorgingly to this statement. Also, as far as a call to the `rejoin_msg` function (in `cmd_split`) does not take into account such a case this patch fixes commit message when `--rejoin` option is set . Besides, as `fixnl` and `multiline` functions did not take into account the "new" tested "space in a subdirectory name" case they become unused and redundant, so they are removed. Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'da/subtree-date-confusion'Junio C Hamano2015-08-031-1/+1
|\ | | | | | | | | | | | | | | | | "git subtree" (in contrib/) depended on "git log" output to be stable, which was a no-no. Apply a workaround to force a particular date format. * da/subtree-date-confusion: contrib/subtree: ignore log.date configuration
| * contrib/subtree: ignore log.date configurationda/subtree-date-confusionDavid Aguilar2015-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git-subtree's log format string uses "%ad" and "%cd", which respect the user's configured log.date value. This is problematic for git-subtree because it needs to use real dates so that copied commits come through unchanged. Add a test and tweak the format strings to use %aD and %cD so that the default date format is used instead. Reported-by: Bryan Jacobs <b@q3q.us> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'dl/subtree-avoid-tricky-echo'Junio C Hamano2015-05-221-3/+10
|\ \ | | | | | | | | | | | | | | | | | | | | | "git subtree" script (in contrib/) used "echo -n" to produce progress messages in a non-portable way. * dl/subtree-avoid-tricky-echo: contrib/subtree: portability fix for string printing
| * | contrib/subtree: portability fix for string printingdl/subtree-avoid-tricky-echoDanny Lin2015-05-081-3/+10
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'echo -n' is not portable, but this script used it as a way to give a string followed by a carriage return for progress messages. Introduce a new helper shell function "progress" and use printf as a more portable way to do this. As a side effect, this makes it unnecessary to have a raw CR in our source, which can be munged in some shells. For example, MsysGit trims CR before executing a shell script file in order to make it work right on Windows even if it uses CRLF as linefeeds. While at it, replace "echo" using printf in debug() and say() to eliminate the temptation of reintroducing the same bug. Signed-off-by: Danny Lin <danny0838@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | contrib/subtree: there's no push --squashdl/subtree-push-no-squashDanny Lin2015-05-071-1/+1
|/ | | | | | | | | The documentation says that --squash is for 'add', 'merge', 'pull' and 'push', while --squash actually doesn't change the behavior of 'push'. Correct the documentation. Signed-off-by: Danny Lin <danny0838@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/subtree: allow adding an annotated tagjd/subtreeJames Denholm2014-05-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | cmd_add_commit() is passed FETCH_HEAD by cmd_add_repository, which is then rev-parsed into an object name. However, if the user is fetching a tag rather than a branch HEAD, such as by executing: $ git subtree add -P oldGit https://github.com/git/git.git tags/v1.8.0 the object name refers to a tag and is never peeled, and the git commit-tree call (line 561) slaps us in the face because it doesn't peel tags to commits. Because peeling a committish doesn't do anything if it's already a commit, fix by peeling the object name before assigning it to $rev using peel_committish() from git:git-sh-setup.sh, a pre-existing dependency of git-subtree. Reported-by: Kevin Cagle <kcagle@micron.com> Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: James Denholm <nod.helm@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* subtree: initialize "prefix" variablejk/subtree-prefixJeff King2014-03-171-0/+1
| | | | | | | | | | | We parse the "--prefix" command-line option into the "$prefix" shell variable. However, if we do not see such an option, the variable is left with whatever value it had in the environment. We should initialize it to a known value, like we do for other variables. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* subtree: fix argument validation in add/pull/pushab/subtree-docAnthony Baire2014-01-131-6/+16
| | | | | | | | | | | | | | | | | | | When working with a remote repository add/pull/push do not accept a <refspec> as parameter but just a <ref>. They should accept any well-formatted ref name. This patch: - relaxes the check the <ref> argument in "git subtree add <repo>" (previous code would not accept a ref name that does not exist locally too, new code only ensures that the ref is well formatted) - add the same check in "git subtree pull/push" + check the number of parameters - update the doc to use <ref> instead of <refspec> Signed-off-by: Anthony Baire <Anthony.Baire@irisa.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'lf/echo-n-is-not-portable'Junio C Hamano2013-08-011-1/+1
|\ | | | | | | | | * lf/echo-n-is-not-portable: Avoid using `echo -n` anywhere
| * Avoid using `echo -n` anywherelf/echo-n-is-not-portableLukas Fleischer2013-07-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `echo -n` is non-portable. The POSIX specification says: Conforming applications that wish to do prompting without <newline> characters or that could possibly be expecting to echo a -n, should use the printf utility derived from the Ninth Edition system. Since all of the affected shell scripts use a POSIX shell shebang, replace `echo -n` invocations with printf. Signed-off-by: Lukas Fleischer <git@cryptocrack.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'dm/unbash-subtree'Junio C Hamano2013-06-051-1/+1
|\ \ | | | | | | | | | | | | | | | | | | | | | It turns out that git-subtree script does not have to be run with bash. * dm/unbash-subtree: contrib/git-subtree: Use /bin/sh interpreter instead of /bin/bash
| * | contrib/git-subtree: Use /bin/sh interpreter instead of /bin/bashDmitry Marakasov2013-05-211-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | Use /bin/sh interpreter instead of /bin/bash for contrib/git-subtree: it's required for systems which don't use bash by default (for example, FreeBSD), while there seem to be no bashisms in the script (confirmed by looking through the source and tesing subtree functionality with FreeBSD's /bin/sh) to require specifically bash and not the generic posix shell. Signed-off-by: Dmitry Marakasov <amdmi3@amdmi3.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | contrib/subtree: don't delete remote branches if split failsJohn Keeping2013-05-011-1/+2
|/ | | | | | | | | | | | | When using "git subtree push" to split out a subtree and push it to a remote repository, we do not detect if the split command fails which causes the LHS of the refspec to be empty, deleting the remote branch. Fix this by pulling the result of the split command into a variable so that we can die if the command fails. Reported-by: Steffen Jaeckel <steffen.jaeckel@stzedn.de> Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/subtree: fix synopsisDavid A. Greene2013-02-051-0/+6
| | | | | | | | | | Fix the documentation of add to show that a repository can be specified along with a commit. Suggested by Yann Dirson <dirson@bertin.fr>. Signed-off-by: David A. Greene <greened@obbligato.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/subtree: better error handling for 'subtree add'David A. Greene2013-02-051-3/+9
| | | | | | | | Check refspecs for validity before passing them on to other commands. This lets us generate more helpful error messages. Signed-off-by: David A. Greene <greened@obbligato.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* contrib/subtree: use %B for split subject/bodyTechlive Zheng2013-02-051-1/+1
| | | | | | | | | Use %B to format the commit message and body to avoid an extra newline if a commit only has a subject line. Signed-off-by: Techlive Zheng <techlivezheng@gmail.com> Signed-off-by: David A. Greene <greened@obbligato.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add 'contrib/subtree/' from commit 'd3a04e06c77d57978bb5230361c64946232cc346'David A. Greene2012-04-091-0/+712
git-subtree-dir: contrib/subtree git-subtree-mainline: e8dde3e5f9ddb7cf95a6ff3cea6cf07c3a2db80d git-subtree-split: d3a04e06c77d57978bb5230361c64946232cc346