* merge -s ffonly
@ 2008-10-06 23:56 Shawn O. Pearce
2008-10-07 18:58 ` [RFC] git rev-contains [Was: merge -s ffonly] Uwe Kleine-König
0 siblings, 1 reply; 5+ messages in thread
From: Shawn O. Pearce @ 2008-10-06 23:56 UTC (permalink / raw)
To: git; +Cc: Randal L. Schwartz
I really don't care about this feature. But Randal's whining on
#git made me stop what I was doing and write something that might
turn into it.
Totally untested code. It might reformat your C:\ drive and install
Windows ME. Install as $(git --exec-path)/git-merge-ffonly and
call as `git merge -s ffonly`.
If you care about this sort of feature, test it, write tests for it,
make a formal patch, and send it for review. No, I will not do this
for you. As I said, I don't care about this as a feature.
--8<--
diff --git a/git-merge-ffonly.sh b/git-merge-ffonly.sh
new file mode 100644
index 0000000..24363b5
--- /dev/null
+++ b/git-merge-ffonly.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+while test $# -gt 0
+do
+ if test "z$1" = z--
+ then
+ shift
+ break
+ else
+ shift
+ fi
+done
+
+while test $# -gt 0
+do
+ if test -n "$(git rev-list $1..HEAD)"
+ then
+ exit 2
+ fi
+ shift
+done
--
Shawn.
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [RFC] git rev-contains [Was: merge -s ffonly]
2008-10-06 23:56 merge -s ffonly Shawn O. Pearce
@ 2008-10-07 18:58 ` Uwe Kleine-König
2008-10-08 6:18 ` Andreas Ericsson
2008-10-08 14:30 ` Deskin Miller
0 siblings, 2 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2008-10-07 18:58 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git, Randal L. Schwartz
Hello,
> + if test -n "$(git rev-list $1..HEAD)"
I already wrote similar tests and I wonder if this couldn't be done in a
new builtin command more effectively. Something like
git rev-contains HEAD "$1"
. I expect it to be faster and maybe it prevents a command line
overflow?! (I remember something like 32000 chars max in a command, but
I could not trigger that with bash.)
Best regards
Uwe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] git rev-contains [Was: merge -s ffonly]
2008-10-07 18:58 ` [RFC] git rev-contains [Was: merge -s ffonly] Uwe Kleine-König
@ 2008-10-08 6:18 ` Andreas Ericsson
2008-10-08 14:30 ` Deskin Miller
1 sibling, 0 replies; 5+ messages in thread
From: Andreas Ericsson @ 2008-10-08 6:18 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: Shawn O. Pearce, git, Randal L. Schwartz
Uwe Kleine-König wrote:
> Hello,
>
>> + if test -n "$(git rev-list $1..HEAD)"
> I already wrote similar tests and I wonder if this couldn't be done in a
> new builtin command more effectively. Something like
>
> git rev-contains HEAD "$1"
>
> . I expect it to be faster and maybe it prevents a command line
> overflow?! (I remember something like 32000 chars max in a command, but
> I could not trigger that with bash.)
>
On Linux (well, on my system anyways), it's 128K for arguments and
environment combined.
--
Andreas Ericsson andreas.ericsson@op5.se
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] git rev-contains [Was: merge -s ffonly]
2008-10-07 18:58 ` [RFC] git rev-contains [Was: merge -s ffonly] Uwe Kleine-König
2008-10-08 6:18 ` Andreas Ericsson
@ 2008-10-08 14:30 ` Deskin Miller
2008-10-08 15:41 ` Uwe Kleine-König
1 sibling, 1 reply; 5+ messages in thread
From: Deskin Miller @ 2008-10-08 14:30 UTC (permalink / raw)
To: =?ISO-8859-1?Q?Uwe_Kleine-K=F6nig_
Cc: Shawn O. Pearce, git, Randal L. Schwartz
On Tue, Oct 07, 2008 at 08:58:15PM +0200, =?ISO-8859-1?Q?Uwe_Kleine-K=F6nig_ wrote:
> > + if test -n "$(git rev-list $1..HEAD)"
> I already wrote similar tests and I wonder if this couldn't be done in a
> new builtin command more effectively. Something like
>
> git rev-contains HEAD "$1"
>
> . I expect it to be faster and maybe it prevents a command line
> overflow?! [...]
I'm not sure this warrants a builtin; seems like test is perfectly capable of
doing what you want:
if test '(' -n "$(git rev-list --max-count=1 $1..HEAD)" ')' -a \
'(' -z "$(git rev-list --max-count=1 HEAD..$1)" ')'
The second check is needed to ensure that the commits actually have an
ancestor-descendant relationship. And --max-count means your command line
won't overflow.
Or what about this:
if test "$(git merge-base $1 HEAD)" = "$(git rev-parse $1)"
My $0.02,
Deskin Miller
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC] git rev-contains [Was: merge -s ffonly]
2008-10-08 14:30 ` Deskin Miller
@ 2008-10-08 15:41 ` Uwe Kleine-König
0 siblings, 0 replies; 5+ messages in thread
From: Uwe Kleine-König @ 2008-10-08 15:41 UTC (permalink / raw)
To: Deskin Miller; +Cc: Shawn O. Pearce, git, Randal L. Schwartz
Hello Deskin,
On Wed, Oct 08, 2008 at 10:30:50AM -0400, Deskin Miller wrote:
> On Tue, Oct 07, 2008 at 08:58:15PM +0200, =?ISO-8859-1?Q?Uwe_Kleine-K=F6nig_ wrote:
> > > + if test -n "$(git rev-list $1..HEAD)"
> > I already wrote similar tests and I wonder if this couldn't be done in a
> > new builtin command more effectively. Something like
> >
> > git rev-contains HEAD "$1"
> >
> > . I expect it to be faster and maybe it prevents a command line
> > overflow?! [...]
>
> I'm not sure this warrants a builtin; seems like test is perfectly capable of
> doing what you want:
>
> if test '(' -n "$(git rev-list --max-count=1 $1..HEAD)" ')' -a \
> '(' -z "$(git rev-list --max-count=1 HEAD..$1)" ')'
>
> The second check is needed to ensure that the commits actually have an
> ancestor-descendant relationship.
This is needed for the original patch, too, isn't it.
> And --max-count means your command line
> won't overflow.
ah, --max-count is a nice idea. Topgit could benefit from it.
> Or what about this:
>
> if test "$(git merge-base $1 HEAD)" = "$(git rev-parse $1)"
It's not entirely clear to me, this works in general, because a
merge-base isn't unique. It should work in this case, though.
Best regards
Uwe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-08 15:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-06 23:56 merge -s ffonly Shawn O. Pearce
2008-10-07 18:58 ` [RFC] git rev-contains [Was: merge -s ffonly] Uwe Kleine-König
2008-10-08 6:18 ` Andreas Ericsson
2008-10-08 14:30 ` Deskin Miller
2008-10-08 15:41 ` Uwe Kleine-König
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).