From: Junio C Hamano <gitster@pobox.com>
To: Thomas Rast <trast@student.ethz.ch>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>, git@vger.kernel.org
Subject: Re: [PATCH 1/2] rebase -i --root: simplify code
Date: Sun, 25 Jan 2009 21:54:10 -0800 [thread overview]
Message-ID: <7vtz7ma9z1.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <200901260053.06315.trast@student.ethz.ch> (Thomas Rast's message of "Mon, 26 Jan 2009 00:53:03 +0100")
Thomas Rast <trast@student.ethz.ch> writes:
> Thomas Rast wrote:
>> test ! -s "$DOTEST"/upstream && REBASE_ROOT=t
>
> Actually, I think that test never worked (and it's clearly my fault).
>
> The corresponding 'echo $UPSTREAM > "$DOTEST"/upstream' just expanded
> to 'echo > ...', resulting in a file containing a single newline, but
> never a zero-length file. Duh.
Since you never use the value stored in "$DOTEST/upstream" for anything
else anyway, how about doing something like this instead? It would make
the meaning of the file used as a state variable much clearer.
It may break hooks and outside scripts that look at $DOTEST/upstream. I
didn't check.
The hunk in the middle is to protect you against an environment variable
UPSTREAM the user may have before starting "rebase -i". There could be
other state variables you added in recent commit d911d14 (rebase -i: learn
to rebase root commit, 2009-01-02) that needs similar protection. Please
check.
git-rebase--interactive.sh | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git c/git-rebase--interactive.sh w/git-rebase--interactive.sh
index 21ac20c..17cf0e5 100755
--- c/git-rebase--interactive.sh
+++ w/git-rebase--interactive.sh
@@ -456,7 +456,7 @@ get_saved_options () {
test -d "$REWRITTEN" && PRESERVE_MERGES=t
test -f "$DOTEST"/strategy && STRATEGY="$(cat "$DOTEST"/strategy)"
test -f "$DOTEST"/verbose && VERBOSE=t
- test ! -s "$DOTEST"/upstream && REBASE_ROOT=t
+ test -f "$DOTEST"/rebase-root && REBASE_ROOT=t
}
while test $# != 0
@@ -585,6 +585,7 @@ first and then run 'git rebase --continue' again."
test -z "$ONTO" && ONTO=$UPSTREAM
shift
else
+ UPSTREAM=
UPSTREAM_ARG=--root
test -z "$ONTO" &&
die "You must specify --onto when using --root"
@@ -611,7 +612,12 @@ first and then run 'git rebase --continue' again."
echo "detached HEAD" > "$DOTEST"/head-name
echo $HEAD > "$DOTEST"/head
- echo $UPSTREAM > "$DOTEST"/upstream
+ case "$REBASE_ROOT" in
+ '')
+ rm -f "$DOTEST"/rebase-root ;;
+ *)
+ : >"$DOTEST"/rebase-root ;;
+ esac
echo $ONTO > "$DOTEST"/onto
test -z "$STRATEGY" || echo "$STRATEGY" > "$DOTEST"/strategy
test t = "$VERBOSE" && : > "$DOTEST"/verbose
next prev parent reply other threads:[~2009-01-26 6:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-25 23:31 [PATCH 0/2] rebase -i --root cleanups Johannes Schindelin
2009-01-25 23:31 ` [PATCH 1/2] rebase -i --root: simplify code Johannes Schindelin
2009-01-25 23:49 ` Thomas Rast
2009-01-25 23:53 ` Thomas Rast
2009-01-26 5:54 ` Junio C Hamano [this message]
2009-01-26 9:05 ` [PATCH] rebase -i: correctly remember --root flag across --continue Thomas Rast
2009-01-26 20:47 ` Junio C Hamano
2009-01-26 21:05 ` Junio C Hamano
2009-01-26 21:09 ` Jeff King
2009-01-26 21:12 ` Jeff King
2009-01-26 21:28 ` Thomas Rast
2009-01-27 0:29 ` Junio C Hamano
2009-01-26 21:49 ` Junio C Hamano
2009-01-30 22:43 ` Thomas Rast
2009-01-30 22:47 ` [PATCH 1/2] t3412: clean up GIT_EDITOR usage Thomas Rast
2009-01-30 22:47 ` [PATCH 2/2] t3412: use log|name-rev instead of log --graph Thomas Rast
2009-02-01 22:24 ` [PATCH 1/2] t3412: clean up GIT_EDITOR usage Johannes Schindelin
2009-02-02 8:39 ` Thomas Rast
2009-01-26 0:44 ` [PATCH 1/2] rebase -i --root: simplify code Johannes Schindelin
2009-01-25 23:32 ` [PATCH 2/2] rebase -i --root: fix check for number of arguments Johannes Schindelin
2009-01-26 0:07 ` Thomas Rast
2009-01-26 0:49 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vtz7ma9z1.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=trast@student.ethz.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.