* [PATCH 0/4] contrib/subtree: general updates
@ 2013-03-13 22:32 Paul Campbell
2013-03-13 22:32 ` [PATCH 1/4] contrib/subtree: Teach push to abort if split fails Paul Campbell
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Paul Campbell @ 2013-03-13 22:32 UTC (permalink / raw)
To: git; +Cc: David Greene, Paul Campbell
Less ambitious patch series this time.
James and Michael's patches add if clauses that use the
bashism 'if []' rather than 'if test'. I've left them as
they are to match the other if clauses within the
git-subtree.sh file. I remember reading a comment on the
list about matching the local style being more important
than the overall project's style. I'm happy to change them
otherwise.
James Roper (1):
contrib/subtree: Teach push to use --force option
Matt Hoffman (1):
contrib/subtree: Replace invisible carriage return with a visible \r
Michael Hart (1):
contrib/subtree: Teach push to abort if split fails
Paul Cartwright (1):
contrib/subtree: Fix typo (s/incldued/included/)
contrib/subtree/git-subtree.sh | 16 ++++++++++++++--
contrib/subtree/git-subtree.txt | 7 ++++++-
2 files changed, 20 insertions(+), 3 deletions(-)
--
1.8.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/4] contrib/subtree: Teach push to abort if split fails
2013-03-13 22:32 [PATCH 0/4] contrib/subtree: general updates Paul Campbell
@ 2013-03-13 22:32 ` Paul Campbell
2013-03-13 22:32 ` [PATCH 2/4] contrib/subtree: Teach push to use --force option Paul Campbell
` (3 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Paul Campbell @ 2013-03-13 22:32 UTC (permalink / raw)
To: git; +Cc: David Greene, Michael Hart, Paul Campbell
From: Michael Hart <michael@adslot.com>
If the subtree split fails it doesn't return the SHA that should be
pushed to the other repository.
Added a check to ensure that split succeeds before trying to push
and display an error message.
Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
---
contrib/subtree/git-subtree.sh | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 8a23f58..c68cc6f 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -715,7 +715,12 @@ cmd_push()
repository=$1
refspec=$2
echo "git push using: " $repository $refspec
- git push $repository $(git subtree split --prefix=$prefix):refs/heads/$refspec
+ rev=$(git subtree split --prefix=$prefix)
+ if [ -n "$rev" ]; then
+ git push $repository $rev:refs/heads/$refspec
+ else
+ die "Couldn't push, 'git subtree split' failed."
+ fi
else
die "'$dir' must already exist. Try 'git subtree add'."
fi
--
1.8.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 2/4] contrib/subtree: Teach push to use --force option
2013-03-13 22:32 [PATCH 0/4] contrib/subtree: general updates Paul Campbell
2013-03-13 22:32 ` [PATCH 1/4] contrib/subtree: Teach push to abort if split fails Paul Campbell
@ 2013-03-13 22:32 ` Paul Campbell
2013-03-13 22:32 ` [PATCH 3/4] contrib/subtree: Fix typo (s/incldued/included/) Paul Campbell
` (2 subsequent siblings)
4 siblings, 0 replies; 10+ messages in thread
From: Paul Campbell @ 2013-03-13 22:32 UTC (permalink / raw)
To: git; +Cc: David Greene, James Roper, Paul Campbell
From: James Roper <jroper@vz.net>
Allow the --force option to be passed to the child push command.
Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
---
contrib/subtree/git-subtree.sh | 9 ++++++++-
contrib/subtree/git-subtree.txt | 5 +++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index c68cc6f..2d9b071 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -26,6 +26,8 @@ b,branch= create a new branch from the split subtree
ignore-joins ignore prior --rejoin commits
onto= try connecting new tree to an existing one
rejoin merge the new branch back into HEAD
+ options for 'push'
+f,force use force push
options for 'add', 'merge', 'pull' and 'push'
squash merge subtree changes as a single commit
"
@@ -84,6 +86,7 @@ while [ $# -gt 0 ]; do
-b) branch="$1"; shift ;;
-P) prefix="$1"; shift ;;
-m) message="$1"; shift ;;
+ -f|--force) force=1 ;;
--no-prefix) prefix= ;;
--onto) onto="$1"; shift ;;
--no-onto) onto= ;;
@@ -712,12 +715,16 @@ cmd_push()
die "You must provide <repository> <refspec>"
fi
if [ -e "$dir" ]; then
+ push_opts=
+ if [ "$force" == "1" ]; then
+ push_opts="$push_opts --force"
+ fi
repository=$1
refspec=$2
echo "git push using: " $repository $refspec
rev=$(git subtree split --prefix=$prefix)
if [ -n "$rev" ]; then
- git push $repository $rev:refs/heads/$refspec
+ git push $push_opts $repository $rev:refs/heads/$refspec
else
die "Couldn't push, 'git subtree split' failed."
fi
diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt
index 7ba853e..97dd3c9 100644
--- a/contrib/subtree/git-subtree.txt
+++ b/contrib/subtree/git-subtree.txt
@@ -255,6 +255,11 @@ OPTIONS FOR split
'--rejoin' when you split, because you don't want the
subproject's history to be part of your project anyway.
+OPTIONS FOR push
+----------------
+-f::
+--force::
+ Uses 'git push --force'.
EXAMPLE 1. Add command
----------------------
--
1.8.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 3/4] contrib/subtree: Fix typo (s/incldued/included/)
2013-03-13 22:32 [PATCH 0/4] contrib/subtree: general updates Paul Campbell
2013-03-13 22:32 ` [PATCH 1/4] contrib/subtree: Teach push to abort if split fails Paul Campbell
2013-03-13 22:32 ` [PATCH 2/4] contrib/subtree: Teach push to use --force option Paul Campbell
@ 2013-03-13 22:32 ` Paul Campbell
2013-03-13 22:32 ` [PATCH 4/4] contrib/subtree: Replace invisible carriage return with a visible \r Paul Campbell
2013-03-14 2:52 ` [PATCH 0/4] contrib/subtree: general updates Miles Bader
4 siblings, 0 replies; 10+ messages in thread
From: Paul Campbell @ 2013-03-13 22:32 UTC (permalink / raw)
To: git; +Cc: David Greene, Paul Cartwright, Paul Campbell
From: Paul Cartwright <paul.cartwright@ziilabs.com>
Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
---
contrib/subtree/git-subtree.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/subtree/git-subtree.txt b/contrib/subtree/git-subtree.txt
index 97dd3c9..e1bfa61 100644
--- a/contrib/subtree/git-subtree.txt
+++ b/contrib/subtree/git-subtree.txt
@@ -275,7 +275,7 @@ git-extensions repository in ~/git-extensions/:
name
You can omit the --squash flag, but doing so will increase the number
-of commits that are incldued in your local repository.
+of commits that are included in your local repository.
We now have a ~/git-extensions/git-subtree directory containing code
from the master branch of git://github.com/apenwarr/git-subtree.git
--
1.8.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH 4/4] contrib/subtree: Replace invisible carriage return with a visible \r
2013-03-13 22:32 [PATCH 0/4] contrib/subtree: general updates Paul Campbell
` (2 preceding siblings ...)
2013-03-13 22:32 ` [PATCH 3/4] contrib/subtree: Fix typo (s/incldued/included/) Paul Campbell
@ 2013-03-13 22:32 ` Paul Campbell
2013-03-13 22:36 ` Paul Campbell
2013-03-14 2:52 ` [PATCH 0/4] contrib/subtree: general updates Miles Bader
4 siblings, 1 reply; 10+ messages in thread
From: Paul Campbell @ 2013-03-13 22:32 UTC (permalink / raw)
To: git; +Cc: David Greene, Matt Hoffman, Paul Campbell
From: Matt Hoffman <matt.hoffman@quantumretail.com>
The ctrl-M (^M) character used for the carriage return (CR) is not visible
in all (most) text editors and is often silently converted to a new
line (NL) or CR/NL combo.
'say' is a wrapper for echo with accepts the option -e to interperet
escaped characters. \r becomes a CR, yet is not munged by text
editors.
Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
Conflicts:
git-subtree.sh
---
contrib/subtree/git-subtree.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 2d9b071..5314bd0 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -595,7 +595,7 @@ cmd_split()
eval "$grl" |
while read rev parents; do
revcount=$(($revcount + 1))
- say -n "$revcount/$revmax ($createcount)
"
+ say -ne "$revcount/$revmax ($createcount)\r"
debug "Processing commit: $rev"
exists=$(cache_get $rev)
if [ -n "$exists" ]; then
--
1.8.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 4/4] contrib/subtree: Replace invisible carriage return with a visible \r
2013-03-13 22:32 ` [PATCH 4/4] contrib/subtree: Replace invisible carriage return with a visible \r Paul Campbell
@ 2013-03-13 22:36 ` Paul Campbell
2013-03-13 22:42 ` [PATCH] " Paul Campbell
0 siblings, 1 reply; 10+ messages in thread
From: Paul Campbell @ 2013-03-13 22:36 UTC (permalink / raw)
To: git; +Cc: David Greene, Matt Hoffman, Paul Campbell
On Wed, Mar 13, 2013 at 10:32 PM, Paul Campbell <pcampbell@kemitix.net> wrote:
> From: Matt Hoffman <matt.hoffman@quantumretail.com>
>
> The ctrl-M (^M) character used for the carriage return (CR) is not visible
> in all (most) text editors and is often silently converted to a new
> line (NL) or CR/NL combo.
>
> 'say' is a wrapper for echo with accepts the option -e to interperet
> escaped characters. \r becomes a CR, yet is not munged by text
> editors.
>
> Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
>
> Conflicts:
> git-subtree.sh
Oops. Meant to replace this Conflict line.
> ---
> contrib/subtree/git-subtree.sh | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
> index 2d9b071..5314bd0 100755
> --- a/contrib/subtree/git-subtree.sh
> +++ b/contrib/subtree/git-subtree.sh
> @@ -595,7 +595,7 @@ cmd_split()
> eval "$grl" |
> while read rev parents; do
> revcount=$(($revcount + 1))
> - say -n "$revcount/$revmax ($createcount)
> "
> + say -ne "$revcount/$revmax ($createcount)\r"
> debug "Processing commit: $rev"
> exists=$(cache_get $rev)
> if [ -n "$exists" ]; then
> --
> 1.8.2
>
--
Paul [W] Campbell
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] contrib/subtree: Replace invisible carriage return with a visible \r
2013-03-13 22:36 ` Paul Campbell
@ 2013-03-13 22:42 ` Paul Campbell
0 siblings, 0 replies; 10+ messages in thread
From: Paul Campbell @ 2013-03-13 22:42 UTC (permalink / raw)
To: git; +Cc: David Greene, Matt Hoffman, Paul Campbell
From: Matt Hoffman <matt.hoffman@quantumretail.com>
The ctrl-M (^M) character used for the carriage return (CR) is not visible
in all (most) text editors and is often silently converted to a new
line (NL) or CR/NL combo.
'say' is a wrapper for echo with accepts the option -e to interperet
escaped characters. \r becomes a CR, yet is not munged by text
editors.
Signed-off-by: Paul Campbell <pcampbell@kemitix.net>
---
Rerolled with the Conflicts lines removed.
contrib/subtree/git-subtree.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/subtree/git-subtree.sh b/contrib/subtree/git-subtree.sh
index 2d9b071..5314bd0 100755
--- a/contrib/subtree/git-subtree.sh
+++ b/contrib/subtree/git-subtree.sh
@@ -595,7 +595,7 @@ cmd_split()
eval "$grl" |
while read rev parents; do
revcount=$(($revcount + 1))
- say -n "$revcount/$revmax ($createcount)
"
+ say -ne "$revcount/$revmax ($createcount)\r"
debug "Processing commit: $rev"
exists=$(cache_get $rev)
if [ -n "$exists" ]; then
--
1.8.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] contrib/subtree: general updates
2013-03-13 22:32 [PATCH 0/4] contrib/subtree: general updates Paul Campbell
` (3 preceding siblings ...)
2013-03-13 22:32 ` [PATCH 4/4] contrib/subtree: Replace invisible carriage return with a visible \r Paul Campbell
@ 2013-03-14 2:52 ` Miles Bader
2013-03-14 3:30 ` Junio C Hamano
4 siblings, 1 reply; 10+ messages in thread
From: Miles Bader @ 2013-03-14 2:52 UTC (permalink / raw)
To: Paul Campbell; +Cc: git, David Greene
Paul Campbell <pcampbell@kemitix.net> writes:
> James and Michael's patches add if clauses that use the
> bashism 'if []' rather than 'if test'.
"Bashism"...? I dunno how portable is, but "[" is an old unix alias
for "test" ... it certainly predates bash...
-miles
--
Occam's razor split hairs so well, I bought the whole argument!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] contrib/subtree: general updates
2013-03-14 2:52 ` [PATCH 0/4] contrib/subtree: general updates Miles Bader
@ 2013-03-14 3:30 ` Junio C Hamano
2013-03-24 0:16 ` Paul Campbell
0 siblings, 1 reply; 10+ messages in thread
From: Junio C Hamano @ 2013-03-14 3:30 UTC (permalink / raw)
To: Miles Bader; +Cc: Paul Campbell, git, David Greene
Miles Bader <miles@gnu.org> writes:
> Paul Campbell <pcampbell@kemitix.net> writes:
>> James and Michael's patches add if clauses that use the
>> bashism 'if []' rather than 'if test'.
>
> "Bashism"...? I dunno how portable is, but "[" is an old unix alias
> for "test" ... it certainly predates bash...
Correct. [[ ... ]] is new and spelling out "test" indeed is more
traditionalist than [ ... ], but for contrib/subtree/ that does not
work with anything but bash, I do not think such a rewrite has much
merit in the first place. Being consistently "bash script" (as
opposed to being old-style) is more appropriate for it.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 0/4] contrib/subtree: general updates
2013-03-14 3:30 ` Junio C Hamano
@ 2013-03-24 0:16 ` Paul Campbell
0 siblings, 0 replies; 10+ messages in thread
From: Paul Campbell @ 2013-03-24 0:16 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Miles Bader, git, David Greene
On Thu, Mar 14, 2013 at 3:30 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Miles Bader <miles@gnu.org> writes:
>
>> Paul Campbell <pcampbell@kemitix.net> writes:
>>> James and Michael's patches add if clauses that use the
>>> bashism 'if []' rather than 'if test'.
>>
>> "Bashism"...? I dunno how portable is, but "[" is an old unix alias
>> for "test" ... it certainly predates bash...
>
> Correct. [[ ... ]] is new and spelling out "test" indeed is more
> traditionalist than [ ... ], but for contrib/subtree/ that does not
> work with anything but bash, I do not think such a rewrite has much
> merit in the first place. Being consistently "bash script" (as
> opposed to being old-style) is more appropriate for it.
>
>
Does no-one have any other comments about these patches?
--
Paul [W] Campbell
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2013-03-24 0:16 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-13 22:32 [PATCH 0/4] contrib/subtree: general updates Paul Campbell
2013-03-13 22:32 ` [PATCH 1/4] contrib/subtree: Teach push to abort if split fails Paul Campbell
2013-03-13 22:32 ` [PATCH 2/4] contrib/subtree: Teach push to use --force option Paul Campbell
2013-03-13 22:32 ` [PATCH 3/4] contrib/subtree: Fix typo (s/incldued/included/) Paul Campbell
2013-03-13 22:32 ` [PATCH 4/4] contrib/subtree: Replace invisible carriage return with a visible \r Paul Campbell
2013-03-13 22:36 ` Paul Campbell
2013-03-13 22:42 ` [PATCH] " Paul Campbell
2013-03-14 2:52 ` [PATCH 0/4] contrib/subtree: general updates Miles Bader
2013-03-14 3:30 ` Junio C Hamano
2013-03-24 0:16 ` Paul Campbell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).